On Sun, 15 Nov 2026 08:31:08 GMT, Alan Bateman <[email protected]> wrote:

>> As discussed with Sergeui, Chris and Fred: Update JVMTI to not send field 
>> access and modification events during construction of objects with 
>> strictly-initialized instance fields and initialization of classes with 
>> strictly-initialized static fields. The JVMTI, JDWP and JDI API docs are 
>> updated to specify the behavior.
>> 
>> A new test is added to exercise strict instance and static fields, 
>> constructor chaining, inheritance, value classes, and record classes.
>> 
>> The jdwpgen tool is updated to add anchors to the  the event descriptions in 
>> the JDWP spec to allow linking.
>> 
>> Testing: tier1-3.  
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> Alan Bateman has updated the pull request with a new target base due to a 
> merge or a rebase. The incremental webrev excludes the unrelated changes 
> brought in by the merge/rebase. The pull request contains 17 additional 
> commits since the last revision:
> 
>  - Drop: Constructor invocations in caller frames are not considered.
>  - Update comment
>  - Ignore this-escape
>  - Merge branch 'master' into WatchedField
>  - Add @bug to test
>  - Merge branch 'master' into WatchedField
>  - Improve wording, drop some commas
>  - Spec/docs improvements
>  - Merge branch 'master' into WatchedField
>  - Add fast path
>  - ... and 7 more: https://git.openjdk.org/jdk/compare/f63efb37...10f1e57f

This looks really good. I've posted a couple of questions on the test though.

test/hotspot/jtreg/serviceability/jvmti/WatchedField/WatchStrictInitFields.java 
line 242:

> 240:                 y = v4;                // modification event not sent
> 241:                 assertEquals(v3, x);   // access event
> 242:                 assertEquals(v4, y);   // access event

Q: Should the comments at lines 241-242 say: "// access event not sent"?

test/hotspot/jtreg/serviceability/jvmti/WatchedField/WatchStrictInitFields.java 
line 561:

> 559:                 obj.x(300);
> 560:                 assertEquals(5, modCount());       // putfield Box.value 
> && obj.x
> 561:                 assertEquals(4, accessCount());    // getfield Box.value 
> && obj.x

Q: Is the comment at line 561 correct? Do we need to drop the part with ` && 
obj.x`?

test/hotspot/jtreg/serviceability/jvmti/WatchedField/WatchStrictInitFields.java 
line 879:

> 877: 
> 878:     Watch watch(Class<?> clazz, String fieldName) {
> 879:         long fieldID = fieldID(clazz, fieldName);

Q: Can the `fieldID` be requested with the `fieldID()` when the class has not 
been prepared yet, e.g. when the method `watch()` is called at line 851?

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

PR Review: https://git.openjdk.org/jdk/pull/33841#pullrequestreview-5919218939
PR Review Comment: https://git.openjdk.org/jdk/pull/33841#discussion_r4585133812
PR Review Comment: https://git.openjdk.org/jdk/pull/33841#discussion_r4585166573
PR Review Comment: https://git.openjdk.org/jdk/pull/33841#discussion_r4585278703

Reply via email to