I'm writing custom AnnotationProcessor and need to access options which was set to javac during execution: eg -verbose, -s, -d
What is the correct way to do this. I don't think that parsing "sun.java.command" system property or accessing com.sun.tools.javac.util.Options are good way to do this.
Thanks a lot.
PS: May be something like this for -s option:
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
Iterable<? extends File> locations = fm.getLocation(StandardLocation.SOURCE_OUTPUT);
There is no public API to do this. The effect of the "-s" and "-d" options should be reflected in the Filer's behavior and not something a processor needs to directly examine.
Processor-specific options can be passed use "-Afoo=bar", which can be queried from the getOptions method.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.