On Tue, 24 Mar 2026 01:12:25 GMT, Bill Huang <[email protected]> wrote:

> The idea is to implement the **ValueClass** annotation that can be used in 
> test code to allow to run the same tests with and without --enable-preview.
> 
> This annotation should be used to mark value classes.
> 
> The new jtreg test compilation and execution mode that uses javac plugin to 
> process classes during compilation. This plugin change classes with 
> **ValueClass** annotation to value classes.
> By default, the annotation doesn't have any impact on the tests.
> 
> Here are the work items:
> 
> 1. Create ValueClass annotation.
> 2. Create a javac plugin, ValueClassPlugin, that implements a TaskListener to 
> mark a class as a value class during the PARSE phase.
> 3. Build the ValueClass plugin.
> 4. Pass a new plugin option, -Xplugin:ValueClassPlugin, to enable the plugin 
> and enable preview.

Much better now! Thanks for this update.

Looks good in principle but this means we need extra JTREG flags and need to 
update CI configuration; wonder if we can just update our `@build` or `@run` 
directives instead.

Does 'make test TEST=java/util/Collections/AddAll.java' run the value class 
patched version of the test?

Yep, so my concern is this requires special command line, which means CI tweaks 
elsewhere...  If Oracle picks it up, github actions or other test runners may 
not be aware of this still.

test/jdk/java/util/Collections/AddAll.java line 36:

> 34:  * @run main AddAll
> 35:  *
> 36:  * @compile -XDaccessInternalAPI --enable-preview --source 
> ${java.specification.version} -Xplugin:ValueClassPlugin AddAll.java

You might create a separate test scenario like this:

https://github.com/openjdk/valhalla/blob/ef301b763d03e612be7ad34b49b84f39fd7ce287/test/langtools/tools/javap/T4975569.java#L38

You can use another set of directives.

Alternatively I think you can do a `@enablePreview` after the old `@run` to 
make the subsequent run preview-enabled. But having two tests make the result 
looks slightly cleaner that you know it's the preview case that fails just in 
case.

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

PR Review: 
https://git.openjdk.org/valhalla/pull/2253#pullrequestreview-4010758865
PR Comment: https://git.openjdk.org/valhalla/pull/2253#issuecomment-4120556545
PR Comment: https://git.openjdk.org/valhalla/pull/2253#issuecomment-4122652376
PR Comment: https://git.openjdk.org/valhalla/pull/2253#issuecomment-4128482056
PR Review Comment: 
https://git.openjdk.org/valhalla/pull/2253#discussion_r2991856060

Reply via email to