< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandles.java

Print this page

        

@@ -1925,16 +1925,21 @@
             MemberName ctor = resolveOrFail(REF_newInvokeSpecial, refc, name, type);
             return getDirectConstructor(refc, ctor);
         }
 
         /**
-         * Looks up a class by name from the lookup context defined by this {@code Lookup} object. The static
+         * Looks up a class by name from the lookup context defined by this {@code Lookup} object.
+         * This method attempts to locate, load, and link the class.  The static
          * initializer of the class is not run.
          * <p>
          * The lookup context here is determined by the {@linkplain #lookupClass() lookup class}, its class
          * loader, and the {@linkplain #lookupModes() lookup modes}. In particular, the method first attempts to
          * load the requested class, and then determines whether the class is accessible to this lookup object.
+         * <p>
+         * Note that this method throws errors related to loading and linking as
+         * specified in Sections 12.2 and 12.3 of <em>The Java Language
+         * Specification</em>.
          *
          * @param targetName the fully qualified name of the class to be looked up.
          * @return the requested class.
          * @exception SecurityException if a security manager is present and it
          *            <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>

@@ -1942,10 +1947,13 @@
          * @throws ClassNotFoundException if the class cannot be loaded by the lookup class' loader.
          * @throws IllegalAccessException if the class is not accessible, using the allowed access
          * modes.
          * @exception SecurityException if a security manager is present and it
          *                              <a href="MethodHandles.Lookup.html#secmgr">refuses access</a>
+         *
+         * @jls 12.2 Loading of Classes and Interfaces
+         * @jls 12.3 Linking of Classes and Interfaces
          * @since 9
          */
         public Class<?> findClass(String targetName) throws ClassNotFoundException, IllegalAccessException {
             Class<?> targetClass = Class.forName(targetName, false, lookupClass.getClassLoader());
             return accessClass(targetClass);
< prev index next >