On Sat, 8 Aug 2026 05:41:32 GMT, Yasumasa Suenaga <[email protected]> wrote:
> We can see following errors when we run `make test` with > `JTREG="VALUE_CLASS_PLUGIN=true;VM_OPTIONS=--enable-preview"`: > > TestInstanceKlassSize > > stderr: [Exception in thread "main" java.lang.UnsupportedClassVersionError: > Preview features are not enabled for jdk/test/whitebox/WhiteBox (class file > version 72.65535). Try running with '--enable-preview' > at java.base/java.lang.ClassLoader.findBootstrapClass(Native Method) > at java.base/java.lang.ClassLoader.findBootstrapClassOrNull(ClassLoa > der.java:1244) > at java.base/java.lang.System$1.findBootstrapClassOrNull(System.java > :2068) > at java.base/jdk.internal.loader.ClassLoaders$BootClassLoader.loadCl > assOrNull(ClassLoaders.java:138) > at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull( > BuiltinClassLoader.java:639) > at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull( > BuiltinClassLoader.java:615) > at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull( > BuiltinClassLoader.java:639) > at java.base/jdk.internal.loader.BuiltinClassLoader.loadClassOrNull( > BuiltinClassLoader.java:615) > at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Builti > nClassLoader.java:578) > at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:502) > at TestInstanceKlassSize.<clinit>(TestInstanceKlassSize.java:65) > ] > exitValue = 1 > > java.lang.RuntimeException: Expected to get exit value of [0], exit value is > : [1] > at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAna > lyzer.java:602) > at TestInstanceKlassSize.startMeWithArgs(TestInstanceKlassSize.java: > 100) > at TestInstanceKlassSize.main(TestInstanceKlassSize.java:152) > at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke( > DirectMethodHandleAccessor.java:104) > at java.base/java.lang.reflect.Method.invoke(Method.java:583) > at com.sun.javatest.regtest.agent.MainMethodHelper.executeModernMain > Class(MainMethodHelper.java:55) > at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapp > er.java:138) > at java.base/java.lang.Thread.run(Thread.java:1527) > > > TestInstanceKlassSizeForInterface > > stderr: [Exception in thread "main" java.lang.UnsupportedClassVersionError: > Preview features are not enabled for jdk/test/whitebox/WhiteBox (class file > version 72.65535). Try running with '--enable-preview' > at java.base/java.lang.ClassLoader.findBootstrapClass(Native Method) > ... Hi, thank you for addressing these tests! I think there is a better way of solving this problem using the native way of propagating flags to subprocesses, in particular the check for if preview is enabled is raising some red flags for me. The flags passed to `@run main/othervm` are also normally given to the subprocess spawned via `ProcessTools.createTestJavaProcessBuilder` (as opposed to `createLimitedTestJavaProcessBuilder`). Therefore, it should be sufficient to just specify the _additional_ arguments/flags that the subprocess needs that the parent process does not have. In this case, that would be the `--add-modules` and `--add-exports`. What this means is that any additional arguments passed to the test via `JTREG=...`, such as `--enable-preview`, will automatically propagate to the child process and `--enable-preview` does not need to be appended manually. If there is a reason to use `createLimitedTestJavaProcessBuilder` (I am not an expert on svc/sa tests), then `@requires vm.flagless` should be added to the test. Note that `--enable-preview` will treated as flagless for the sake of JTREG. ------------- PR Review: https://git.openjdk.org/jdk/pull/32262#pullrequestreview-4888997122
