[lworld] Enabling jimage changes break tests with inMemoryJavaCompiler

XMLWordPrintable

    • Type: Enhancement
    • Resolution: Unresolved
    • Priority: P4
    • repo-valhalla
    • Affects Version/s: None
    • Component/s: hotspot
    • None

      The InMemoryJavaCompiler test library doesn't pass --enable-preview to the compilation line. This isn't a problem unless jimage is used with --enable-preview instead of --patch-module.
      Then we get this failure.

      error: class file for /modules/java.base/java/lang/Byte.class uses preview features of Java SE 26.
        (use --enable-preview to allow loading of class files which contain preview features)
      1 error
      java.lang.ExceptionInInitializerError
              at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
              at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1397)
              at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:341)
              at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newMethodAccessor(MethodHandleAccessorFactory.java:72)
              at java.base/jdk.internal.reflect.ReflectionFactory.newMethodAccessor(ReflectionFactory.java:119)
              at java.base/java.lang.reflect.Method.acquireMethodAccessor(Method.java:711)
              at java.base/java.lang.reflect.Method.invoke(Method.java:562)
              at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
              at java.base/java.lang.Thread.run(Thread.java:1474)
      Caused by: java.lang.RuntimeException: Could not compile TestClass with source code public class TestClass { public static void concat(String one, String two) throws Throwable { System.out.println(one + two); } }
              at jdk.test.lib.compiler.InMemoryJavaCompiler.compile(InMemoryJavaCompiler.java:264)
              at HiddenGetModule.<clinit>(HiddenGetModule.java:62)
              ... 9 more
      STATUS:Failed.`main' threw exception: java.lang.ExceptionInInitializerError

      Running tests like:

      make test TEST=hotspot:tier1 JTREG="VERBOSE=summary;JAVA_OPTIONS=--enable-preview"

      FAILED: runtime/HiddenClasses/CastToParentTest.java
      FAILED: runtime/HiddenClasses/NestedHidden.java
      FAILED: runtime/HiddenClasses/InstantiateHiddenClass.java
      FAILED: runtime/HiddenClasses/HiddenGetModule.java
      FAILED: serviceability/jvmti/RedefineClasses/RedefineAddLambdaExpression.java
      FAILED: serviceability/jvmti/RedefineClasses/TestMultipleClasses.java

            Assignee:
            Coleen Phillimore
            Reporter:
            Coleen Phillimore
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: