On Tue, 24 Mar 2026 18:38:51 GMT, Chen Liang <[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. > > 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. @liach Could you please elaborate your suggestions? The goal of this task is to run tests with and without enable-preview. The annotation is the indirection that lets the same source file be valid Java in both modes. Without it (or something equivalent), there's no way to write a single source file that compiles cleanly on a normal build and becomes a value class when compiled with the plugin under preview. > Does 'make test TEST=java/util/Collections/AddAll.java' run the value class > patched version of the test? @liach `make test TEST=jdk/java/util/Collections/AddAll.java` runs in normal mode. It needs the VALUE_CLASS_PLUGIN option to enable ValueClassPlugin and preview feature: `make test TEST=jdk/java/util/Collections/AddAll.java JTREG=VALUE_CLASS_PLUGIN=true` > 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. @liach Please review the latest commit, which removes the VALUE_CLASS_PLUGIN flag and adds a test instance with ValueClassPlugin and preview features enabled. ------------- PR Comment: https://git.openjdk.org/valhalla/pull/2253#issuecomment-4122608844 PR Comment: https://git.openjdk.org/valhalla/pull/2253#issuecomment-4128295018 PR Comment: https://git.openjdk.org/valhalla/pull/2253#issuecomment-4130316736
