Modular annotation processor registration was: Scopes in the Jigsaw module system
Jonathan Gibbons
jonathan.gibbons at oracle.com
Mon Aug 20 15:46:41 PDT 2012
On 08/20/2012 03:37 PM, Alex Buckley wrote:
> On 8/20/2012 3:26 PM, Jaroslav Tulach wrote:
>> If we want to have processors separated from annotations, then we
>> also need a
>> link from the annotation to its processor. I guess a meta-annotation
>> like:
>>
>> @Target(ElementType.ANNOTATION_TYPE)
>> @Retention(RetentionType.CLASS)
>> @interface WhichModuleProvidesMyProcessor {
>> String value();
>> }
>>
>> which I could use to define my source annotation
>>
>> @Retention(SOURCE)
>> @WhichModuleProvidesMyProcessor("my.processor.module at 2.7")
>> @interface MyAnnotation {
>> }
>>
>> would be enough for javac to know that it has to find and turn on
>> my.processor.module in order to compile sources refering to
>> MyAnnotation. If
>> the module my.processor.module at 2.7 is not found, the compilation
>> fails with
>> error.
>>
>> Just my 2Kč to discussion about annotation processors (when you get
>> to it).
>> -jt
>
> Thanks. While "annotation processing dependencies" are an interesting
> special case, we should stick to the common case of module
> dependencies for now.
>
> I'll just note that binding an annotation type to a processor only
> works when there's an annotation type involved - in general, you can
> write processors which have no interest in annotations whatsoever.
>
> Alex
Jaroslav,
... and you are assuming that there is a single processor to be used to
process any particular annotation, which may not be the case, and that
such a processor should be specified in the source file.
-- Jon
More information about the jigsaw-dev
mailing list