-
Bug
-
Resolution: Fixed
-
P4
-
8
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 inJDK-8138569)
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
- relates to
-
JDK-8138884 MethodHandles.Lookup.findVirtual() Javadoc fails to consider private interface methods
-
- Resolved
-
-
JDK-8081349 5.4.3.5: Clarify that method handle resolution is protected-aware
-
- Closed
-
-
JDK-8138569 5.4.3.5: Clarify that method handle resolution is static-aware
-
- Closed
-