-
Bug
-
Resolution: Fixed
-
P4
-
8
JVMS8 says that method handle of kind REF_invokeSpecial has the following bytecode behavior
invokespecial C.m:(A*)T
and descriptor
(C,A*)T
where C - class that contains target method, A* - target method parameters, T - target method return type
Such description does not consider specific checks performed for invokespecial instruction:
1. invokespecial may only invoke method defined in a superclass or a current class. Therefore, if C is not the current class or a superclass then resolution must fail. Otherwise, it would be possible to effectively do invokespecial on another class.
2. invokespecial may only be invoked on instance of the current class or a subclass. Therefore, method handle type descriptor must be (CurrentClass, A*)T. Otherwise, it would be possible to effectively do invokespecial on superclass instance.
For comparison, MethodHandles.Lookup.findSpecial() specification has both of this constraints.
HotSpot also provides this both constraints (which makes it formally incompatible with spec).
invokespecial C.m:(A*)T
and descriptor
(C,A*)T
where C - class that contains target method, A* - target method parameters, T - target method return type
Such description does not consider specific checks performed for invokespecial instruction:
1. invokespecial may only invoke method defined in a superclass or a current class. Therefore, if C is not the current class or a superclass then resolution must fail. Otherwise, it would be possible to effectively do invokespecial on another class.
2. invokespecial may only be invoked on instance of the current class or a subclass. Therefore, method handle type descriptor must be (CurrentClass, A*)T. Otherwise, it would be possible to effectively do invokespecial on superclass instance.
For comparison, MethodHandles.Lookup.findSpecial() specification has both of this constraints.
HotSpot also provides this both constraints (which makes it formally incompatible with spec).
- relates to
-
JDK-8081349 5.4.3.5: Clarify that method handle resolution is protected-aware
-
- Closed
-