Split out option usage restriction from option category.

These are two different concepts. Do not remove category overload compatibility in this CL, to keep this change limited to converting the current uses of category.

With some flyby formatting fixes on affected OptionsBases.

RELNOTES: None.
PiperOrigin-RevId: 153390002
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
index 8e6cc14..76d9715 100644
--- a/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/runtime/CommonCommandOptions.java
@@ -19,6 +19,7 @@
 import com.google.devtools.common.options.Converters;
 import com.google.devtools.common.options.Option;
 import com.google.devtools.common.options.OptionsBase;
+import com.google.devtools.common.options.OptionsParser.OptionUsageRestrictions;
 import com.google.devtools.common.options.OptionsParsingException;
 import java.util.List;
 import java.util.Map;
@@ -109,167 +110,206 @@
   )
   public Void allIncompatibleChanges;
 
-  @Option(name = "config",
-          defaultValue = "",
-          category = "misc",
-          allowMultiple = true,
-          help = "Selects additional config sections from the rc files; for every <command>, it "
-              + "also pulls in the options from <command>:<config> if such a section exists; "
-              + "if the section does not exist, this flag is ignored. "
-              + "Note that it is currently only possible to provide these options on the "
-              + "command line, not in the rc files. The config sections and flag combinations "
-              + "they are equivalent to are located in the tools/*.blazerc config files.")
+  @Option(
+    name = "config",
+    defaultValue = "",
+    category = "misc",
+    allowMultiple = true,
+    help =
+        "Selects additional config sections from the rc files; for every <command>, it "
+            + "also pulls in the options from <command>:<config> if such a section exists; "
+            + "if the section does not exist, this flag is ignored. "
+            + "Note that it is currently only possible to provide these options on the "
+            + "command line, not in the rc files. The config sections and flag combinations "
+            + "they are equivalent to are located in the tools/*.blazerc config files."
+  )
   public List<String> configs;
 
-  @Option(name = "logging",
-          defaultValue = "3", // Level.INFO
-          category = "verbosity",
-          converter = Converters.LogLevelConverter.class,
-          help = "The logging level.")
+  @Option(
+    name = "logging",
+    defaultValue = "3", // Level.INFO
+    category = "verbosity",
+    converter = Converters.LogLevelConverter.class,
+    help = "The logging level."
+  )
   public Level verbosity;
 
-  @Option(name = "client_env",
-      defaultValue = "",
-      category = "hidden",
-      converter = Converters.AssignmentConverter.class,
-      allowMultiple = true,
-      help = "A system-generated parameter which specifies the client's environment")
+  @Option(
+    name = "client_env",
+    defaultValue = "",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    converter = Converters.AssignmentConverter.class,
+    allowMultiple = true,
+    help = "A system-generated parameter which specifies the client's environment"
+  )
   public List<Map.Entry<String, String>> clientEnv;
 
-  @Option(name = "ignore_client_env",
-      defaultValue = "false",
-      category = "hidden",
-      deprecationWarning = "Deprecated, no-op.",
-      help = "Deprecated, no-op."
+  @Option(
+    name = "ignore_client_env",
+    defaultValue = "false",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    deprecationWarning = "Deprecated, no-op.",
+    help = "Deprecated, no-op."
   )
   // TODO(laszlocsomor, dslomov) 2017-03-07: remove this flag after 2017-06-01 (~3 months from now)
   // and all of its occurrences.
   public boolean ignoreClientEnv;
 
-  @Option(name = "client_cwd",
-      defaultValue = "",
-      category = "hidden",
-      converter = OptionsUtils.PathFragmentConverter.class,
-      help = "A system-generated parameter which specifies the client's working directory")
+  @Option(
+    name = "client_cwd",
+    defaultValue = "",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    converter = OptionsUtils.PathFragmentConverter.class,
+    help = "A system-generated parameter which specifies the client's working directory"
+  )
   public PathFragment clientCwd;
 
-  @Option(name = "announce_rc",
-      defaultValue = "false",
-      category = "verbosity",
-      help = "Whether to announce rc options.")
+  @Option(
+    name = "announce_rc",
+    defaultValue = "false",
+    category = "verbosity",
+    help = "Whether to announce rc options."
+  )
   public boolean announceRcOptions;
 
   /**
-   * These are the actual default overrides.
-   * Each value is a pair of (command name, value).
+   * These are the actual default overrides. Each value is a pair of (command name, value).
    *
-   * For example: "--default_override=build=--cpu=piii"
+   * <p>For example: "--default_override=build=--cpu=piii"
    */
-  @Option(name = "default_override",
-      defaultValue = "",
-      allowMultiple = true,
-      category = "hidden",
-      converter = OptionOverrideConverter.class,
-      help = "")
+  @Option(
+    name = "default_override",
+    defaultValue = "",
+    allowMultiple = true,
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    converter = OptionOverrideConverter.class,
+    help = ""
+  )
   public List<OptionOverride> optionsOverrides;
 
-  /**
-   * This is the filename that the Blaze client parsed.
-   */
-  @Option(name = "rc_source",
-      defaultValue = "",
-      allowMultiple = true,
-      category = "hidden",
-      help = "")
+  /** This is the filename that the Blaze client parsed. */
+  @Option(
+    name = "rc_source",
+    defaultValue = "",
+    allowMultiple = true,
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help = ""
+  )
   public List<String> rcSource;
 
-  @Option(name = "always_profile_slow_operations",
-      defaultValue = "true",
-      category = "undocumented",
-      help = "Whether profiling slow operations is always turned on")
+  @Option(
+    name = "always_profile_slow_operations",
+    defaultValue = "true",
+    optionUsageRestrictions = OptionUsageRestrictions.UNDOCUMENTED,
+    help = "Whether profiling slow operations is always turned on"
+  )
   public boolean alwaysProfileSlowOperations;
 
-  @Option(name = "profile",
-      defaultValue = "null",
-      category = "misc",
-      converter = OptionsUtils.PathFragmentConverter.class,
-      help = "If set, profile Blaze and write data to the specified "
-      + "file. Use blaze analyze-profile to analyze the profile.")
+  @Option(
+    name = "profile",
+    defaultValue = "null",
+    category = "misc",
+    converter = OptionsUtils.PathFragmentConverter.class,
+    help =
+        "If set, profile Blaze and write data to the specified "
+            + "file. Use blaze analyze-profile to analyze the profile."
+  )
   public PathFragment profilePath;
 
-  @Option(name = "record_full_profiler_data",
-      defaultValue = "false",
-      category = "undocumented",
-      help = "By default, Blaze profiler will record only aggregated data for fast but numerous "
-          + "events (such as statting the file). If this option is enabled, profiler will record "
-          + "each event - resulting in more precise profiling data but LARGE performance "
-          + "hit. Option only has effect if --profile used as well.")
+  @Option(
+    name = "record_full_profiler_data",
+    defaultValue = "false",
+    optionUsageRestrictions = OptionUsageRestrictions.UNDOCUMENTED,
+    help =
+        "By default, Blaze profiler will record only aggregated data for fast but numerous "
+            + "events (such as statting the file). If this option is enabled, profiler will record "
+            + "each event - resulting in more precise profiling data but LARGE performance "
+            + "hit. Option only has effect if --profile used as well."
+  )
   public boolean recordFullProfilerData;
 
-  @Option(name = "memory_profile",
-      defaultValue = "null",
-      category = "undocumented",
-      converter = OptionsUtils.PathFragmentConverter.class,
-      help = "If set, write memory usage data to the specified "
-          + "file at phase ends.")
+  @Option(
+    name = "memory_profile",
+    defaultValue = "null",
+    optionUsageRestrictions = OptionUsageRestrictions.UNDOCUMENTED,
+    converter = OptionsUtils.PathFragmentConverter.class,
+    help = "If set, write memory usage data to the specified " + "file at phase ends."
+  )
   public PathFragment memoryProfilePath;
 
-  @Option(name = "gc_watchdog",
-      defaultValue = "false",
-      category = "undocumented",
-      deprecationWarning = "Ignoring: this option is no longer supported",
-      help = "Deprecated.")
+  @Option(
+    name = "gc_watchdog",
+    defaultValue = "false",
+    optionUsageRestrictions = OptionUsageRestrictions.UNDOCUMENTED,
+    deprecationWarning = "Ignoring: this option is no longer supported",
+    help = "Deprecated."
+  )
   public boolean gcWatchdog;
 
-  @Option(name = "startup_time",
-      defaultValue = "0",
-      category = "hidden",
-      help = "The time in ms the launcher spends before sending the request to the blaze server.")
+  @Option(
+    name = "startup_time",
+    defaultValue = "0",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help = "The time in ms the launcher spends before sending the request to the blaze server."
+  )
   public long startupTime;
 
   @Option(
     name = "extract_data_time",
     defaultValue = "0",
-    category = "hidden",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
     help = "The time in ms spent on extracting the new blaze version."
   )
   public long extractDataTime;
 
-  @Option(name = "command_wait_time",
-      defaultValue = "0",
-      category = "hidden",
-      help = "The time in ms a command had to wait on a busy Blaze server process.")
+  @Option(
+    name = "command_wait_time",
+    defaultValue = "0",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help = "The time in ms a command had to wait on a busy Blaze server process."
+  )
   public long waitTime;
 
-  @Option(name = "tool_tag",
-      defaultValue = "",
-      category = "misc",
-      help = "A tool name to attribute this Blaze invocation to.")
+  @Option(
+    name = "tool_tag",
+    defaultValue = "",
+    category = "misc",
+    help = "A tool name to attribute this Blaze invocation to."
+  )
   public String toolTag;
 
-  @Option(name = "restart_reason",
-      defaultValue = "no_restart",
-      category = "hidden",
-      help = "The reason for the server restart.")
+  @Option(
+    name = "restart_reason",
+    defaultValue = "no_restart",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help = "The reason for the server restart."
+  )
   public String restartReason;
 
-  @Option(name = "binary_path",
-      defaultValue = "",
-      category = "hidden",
-      help = "The absolute path of the blaze binary.")
+  @Option(
+    name = "binary_path",
+    defaultValue = "",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help = "The absolute path of the blaze binary."
+  )
   public String binaryPath;
 
-  @Option(name = "experimental_allow_project_files",
-      defaultValue = "false",
-      category = "hidden",
-      help = "Enable processing of +<file> parameters.")
+  @Option(
+    name = "experimental_allow_project_files",
+    defaultValue = "false",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help = "Enable processing of +<file> parameters."
+  )
   public boolean allowProjectFiles;
 
-  @Option(name = "block_for_lock",
-      defaultValue = "true",
-      category = "hidden",
-      help = "If set (the default), a command will block if there is another one running. If "
-          + "unset, these commands will immediately return with an error.")
+  @Option(
+    name = "block_for_lock",
+    defaultValue = "true",
+    optionUsageRestrictions = OptionUsageRestrictions.HIDDEN,
+    help =
+        "If set (the default), a command will block if there is another one running. If "
+            + "unset, these commands will immediately return with an error."
+  )
   public boolean blockForLock;
 
 }