RFR: 8254023: A module declaration is not allowed to be a target of an annotation that lacks an @Target meta-annotation [v2]

Guoxiong Li github.com+13688759+lgxbslgx at openjdk.java.net
Thu Dec 3 08:19:16 UTC 2020


> Hi all,
> 
> The Java Language Specifications(JLS), from 8 to 13 included, state it as below:
> 
>> If an annotation of type java.lang.annotation.Target is not present on the
> declaration of an annotation type T , then T is applicable in all declaration contexts
> except type parameter declarations, and in no type contexts.
> These contexts are the syntactic locations where annotations were allowed in Java SE 7.
> 
> The JLS 14 and 15 state it as below:
> 
>>If an annotation of type java.lang.annotation.Target is not present on the
> declaration of an annotation type T , then T is applicable in all nine declaration
> contexts and in all 16 type contexts.
> 
> This patch adds `names.MODULE, names.TYPE_PARAMETER, names.TYPE_USE` to `com.sun.tools.javac.comp.Check.dfltTargetMeta` to fix this issue.
> Thank you for taking the time to review.
> 
> Best Regards.

Guoxiong Li has updated the pull request incrementally with one additional commit since the last revision:

  Remove TYPE_PARAMETER and TYPE_USE

-------------

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/622/files
  - new: https://git.openjdk.java.net/jdk/pull/622/files/8bb0c5d6..5ff3e252

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=622&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=622&range=00-01

  Stats: 3 lines in 2 files changed: 0 ins; 1 del; 2 mod
  Patch: https://git.openjdk.java.net/jdk/pull/622.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/622/head:pull/622

PR: https://git.openjdk.java.net/jdk/pull/622


More information about the compiler-dev mailing list