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

Emanuel Peter epeter at openjdk.org
Wed May 7 12:26:27 UTC 2025


On Wed, 7 May 2025 11:31:45 GMT, Christian Hagedorn <chagedorn at openjdk.org> wrote:

>> Emanuel Peter has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 16 commits:
>> 
>>  - Merge branch 'master' into JDK-8344942-TemplateFramework-v3
>>  - Whitespace
>>  - Suggestions by Christian
>>    
>>    Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
>>  - typo
>>  - For Christian: example and more intro
>>  - fix hashtag
>>  - manual merge
>>  - Apply suggestions from code review
>>    
>>    Co-authored-by: Christian Hagedorn <christian.hagedorn at oracle.com>
>>  - move library
>>  - Merge branch 'master' into JDK-8344942-TemplateFramework-v3
>>  - ... and 6 more: https://git.openjdk.org/jdk/compare/0844745e...fae7ced6
>
> test/hotspot/jtreg/compiler/lib/template_framework/Template.java line 179:
> 
>> 177:  * current code scope with {@link #addName}, and sample from the current or outer scopes with {@link #sampleName}.
>> 178:  * When generating code, one might want to create {@link Name}s (variables, fields, etc) in local scope, or
>> 179:  * in some outer scope with the use of {@link Hook}s.
> 
> Maybe mention here again that all of the explained above can be found in tutorial like examples (I guess in `TestTutorial`)?. Because it was not that easy to grasp how these different options to create Templates now work in practice.

Ok, fair. This is just a high level explanation. Especially Hooks and Names are also not the "starter features", I think. So it's ok if you have to go look at the examples or other uses, I think.

> test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestTutorial.java line 98:
> 
>> 96:                     System.out.println("Hello World!");
>> 97:             """,
>> 98:             "int a = ", Integer.valueOf(1), ";\n",
> 
> Might be better to use `System.lineSeparator()` instead of `\n` to be platform independent.

Hmm. You may be right. But then again, this also worked on Windows... what platform would it even fail on?

> test/hotspot/jtreg/testlibrary_tests/template_framework/examples/TestTutorial.java line 102:
> 
>> 100:             // Special Float values are "smartly" formatted!
>> 101:             "float nan = ", Float.valueOf(Float.POSITIVE_INFINITY), ";\n",
>> 102:             "boolean c = ", Boolean.valueOf(true), ";\n",
> 
> Are these explicit calls to `valueOf()` necessary? Aren't these auto-boxed?

Removed the boxing, good idea!

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24217#discussion_r2077497848
PR Review Comment: https://git.openjdk.org/jdk/pull/24217#discussion_r2077501215
PR Review Comment: https://git.openjdk.org/jdk/pull/24217#discussion_r2077500191


More information about the hotspot-compiler-dev mailing list