< prev index next >
src/java.base/share/classes/java/lang/invoke/MethodHandles.java
Print this page
*** 467,482 ****
* with special names ({@code "<init>"} and {@code "<clinit>"}).
* The internal syntax of invocation instructions allows them to refer to such internal
* methods as if they were normal methods, but the JVM bytecode verifier rejects them.
* A lookup of such an internal method will produce a {@code NoSuchMethodException}.
* <p>
! * Since JDK 11 the relationship between nested types can be expressed directly through the
! * {@code NestHost} and {@code NestMembers} attributes.
! * (See the Java Virtual Machine Specification, sections 4.7.28 and 4.7.29.)
! * In that case, the lookup class has direct access to private members of all its nestmates, and
* that is true of the associated {@code Lookup} object as well.
! * Otherwise, access between nested classes is obtained by the Java compiler creating
* a wrapper method to access a private method of another class in the same nest.
* For example, a nested class {@code C.D}
* can access private members within other related classes such as
* {@code C}, {@code C.D.E}, or {@code C.B},
* but the Java compiler may need to generate wrapper methods in
--- 467,480 ----
* with special names ({@code "<init>"} and {@code "<clinit>"}).
* The internal syntax of invocation instructions allows them to refer to such internal
* methods as if they were normal methods, but the JVM bytecode verifier rejects them.
* A lookup of such an internal method will produce a {@code NoSuchMethodException}.
* <p>
! * The lookup class has direct access to private members of all its
! * <a href="../Class.html#nestmates">nestmates</a>, and
* that is true of the associated {@code Lookup} object as well.
! * In some cases, access between nested classes is obtained by the Java compiler creating
* a wrapper method to access a private method of another class in the same nest.
* For example, a nested class {@code C.D}
* can access private members within other related classes such as
* {@code C}, {@code C.D.E}, or {@code C.B},
* but the Java compiler may need to generate wrapper methods in
< prev index next >