RFR: 8254023: A module declaration is not allowed to be a target of an annotation that lacks an @Target meta-annotation
github.com+13688759+lgxbslgx at openjdk.java.net
Tue Oct 20 05:41:11 UTC 2020
On Mon, 19 Oct 2020 11:07:30 GMT, Joel Borggrén-Franck <jfranck at openjdk.org> wrote:
>> 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.
> Thank you for the contribution.
> As you can see from the @Target javadoc (
> https://docs.oracle.com/en/java/javase/15/docs/api/java.base/java/lang/annotation/Target.html ) there is some ambiguity
> here. I have rased a separate discussion on compiler-dev, depending on the outcome of that discussion this patch will
> need to be revised.
Thanks for focusing on this patch. I will continue to follow the discussion and revise my patch based on the outcome of
More information about the compiler-dev