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

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 9
    • Component/s: specification
    • Labels:
    • Subcomponent:
      vm

      Description

      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)

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: