Interaction between @Target meta-annotations and fully-qualified types

Alex Buckley alex.buckley at oracle.com
Mon Apr 22 13:55:06 PDT 2013


On 4/22/2013 1:50 PM, Michael Ernst wrote:
>> I note that a method whose result is 'void' (and hence has no return
>> type)
>> cannot allow a solely-TYPE_USE annotation where a METHOD annotation
>> previously stood.
>
> Right.  This example already appeared in the specification, so it's not
> a change nor even a clarification.  As we have previously discussed, you
> would never expect to change (say) a METHOD annotation to a FIELD
> annotation and write it in the same places, so we wouldn't expect to
> make other @Target changes either.
>
>> This is an argument against partitioning type annotations
>> and declaration annotations.
>
> I don't see this argument.  The spec notes that it is bad style to have
> a single annotation that is both a type annotation and a declaration
> annotation.

I mean in terms of making it an error if an annotation type targets both 
TYPE_USE and a declaration location. We agree such an annotation type is 
unusual and temporary (which in Java time means "about five years") but 
we also agree it should be legal.

Alex


More information about the type-annotations-spec-experts mailing list