Use of an annotation without @Target meta-annotation on a module declaration

Gavin Bierman gavin.bierman at oracle.com
Thu Nov 21 16:19:08 UTC 2019


I wanted to alert readers of this list to the fact that JEP 359 (Records) will add a new declaration context for annotations, and hence there will be a new enum constant, RECORD_COMPONENT, of java.lang.annotation.ElementType. 

http://cr.openjdk.java.net/~gbierman/jep359/jep359-20191121/specs/records-jls.html

With regards to the recent discussion on this list, I have followed the agreed suggestion:

On 9/19/2019 8:32 PM, Michael Ernst wrote:
> * All contexts.
>    This is the simplest and clearest specification.  It is the most 
> intuitive and easiest to remember, and therefore least likely to lead to 
> problems.  Those qualities make it attractive.
>    It is a behavior change from the current specification, but a small 
> one that affects poorly-written programs that have no @Target 
> meta-annotation.
>    I propose that we adopt this meaning.

In other words, a program with no @Target meta-annotation will be applicable in the new RECORD_COMPONENT context.

Gavin.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20191121/3950f06b/attachment.html>


More information about the compiler-dev mailing list