Scopes in the Jigsaw module system
Alex Buckley
alex.buckley at oracle.com
Mon Aug 20 10:39:25 PDT 2012
On 8/17/2012 11:05 PM, Jaroslav Tulach wrote:
> If I interpret it correctly, you suggest to package the processor into
> independent module, separated from the module hosting the annotation. Good,
> that is how it should be!
Agreed. Caveat: the Jigsaw team hasn't discussed annotation processors
much, so people shouldn't assume much about how other use cases will be
handled.
> However how do we guarantee that a source only annotation is properly
> processed whenever somebody compiles against the API?
>
> Imagine that java.beans module provides @GenerateBeanInfo annotation to be
> placed on any JavaBean class and generate appropriate BeanInfo class
> automatically rather than requiring it to be code manually. If I correctly
> understood, the associated GenerateBeanInfoProcessor should be placed in a
> separate java.beans.processor module. How will the javac know that whenever
> somebody uses @GenerateBeanInfo annotation in own code the
> java.beans.processor module must be consulted during compilation?
Good question. Again, the Jigsaw team hasn't discussed how to identify,
package, or execute annotation processors yet. JSR 269 defines the
environment that an annotation processor can see (e.g.
ProcessingEnvironment, Filer) but the identification and execution of
annotation processors is not standardized. How much can easily be
standardized in a module system is an open question.
Alex
More information about the jigsaw-dev
mailing list