On Tue, 4 Aug 2026 15:03:27 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). Changes requested by cjplummer (Reviewer). src/hotspot/share/prims/jvmti.xml line 3437: > 3435: are enabled, the current frame is a constructor of a class > with > 3436: strictly-initialized instance fields in its class hierarchy > or the class > 3437: initializer of a class with strictly-initialized static > fields.) This is all one sentence and hard to read. It's ambiguous what the "or" in "or the class" is actually connected to. It could be "a constructor", "instance fields", or "class hierarchy". src/hotspot/share/prims/jvmtiEnvBase.cpp line 2180: > 2178: if (tos == vtos) { > 2179: Method* method = jvf->method(); > 2180: if ((method->is_class_initializer() && > method->method_holder()->has_strict_static_fields()) || Does `has_strict_static_fields()` inherit from superclasses and interfaces? src/java.se/share/data/jdwp/jdwp.spec line 2175: > 2173: "strictly-initialized instance > fields in its class " > 2174: "hierarchy or the class > initializer of a class with " > 2175: "strictly-initialized static > fields).") It's hard to put together what the last "or" is applying to, especially since "current frame" is mentioned separately for the first item, and then "current frame" is mentioned again with the intent to apply it to both the 2nd and 3rd items, but it is hard to read it that way. I think something of the form "when the current frame is X, is Y, or is Z" is easier to read. ------------- PR Review: https://git.openjdk.org/jdk/pull/32198#pullrequestreview-5081025589 PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3906621775 PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3906875810 PR Review Comment: https://git.openjdk.org/jdk/pull/32198#discussion_r3906812233
