On Wed, 1 Jul 2026 09:12:33 GMT, Alan Bateman <[email protected]> wrote:

>> JVMTI ForceEarlyReturnVoid can be used to return early from a constructor or 
>> class initializer. Early return from a constructor with strictly-initialized 
>> instance fields is problematic, as is early return from a class initializer 
>> when there are strictly-initialized static fields. The proposal for the 
>> initial integration is to keep it simple and just disallow 
>> ForceEarlyReturnVoid to return early from a value class constructor.
>> 
>> ---------
>> - [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 five additional 
> commits since the last revision:
> 
>  - Improve test, quality docs update to be for when preview features are 
> enabled
>  - Merge branch 'lworld' into ForceEarlyReturn
>  - Improve docs change
>  - Test cleanup
>  - Initial commit

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

> 3382:         a return type of <code>void</code>. A class initializer is a 
> special
> 3383:         method named named <code>&lt;clinit&gt;</code> with a return 
> type of
> 3384:         <code>void</code>.

I'm not sure of the purpose of calling out what constructors and class 
initializers are.

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

> 3403:           The implementation is unable to force the current frame to 
> return
> 3404:           (e.g. current frame is executing a native method or the 
> current frame is the
> 3405:           constructor for a value class)

I think you still need to mention "when preview mode is enabled" here. I know 
you already did in the description, but seems to me it should be repeated here.

src/java.se/share/data/jdwp/jdwp.spec line 2156:

> 2154:             (Error OPAQUE_FRAME      "Unable to force the current frame 
> to return "
> 2155:                                      "(e.g. the current frame is 
> executing a native method or "
> 2156:                                      "the current frame is the 
> constructor for a value class).")

Mention "when in preview mode" here also? Also, what about JDI 
ObjectReference.forceEarlyReturn()?

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2604#discussion_r3508141781
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2604#discussion_r3508149624
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2604#discussion_r3508156137

Reply via email to