--- old/src/java.base/share/classes/java/lang/invoke/MethodHandles.java 2016-03-10 18:43:23.000000000 +0100 +++ new/src/java.base/share/classes/java/lang/invoke/MethodHandles.java 2016-03-10 18:43:23.000000000 +0100 @@ -99,13 +99,16 @@ *
* As a matter of pure convention, the {@linkplain Lookup#lookupClass lookup class} * of this lookup object will be {@link java.lang.Object}. + * Consequently, the lookup context of this lookup object will be the bootstrap + * class loader, which means it cannot find or access user classes. * *
* Discussion: * The lookup class can be changed to any other class {@code C} using an expression of the form * {@link Lookup#in publicLookup().in(C.class)}. * Since all classes have equal access to public names, - * such a change would confer no new access rights. + * such a change would confer no new access rights, + * but may change the lookup context by virtue of changing the class loader. * A public lookup object is always subject to * security manager checks. * Also, it cannot access @@ -629,6 +632,8 @@ *
* However, the resulting {@code Lookup} object is guaranteed * to have no more access capabilities than the original. + * Access capabilities are determined by the lookup class' class loader, + * which may change due to this operation. * In particular, access capabilities can be lost as follows:
+ * The lookup context is determined by the class loader of the {@link #lookupClass()}. * * @param targetName the fully qualified name of the class to be looked up. * @return the requested class. @@ -960,6 +967,8 @@ /** * Determines if a class can be accessed from the lookup context defined by this {@code Lookup} object. The * static initializer of the class is not run. + *
+ * The lookup context is determined by the class loader of the {@link #lookupClass()}. * * @param targetClass the class to be access-checked *