Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8149574

Fix java/lang/invoke/MethodHandleImpl's use of Unsafe.defineAnonymousClass()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 9
    • 9
    • core-libs
    • None

      For Jigsaw and other reasons, the implementation of Unsafe.defineAnonymousClass() is changing in JDK-9 to require that the anonymous class either be in its host's package or not in any package (in which case the JVM will put it in its host's package). Otherwise, defineAnonymousClass() will throw IllegalArgumentException.

      Class java.lang.invokeMethodHandleImpl currently uses the name java/lang/invoke/MethodHandleImpl$BindCaller$T for its anonymous class. This should be changed to use an anonymous class with either no package name or the package name of its host class. Otherwise, multiple jtreg and nsk tests will fail once the changes to Unsafe.defineAnonymousClass() are checked into JDK-9. Some of the failing tests are:

      hotspot/closed/compiler/c2/8004336/Test8004336.java
      hotspot/closed/compiler/jsr292/8009699/Test8009699B.java
      jdk/test/java/closed/java/lang/invoke/7197546/MethodHandleProxiesTest.java
      jdk/test/java/lang/StackWalker/GetCallerClassTest.java
                ...

      also many of the UTE vm/runtime/defmeth/scenarios/... tests

            srastogi Shilpi Rastogi (Inactive)
            hseigel Harold Seigel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: