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)
> ...

Marked as reviewed by cjplummer (Reviewer).

I think your fix is correct, but there is still the question of why this does 
not impact other tests that use `createLimitedTestJavaProcessBuilder`. The only 
difference I could find that might explain it is that this test uses "@build 
jdk.test.whitebox.WhiteBox". It looks like WhiteBox.class is marked as 
preview-dependent, probably because it is referencing a class that uses preview 
features even though WhiteBox itself is not using preview features. So likely 
the `@build` part of this is not relevant. It's only relevant that the the test 
needs the class and the class is marked preview-dependent.

There is risk that a more commonly used JDK class could in the future get 
marked as preview-dependent, causing more tests that use 
`createLimitedTestJavaProcess` to start failing in the same way, so this is an 
argument for moving this to `createLimitedTestJavaProcess`. However, I'm fine 
for now with the just being done for these two tests, and we can address moving 
it to `createLimitedTestJavaProcess` with another CR.

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

PR Review: https://git.openjdk.org/jdk/pull/32262#pullrequestreview-4908338247
PR Comment: https://git.openjdk.org/jdk/pull/32262#issuecomment-5255719235

Reply via email to