8072988: Update javax.annotation.processing for modules

Jan Lahoda jan.lahoda at oracle.com
Mon Jul 18 18:34:28 UTC 2016


Hi,

I'd like to discuss enhacements to the Annotation Processing API for 
modules. My current sketch is here (against jigsaw/jake):
http://cr.openjdk.java.net/~jlahoda/8072988/webrev.00/

This patch augments Filer methods with variants that take a "module" 
parameter, allowing to generate classes/resources to a particular module 
when javac is compiling multiple modules. The existing variants of the 
methods try to infer the target module from the given package and 
originating elements (see JavacFiler.checkOrInferModule).

This patch should also include module-infos in 
RoundEnvironment.getRootElements.

This patch does not allow creating new module-infos. My question is if 
that should be supported, and how that should work. There are several 
possible scenarios which we could possibly support:
-creating the module-info while compiling for the unnamed module, 
converting the compilation to a module (single-module) compilation

-creating the module-info while in multi-module mode (possibly compiling 
multiple modules at once), for a directory that exists on the 
modulesourcepath, possibly containing some source files, but no 
module-info.java. The tricky part is how to work with the sources until 
the module-info.java.

-creating whole modules from scratch in multi-module mode (i.e. no part 
of the module would exist, and would be completely created by the 
annotation processor). Could be tricky with incremental compilation.

Any comments on these or on the patch above would be wholeheartedly welcome.

Thanks,
    Jan


More information about the jigsaw-dev mailing list