-
Bug
-
Resolution: Unresolved
-
P4
-
None
5.4.3.5 lists a few cases analogous to linkage errors that cause the MethodHandle to fail to resolve:
- any failure of Class/Fieldref/Methodref resolution
- Constraints on protected access
- mismatch in the 'static' flag
- '<init>' in a superclass
But it doesn't mention other cases listed as causes of linkage errors in the corresponding instruction specs:
- 'final' flag on putfield/putstatic
- errors thrown by 'invokevirtual' of signature polymorphic VarHandle methods
- 'new' on an interface or abstract class (<init> would fail to resolve anyway in the interface case...)
- a number of specified *runtime exceptions* for invokespecial that could be checked at resolution time: abstract method, unsatisfied link for native method, conflicting default methods
Some experimenting with MethodHandles.Lookup shows that, at least for that API, 'new' on an abstract class will resolve, but 'invokespecial' of an abstract method and 'putstatic' of a final field will not. (Specs for methods in that API should probably also be clarified.)
- any failure of Class/Fieldref/Methodref resolution
- Constraints on protected access
- mismatch in the 'static' flag
- '<init>' in a superclass
But it doesn't mention other cases listed as causes of linkage errors in the corresponding instruction specs:
- 'final' flag on putfield/putstatic
- errors thrown by 'invokevirtual' of signature polymorphic VarHandle methods
- 'new' on an interface or abstract class (<init> would fail to resolve anyway in the interface case...)
- a number of specified *runtime exceptions* for invokespecial that could be checked at resolution time: abstract method, unsatisfied link for native method, conflicting default methods
Some experimenting with MethodHandles.Lookup shows that, at least for that API, 'new' on an abstract class will resolve, but 'invokespecial' of an abstract method and 'putstatic' of a final field will not. (Specs for methods in that API should probably also be clarified.)
- relates to
-
JDK-8322508 5.4.3.5: Clean up MethodHandle resolution rules
- Resolved