On Tue, 1 Sep 2026 20:15:36 GMT, Alan Bateman <[email protected]> wrote:

>> Update JVMTI ForceEarlyReturnVoid, and the equivalent JDWP command and JDI 
>> method, to specify that the operation fails if the target thread's top frame 
>> is a constructor or the class initializer of a class with 
>> strictly-initialized fields.
>> 
>> Several options have been explored for both constructors and class 
>> initializers,  the details are attached to the JBS issue.
>> 
>> The changes are very simple.  ClassFileParser::parse_fields records if the 
>> class has class has strict instance fields, as it does already for strict 
>> static fields. JvmtiEnvBase::check_top_frame is changed to check if the top 
>> frame is a constructor of a class with strict instance fields in the class 
>> hierarchy or the initializer of a class with strict static fields. This 
>> replaces the check if the top frame is a value class constructor, the 
>> interim solution for the initial JEP 539 integration.
>> 
>> In jvmti.xml, the custom XML element `externallink` is updated to support 
>> the `sup` element so a "PREVIEW" superscript can decorate links to preview 
>> APIs.
>> 
>> Test ForceEarlyReturnStrictInitFields is added to test ForceEarlyReturnVoid 
>> when the target thread's top frame is the constructor, method, or class 
>> initializer of a a class with strictly-initialized fields.
>> 
>> Testing: tier 1-5
>> 
>> ---------
>> - [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 incrementally with one additional 
> commit since the last revision:
> 
>   Change sentence with examples to use either-to construct

This looks good. I've asked one question though.

src/hotspot/share/prims/jvmti.xml line 3417:

> 3415:         Value classes<sup>PREVIEW</sup></externallink> rely upon strict 
> field
> 3416:         initialization. This function can not be used to return from a 
> constructor
> 3417:         of a value class with one or more instance fields.

Q: Why the API Note is saying about constructors only but nothing about class 
initializers?

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

Marked as reviewed by sspitsyn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/32198#pullrequestreview-5086374082
PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3911384348

Reply via email to