RFR: 8354556: Expand value-based class warnings to java.lang.ref API [v9]

Chen Liang liach at openjdk.org
Fri May 9 21:09:54 UTC 2025


On Fri, 9 May 2025 20:28:12 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> This PR is defining a new internal annotation, `@jdk.internal.RequiresIdentity`, with target types PARAMETER and TYPE_PARAMETER. The @RequiresIdentity annotation expresses the expectation that an argument to a given method or constructor parameter will be an object with a unique identity, not an instance of a value-based class; or that the type argument to a given type parameter will not be a value-based class type.
>> 
>> For more details please refer to the complete description in the corresponding JIRA entry [1]
>> 
>> TIA
>> 
>> [1] https://bugs.openjdk.org/browse/JDK-8354556
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixing bugs, removing dead code

Note: The tests and the core library changes look good to me.

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java line 428:

> 426:             this.alias = alias;
> 427:             map.put(option, this);
> 428:             // we need to do this as forward references are not allowed

Suggestion:


Redundant comment from last revision.

src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java line 454:

> 452:         public final boolean annotationSuppression;
> 453: 
> 454:         public String alias;

Suggestion:

        public final String alias;

We are no longer storing LintCategory objects.

test/langtools/tools/javac/T8003967/DetectMutableStaticFields.java line 96:

> 94:         ignore("com/sun/tools/javac/file/JRTIndex", "sharedInstance");
> 95:         ignore("com/sun/tools/javac/main/JavaCompiler", "versionRB");
> 96:         ignore("com/sun/tools/javac/code/Lint$LintCategory", "alias");

Can remove this once alias is final

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

PR Comment: https://git.openjdk.org/jdk/pull/24746#issuecomment-2867879980
PR Review Comment: https://git.openjdk.org/jdk/pull/24746#discussion_r2082492124
PR Review Comment: https://git.openjdk.org/jdk/pull/24746#discussion_r2082496953
PR Review Comment: https://git.openjdk.org/jdk/pull/24746#discussion_r2082497326


More information about the compiler-dev mailing list