RFR: 8344942: Template-Based Testing Framework [v61]

Emanuel Peter epeter at openjdk.org
Sun Jun 1 05:45:08 UTC 2025


On Sun, 1 Jun 2025 05:41:29 GMT, Emanuel Peter <epeter at openjdk.org> wrote:

>> test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestTutorial.java line 258:
>> 
>>> 256: 
>>> 257:         // Render templateClass to String.
>>> 258:         return templateClass.render();
>> 
>> When printing this, it starts at `var_2` and not `var_1`. Why is that?
>
> The `nextTemplateFrameId` starts at zero, and is incremented for every Template instantiation.
> The `templateClass` has `nextTemplateFrameId=1`. If there was any use of `$`, it would append `_1`.
> For `template1.asToken(1)` we have  `nextTemplateFrameId=2` -> produces the `var_2`.
> Generally, the API does not make any guarantees about what id we give, it is just unique.
> 
> Is that ok for you?

Ah, I guess the comment above talks about `var_1, var_2 ...` hmm. I suppose I can add another comment for that in the test code.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24217#discussion_r2118752394


More information about the hotspot-compiler-dev mailing list