JavacTool tool = JavacTool.create();
JavacTask task = tool.getTask(null, fm, null, List.from(args), null, files, context); // no need in this simple case to call task.prepareCompiler(false)
JavaCompiler compiler = JavaCompiler.instance(context);
compiler.compile(files); try {
compiler.compile(files); thrownew Error("Error: AssertionError not thrown after second call of compile");
} catch (AssertionError e) {
System.err.println("Exception from compiler (expected): " + e);
}
}
JavacTool tool = JavacTool.create();
JavacTask task = tool.getTask(null, fm, null, List.from(args), null, files, context); // no need in this simple case to call task.prepareCompiler(false)
JavaCompiler compiler = JavaCompiler.instance(context);
compiler.compile(files); try {
compiler.compile(files); thrownew Error("Error: AssertionError not thrown after second call of compile");
} catch (AssertionError e) {
System.err.println("Exception from compiler (expected): " + e);
}
}
privatestatic List<JavaFileObject> toList(Iterable<? extends JavaFileObject> iter) {
ListBuffer<JavaFileObject> files = new ListBuffer<>(); for (JavaFileObject file: iter)
files.add(file); return files.toList();
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.