use of com.sun.tools.javac.main.RecognizedOptions.GrumpyHelper in project ceylon-compiler by ceylon.
the class JavacTool method processOptions.
public static void processOptions(Context context, JavaFileManager fileManager, Iterable<String> options) {
if (options == null)
return;
Options optionTable = Options.instance(context);
JavacOption[] recognizedOptions = RecognizedOptions.getJavacToolOptions(new GrumpyHelper());
Iterator<String> flags = options.iterator();
while (flags.hasNext()) {
String flag = flags.next();
int j;
for (j = 0; j < recognizedOptions.length; j++) if (recognizedOptions[j].matches(flag))
break;
if (j == recognizedOptions.length) {
if (fileManager.handleOption(flag, flags)) {
continue;
} else {
String msg = Main.getLocalizedString("err.invalid.flag", flag);
throw new IllegalArgumentException(msg);
}
}
JavacOption option = recognizedOptions[j];
if (option.hasArg()) {
if (!flags.hasNext()) {
String msg = Main.getLocalizedString("err.req.arg", flag);
throw new IllegalArgumentException(msg);
}
String operand = flags.next();
if (option.process(optionTable, flag, operand))
// in case of errors
throw new IllegalArgumentException(flag + " " + operand);
} else {
if (option.process(optionTable, flag))
// in case of errors
throw new IllegalArgumentException(flag);
}
}
}
Aggregations