On Sun, 12 Jul 2026 21:41:05 GMT, David Holmes <[email protected]> wrote:

>> Chris Plummer has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   fix comment typo
>
> src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java line 58:
> 
>> 56:  *      <div class="preview-comment">
>> 57:  * <h2><a id=valueObjects>Value Objects</a></h2>
>> 58:  * When preview features are enabled, JDI supports value objects and 
>> classes
> 
> This whole paragraph seems excessive when there is nothing special to say 
> about value objects here. You shouldn't have to say that JDI follows JLS and 
> JVMS as that is a given, except where otherwise noted.

It's not a given. JDI does not implement the Java language nor a Java Virtual 
Machine, so it is not beholden to either spec. References to the JLS and JVMS 
(which already exist in the JDI javadoc) are used in places to aid in 
specifying JDI behavior.

> src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java line 62:
> 
>> 60:  * <cite>The Java Virtual Machine Specification</cite>, with one 
>> exception noted
>> 61:  * below. In particular, two value objects are considered to be the same 
>> if both
>> 62:  * refer to statewise-equivalent value objects (x == y has the value 
>> {@code true}).
> 
> Did you mean "two ObjectReferences are considered to be the same if ..." ?

I was referring to debuggee side value objects in this case. ObjectReferences 
are identity objects so two ObjectReferences are only "the same" if they are 
literally the same heap objects, just like with any other identity object. As 
noted below, ObjectReferences are considered to be equal (Object.equals()) if 
"==" of the target VM objects evaluates to true.

> src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java line 72:
> 
>> 70:  * <cite>The Java Virtual Machine Specification</cite>.
>> 71:  * <p>
>> 72:  * Where JDI does differ from the JLS is in allowing the user to obtain 
>> an
> 
> I don't think this conversational style is suitable for this kind of API 
> spec. The spec should just say what happens, not what it differs from. I 
> would phrase more succinctly as:
>> If an ObjectReference is obtained for a value object under construction, 
>> then it is a snapshot of the value object at that point in time. Any further 
>> changes to the initialization state of the value object will not be 
>> reflected in the initial ObjectReference.

Ok. I'll work on this.

> src/jdk.jdi/share/classes/com/sun/jdi/ObjectReference.java line 78:
> 
>> 76:  * behavior for the JDI user. In particular, the value object may change 
>> after
>> 77:  * the ObjectReference is obtained, even though value objects are 
>> considered
>> 78:  * to be immutable. Because of this, if 'this' is fetched from a value 
>> object
> 
> Suggestion:
> 
>  * to be immutable. Consequently, if 'this' is fetched from a value object

I assume this edit is no longer relevant after your earlier suggested rewrite 
of this section.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2639#discussion_r3567494117
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2639#discussion_r3567505283
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2639#discussion_r3567509089
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2639#discussion_r3567511267

Reply via email to