On Mon, 15 Jun 2026 18:51:40 GMT, Chen Liang <[email protected]> wrote:

>> src/java.base/share/classes/java/lang/Boolean.java line 58:
>> 
>>> 56:  *          Use of value class instances for synchronization, mutexes, 
>>> or with
>>> 57:  *          {@linkplain java.lang.ref.Reference object references} 
>>> result in
>>> 58:  *          {@link IdentityException}.
>> 
>> Should we specify the behaviour of value classes, for example when it comes 
>> to synchronization, at one single place and if necessary just link to that 
>> place instead of repeating this detail in all of the value class' javadocs? 
>> Perhaps the javadoc of `Class.isValue()` is a good place to specify this 
>> detail?
>> 
>> If it takes a lot of rework to remove the duplicated text, then perhaps it 
>> could be done as a post integration cleanup?
>
> I think we have such repeated details following the guides set by ValueBased 
> annotation. And I think this simply shares some problematic uses without 
> specifying too many details.

> Should we specify the behaviour of value classes, for example when it comes 
> to synchronization, at one single place and if necessary just link to that 
> place instead of repeating this detail in all of the value class' javadocs?

During discussions it was decided that the current way of literally repeating 
these details of value classes at individuals use sites would be better to 
attract attention to these semantics when value objects is in preview. So the 
current state in this PR is fine.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3557995463

Reply via email to