On Mon, 16 Nov 2026 15:16:42 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 19 additional 
> commits since the last revision:
> 
>  - Address review comments with test
>  - Merge branch 'master' into WatchedField
>  - 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
>  - ... and 9 more: https://git.openjdk.org/jdk/compare/347043bc...cf298eb4

src/jdk.jdi/share/classes/com/sun/jdi/event/AccessWatchpointEvent.java line 41:

> 39:  * declaring the field is being initialized by the event thread and the 
> class
> 40:  * declares strictly-initialized static fields.
> 41:  * <p>

The JVMTI spec makes is clear that this applies when then object is in slot 0:

"...and slot 0 of the local variable array contains a reference to the object 
containing the watched field."

We are missing that here, and instead refer to the object being constructed, 
which might not in slot 0.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/33841#discussion_r4590609612

Reply via email to