aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/common/options/OptionsParser.java
diff options
context:
space:
mode:
authorGravatar brandjon <brandjon@google.com>2017-03-31 20:05:26 +0000
committerGravatar Marcel Hlopko <hlopko@google.com>2017-04-03 13:37:16 +0200
commit94261751bf2babe093696c35208e09768e3fd05e (patch)
tree6ba6ff401e0442d43f611db22b1a9ec84b0983e7 /src/main/java/com/google/devtools/common/options/OptionsParser.java
parentbe5f25ca01d443193a97dae99ff4d1e90311bdaf (diff)
Add --all_incompatible_changes, the user's shorthand for turning on all --incompatible_* flags
Note that if a developer adds a poorly-formatted incompatible change @Option, constructing an OptionsParser will now fail with an unchecked exception. This can cause some unit tests to fail in unexpected ways, but the developer should see an appropriate error message when the server starts up. To be added: A separate integration test that ensures the expansions of --all_incompatible_changes don't clobber each other. RELNOTES: None PiperOrigin-RevId: 151858287
Diffstat (limited to 'src/main/java/com/google/devtools/common/options/OptionsParser.java')
-rw-r--r--src/main/java/com/google/devtools/common/options/OptionsParser.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/common/options/OptionsParser.java b/src/main/java/com/google/devtools/common/options/OptionsParser.java
index 1e475e572c..62f9ee778c 100644
--- a/src/main/java/com/google/devtools/common/options/OptionsParser.java
+++ b/src/main/java/com/google/devtools/common/options/OptionsParser.java
@@ -66,7 +66,10 @@ public class OptionsParser implements OptionsProvider {
* An unchecked exception thrown when there is a problem constructing a parser, e.g. an error
* while validating an {@link Option} field in one of its {@link OptionsBase} subclasses.
*
- * <p>Although unchecked, we explicitly mark some methods as throwing it as a reminder in the API.
+ * <p>This exception is unchecked because it generally indicates an internal error affecting all
+ * invocations of the program. I.e., any such error should be immediately obvious to the
+ * developer. Although unchecked, we explicitly mark some methods as throwing it as a reminder in
+ * the API.
*/
public static class ConstructionException extends RuntimeException {
public ConstructionException(String message) {
@@ -187,7 +190,7 @@ public class OptionsParser implements OptionsProvider {
public void setAllowSingleDashLongOptions(boolean allowSingleDashLongOptions) {
this.impl.setAllowSingleDashLongOptions(allowSingleDashLongOptions);
}
-
+
/** Enables the Parser to handle params files loacted insinde the provided {@link FileSystem}. */
public void enableParamsFileSupport(FileSystem fs) {
this.impl.setArgsPreProcessor(new ParamsFilePreProcessor(fs));
@@ -273,7 +276,7 @@ public class OptionsParser implements OptionsProvider {
return expansions;
}
}
-
+
/**
* The name and value of an option with additional metadata describing its
* priority, source, whether it was set via an implicit dependency, and if so,
@@ -450,9 +453,7 @@ public class OptionsParser implements OptionsProvider {
}
boolean isExpansion() {
- Option option = field.getAnnotation(Option.class);
- return (option.expansion().length > 0
- || OptionsData.usesExpansionFunction(option));
+ return OptionsData.isExpansionOption(field.getAnnotation(Option.class));
}
boolean isImplicitRequirement() {