Re: [jdk17] RFR: 8270916: Update java.lang.annotation.Target for changes in JLS 9.6.4.1

2021-08-20 Thread Guoxiong Li
On Thu, 22 Jul 2021 19:38:07 GMT, Joe Darcy  wrote:

>> Given changes in JLS 9.6.4.1, JDK-8261610 in Java SE 17, the statements 
>> about annotation applicability made in java.lang.annotation.Target need to 
>> be updated to match.
>> 
>> Please also review the corresponding CSR: 
>> https://bugs.openjdk.java.net/browse/JDK-8270917
>
> CSR now approved.

Hi @jddarcy,

Sorry for the delay.

I notice the current javac code(shown below) doesn't meet the JLS 9.6.4.1 .
The code doesn't mark `TYPE_PARAMETER` as the default target.
Because the PR https://github.com/openjdk/jdk/pull/622 and 
https://github.com/openjdk/jdk/pull/2412 , which tried to fix this problem, is 
earlier than the 
[JDK-8261610](https://bugs.openjdk.java.net/browse/JDK-8261610), 
[JDK-8270916](https://bugs.openjdk.java.net/browse/JDK-8270916), and 
[JDK-8270917](https://bugs.openjdk.java.net/browse/JDK-8270917).

According to the new JLS 9.6.4.1, the javac compiler should be adjusted to add 
`TYPE_PARAMETER` as the default target.
Should we fix the compiler issue in JDK17? But it seems too late to do that.
Maybe JDK18 is a good place. What do you think about it? Any ideas are 
appreciated.


// com.sun.tools.javac.comp.Check.java
private Name[] dfltTargetMeta;
private Name[] defaultTargetMetaInfo() {
if (dfltTargetMeta == null) {
ArrayList defaultTargets = new ArrayList<>();
defaultTargets.add(names.PACKAGE);
defaultTargets.add(names.TYPE);
defaultTargets.add(names.FIELD);
defaultTargets.add(names.METHOD);
defaultTargets.add(names.CONSTRUCTOR);
defaultTargets.add(names.ANNOTATION_TYPE);
defaultTargets.add(names.LOCAL_VARIABLE);
defaultTargets.add(names.PARAMETER);
if (allowRecords) {
  defaultTargets.add(names.RECORD_COMPONENT);
}
if (allowModules) {
  defaultTargets.add(names.MODULE);
}
dfltTargetMeta = defaultTargets.toArray(new Name[0]);
}
return dfltTargetMeta;
}


Best Regards,
-- Guoxiong

-

PR: https://git.openjdk.java.net/jdk17/pull/256


Re: [jdk17] RFR: 8270916: Update java.lang.annotation.Target for changes in JLS 9.6.4.1

2021-07-22 Thread Naoto Sato
On Mon, 19 Jul 2021 21:18:42 GMT, Joe Darcy  wrote:

> Given changes in JLS 9.6.4.1, JDK-8261610 in Java SE 17, the statements about 
> annotation applicability made in java.lang.annotation.Target need to be 
> updated to match.
> 
> Please also review the corresponding CSR: 
> https://bugs.openjdk.java.net/browse/JDK-8270917

Marked as reviewed by naoto (Reviewer).

-

PR: https://git.openjdk.java.net/jdk17/pull/256


Re: [jdk17] RFR: 8270916: Update java.lang.annotation.Target for changes in JLS 9.6.4.1

2021-07-22 Thread Brian Burkhalter
On Mon, 19 Jul 2021 21:18:42 GMT, Joe Darcy  wrote:

> Given changes in JLS 9.6.4.1, JDK-8261610 in Java SE 17, the statements about 
> annotation applicability made in java.lang.annotation.Target need to be 
> updated to match.
> 
> Please also review the corresponding CSR: 
> https://bugs.openjdk.java.net/browse/JDK-8270917

Marked as reviewed by bpb (Reviewer).

-

PR: https://git.openjdk.java.net/jdk17/pull/256


Re: [jdk17] RFR: 8270916: Update java.lang.annotation.Target for changes in JLS 9.6.4.1

2021-07-22 Thread Joe Darcy
On Mon, 19 Jul 2021 21:18:42 GMT, Joe Darcy  wrote:

> Given changes in JLS 9.6.4.1, JDK-8261610 in Java SE 17, the statements about 
> annotation applicability made in java.lang.annotation.Target need to be 
> updated to match.
> 
> Please also review the corresponding CSR: 
> https://bugs.openjdk.java.net/browse/JDK-8270917

CSR now approved.

-

PR: https://git.openjdk.java.net/jdk17/pull/256