< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileManager.java
Print this page
@@ -230,11 +230,11 @@
@Override @DefinedBy(Api.COMPILER)
public boolean handleOption(String current, Iterator<String> remaining) {
OptionHelper helper = new GrumpyHelper(log) {
@Override
public String get(Option option) {
- return options.get(option.getText());
+ return options.get(option);
}
@Override
public void put(String name, String value) {
options.put(name, value);
@@ -249,39 +249,28 @@
public boolean handleFileManagerOption(Option option, String value) {
return handleOption(option, value);
}
};
- for (Option o: javacFileManagerOptions) {
- if (o.matches(current)) {
- if (o.hasArg()) {
- if (remaining.hasNext()) {
- if (!o.process(helper, current, remaining.next()))
- return true;
- }
- } else {
- if (!o.process(helper, current))
- return true;
+ Option o = Option.lookup(current, javacFileManagerOptions);
+ if (o == null) {
+ return false;
}
- // operand missing, or process returned true
+
+ if (!o.handleOption(helper, current, remaining))
throw new IllegalArgumentException(current);
- }
- }
- return false;
+ return true;
}
// where
private static final Set<Option> javacFileManagerOptions =
Option.getJavacFileManagerOptions();
@Override @DefinedBy(Api.COMPILER)
public int isSupportedOption(String option) {
- for (Option o : javacFileManagerOptions) {
- if (o.matches(option))
- return o.hasArg() ? 1 : 0;
- }
- return -1;
+ Option o = Option.lookup(option, javacFileManagerOptions);
+ return (o == null) ? -1 : o.hasArg() ? 1 : 0;
}
protected String multiReleaseValue;
/**
@@ -314,11 +303,11 @@
boolean ok = true;
for (Map.Entry<Option, String> e: map.entrySet()) {
try {
ok = ok & handleOption(e.getKey(), e.getValue());
} catch (IllegalArgumentException ex) {
- log.error(Errors.IllegalArgumentForOption(e.getKey().getText(), ex.getMessage()));
+ log.error(Errors.IllegalArgumentForOption(e.getKey().getPrimaryName(), ex.getMessage()));
ok = false;
}
}
return ok;
}
< prev index next >