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

Archie Cobbs acobbs at openjdk.org
Fri May 9 15:00:56 UTC 2025


On Fri, 9 May 2025 14:35:38 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:
> 
>   documentation and adding alias to lint categories

I don't understand the point of having two separate `LintCategory`'s `SYNCHRONIZATION` and `IDENTITY`.  That's like having two different humans just so you can call them `Robert` or `Bobby`.

Put another way, are we proposing here to temporarily support compiler configurations like `Xlint:-identity,synchronization` and `Xlint:-synchronization,identity`?
* If not, then there should be a single `LintCategory.IDENTITY` that is addressable through all the usual naming mechanisms (i.e., `@SuppressWarnings`, `-Xlint:foo`) as either `"synchronization"` or `"identity"`. That is `"synchronization"` is just a true alias.
* If so, then we are creating a future backward-incompatibility when we merge `SYNCHRONIZATION` into `IDENTITY`. After that merge, what is `Xlint:-synchronization,identity` or `Xlint:-identity,-synchronization` supposed to mean?

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

PR Comment: https://git.openjdk.org/jdk/pull/24746#issuecomment-2866880798


More information about the core-libs-dev mailing list