-
Enhancement
-
Resolution: Unresolved
-
P4
-
7
Resolution of a CONSTANT_MethodType occurs by resolving each mentioned class. This, in turn, requires loading each class and testing that it is accessible to the caller.
Compared to the process for resolving a field or method reference (5.4.3.2, 5.4.3.3), this carries additional overhead and can prompt unwanted errors. Method descriptors need not name accessible classes -- in fact, they need not name classes that exist at all (as long as the verification rules are still satisfied).
It might be better to avoid checking the classes named by a MethodType for accessibility; further, if the MethodType API can be enhanced to avoid requiring Class objects (JDK-8130087), it would be possible to construct a MethodType with the referenced descriptor directly, rather than resolving the named classes first.
Compared to the process for resolving a field or method reference (5.4.3.2, 5.4.3.3), this carries additional overhead and can prompt unwanted errors. Method descriptors need not name accessible classes -- in fact, they need not name classes that exist at all (as long as the verification rules are still satisfied).
It might be better to avoid checking the classes named by a MethodType for accessibility; further, if the MethodType API can be enhanced to avoid requiring Class objects (JDK-8130087), it would be possible to construct a MethodType with the referenced descriptor directly, rather than resolving the named classes first.
- is blocked by
-
JDK-8130087 Allow MethodType to encode its components with Strings, not Classes
- Open
- relates to
-
JDK-8066114 javac generates incorrect invokedynamic instruction that results in an IllegalAccessError
- In Progress
-
JDK-8333854 IllegalAccessError with proxies after JDK-8332457
- Resolved