On Mon, 27 Jul 2026 15:06:03 GMT, Chen Liang <[email protected]> wrote:

> The warnings for value-based classes does not mention the use of VBC 
> instances in Reference objects. We are adding warnings for failures in JEP 
> 401 integration; and it's beneficial for us to add something in 27 before JEP 
> 401 lands in 28.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

src/java.base/share/classes/java/lang/doc-files/ValueBased.html line 69:

> 67: 
> 68: <p>Use of instances of value-based classes in {@linkplain
> 69:     java.lang.ref.Reference reference objects} is strongly discouraged,

The use of "in" reference objects is a bit vague, java.lang.ref.Reference can 
be subclassed and this might be interpreted as using a value class as a field 
in the subclass, that would be an ok use.

It would be clearer to be more direct and say java.lang.ref.Reference instances 
can not refer to value class instances.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/32055#discussion_r3660377190

Reply via email to