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

5.4.3.5: Clarify that method handle resolution of REF_invokeInterface is private-aware

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 9
    • 8
    • specification
    • vm

      REF_invokeInterface resolution is not specified to perform check of ACC_PRIVATE flag of the resolved method.
      HotSpot throws IllegalAccessError if the resolved method has ACC_PRIVATE set.

      Example:
      public interface InvokeInterfacePrivate version 52:0 {
           public static Method main:"([Ljava/lang/String;)V" stack 10 locals 1 {
               ldc MethodHandle
      REF_invokeInterface:InvokeInterfacePrivate.m:"()V"; // throws
      IllegalAccessError
               return;
           }
           private Method m:"()V" stack 0 locals 1 { return; }
      }

      This is akin to the assertion jvms-6.5.invokeinterface.linking-110 in invokeinterface spec: "Otherwise, if the resolved method is static or private, the invokeinterface instruction throws an IncompatibleClassChangeError." (Part related to static methods is discussed in JDK-8138569)

            abuckley Alex Buckley
            slukyanov Stanislav Lukyanov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: