RFR: 8367531: Template Framework: use scopes and tokens instead of misbehaving immediate-return-queries [v4]
Emanuel Peter
epeter at openjdk.org
Tue Oct 14 16:28:57 UTC 2025
On Tue, 14 Oct 2025 15:18:23 GMT, Manuel Hässig <mhaessig at openjdk.org> wrote:
>> Emanuel Peter has updated the pull request incrementally with one additional commit since the last revision:
>>
>> fix TestMethodArguments.java after merge with master
>
> test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestTutorial.java line 521:
>
>> 519: // Anchoring a Hook creates a scope, spanning the braces of the
>> 520: // "anchor" call. Any Hook.insert that happens inside this scope
>> 521: // goes to the top of that scope.
>
> This first sentence is a bit strange when we have to write an explicit `scope` since we have to write it. But I do not have a better wording.
Modified it slightly:
531 // We anchor a Hook outside the main method, but inside the Class.
~ 532 // Anchoring a Hook requires the definition of an inner scope,
~ 533 // aka the "anchor scope", spanning the braces of the "anchor" call.
~ 534 // Any Hook.insert that happens inside this scope goes to the top of
~ 535 // that scope.
The new wording sounds less misleading. The old wording kinda suggested that the scope may be created implicitly, but we have to do it explicitly, hence `requires the definition of an inner scope`.
> test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestTutorial.java line 577:
>
>> 575: static { System.out.println("Defining static field $field"); }
>> 576: public static int $field = #value;
>> 577: """
>
> Why do we not just write `public static int $field = 5;`? Is this just for demonstration purposes, or am I missing something more fundamental?
Just for demonstration purposes, yes. I removed it, because it is not that helpful, and seemed to have confused you ;)
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/27255#discussion_r2429770502
PR Review Comment: https://git.openjdk.org/jdk/pull/27255#discussion_r2429774863
More information about the hotspot-compiler-dev
mailing list