aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/common/options/OptionsParser.java
diff options
context:
space:
mode:
authorGravatar ccalvarin <ccalvarin@google.com>2017-04-04 18:31:27 +0000
committerGravatar Damien Martin-Guillerez <dmarting@google.com>2017-04-05 15:18:37 +0200
commit0e02f53599487ef44188cfad3c0115261d7cc993 (patch)
tree3c34828d415d5e512e432c3203f3c598a6e50d8e /src/main/java/com/google/devtools/common/options/OptionsParser.java
parent9dcfa4364c349c4dbf01a555f0cb77af15e5984e (diff)
Clean up clearValue and parsed option storage.
Now that policy expands itself before being applied, clearValues never has to clear more than a single value. This makes that more clear. OptionValueDescription had not been consistently storing the snake_case name for an option, leading to some weird behavior when removing the map of return values from clearValues. PiperOrigin-RevId: 152156746
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.java10
1 files changed, 4 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 62f9ee778c..eaa1e81065 100644
--- a/src/main/java/com/google/devtools/common/options/OptionsParser.java
+++ b/src/main/java/com/google/devtools/common/options/OptionsParser.java
@@ -725,8 +725,7 @@ public class OptionsParser implements OptionsProvider {
}
/**
- * Clears the given option. Also clears expansion arguments and implicit requirements for that
- * option.
+ * Clears the given option.
*
* <p>This will not affect options objects that have already been retrieved from this parser
* through {@link #getOptions(Class)}.
@@ -735,11 +734,10 @@ public class OptionsParser implements OptionsProvider {
* @return A map of an option name to the old value of the options that were cleared.
* @throws IllegalArgumentException If the flag does not exist.
*/
- public Map<String, OptionValueDescription> clearValue(String optionName)
+ public OptionValueDescription clearValue(String optionName)
throws OptionsParsingException {
- Map<String, OptionValueDescription> clearedValues = Maps.newHashMap();
- impl.clearValue(optionName, clearedValues);
- return clearedValues;
+ OptionValueDescription clearedValue = impl.clearValue(optionName);
+ return clearedValue;
}
@Override