On Mon, 15 Dec 2025 15:52:56 GMT, Chen Liang <[email protected]> wrote:

>> This change tests the properties: java.test.opts and the property for 
>> test.enable.preview (set when test has @enablePreview), and will pass 
>> --enable-preview -source 26 to the inMemoryJavaCompiler compiler task.  I 
>> don't really like this but the alternative is to do the same thing from all 
>> the tests, and pass this down as parameters.  Better alternative ideas are 
>> welcome.
>> 
>> When the jimage code is checked in, a bunch of tests fail because of this 
>> problem.
>> 
>> Testing with tier1-4.
>
> test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java line 275:
> 
>> 273:                 opts.add("26");
>> 274:             }
>> 275:         }
> 
> if (System.getProperty("test.java.opts", "").contains("--enable-preview")
>         || System.getProperty("test.enable.preview", "").equals("true")) {
>         opts.add("--enable-preview");
>         opts.add("-source");
>         opts.add(Integer.toString(Runtime.version().feature()));
> }
> 
> I recommend using `Runtime.version().feature()` instead of hardcoded version.

Oh okay thank you that's much nicer.

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

PR Review Comment: 
https://git.openjdk.org/valhalla/pull/1797#discussion_r2620059768

Reply via email to