1.1 --- a/emul/mini/src/main/java/java/lang/Class.java Wed Jan 23 23:16:47 2013 +0100
1.2 +++ b/emul/mini/src/main/java/java/lang/Class.java Wed Jan 23 23:17:03 2013 +0100
1.3 @@ -160,6 +160,74 @@
1.4 }
1.5 return c;
1.6 }
1.7 +
1.8 +
1.9 + /**
1.10 + * Returns the {@code Class} object associated with the class or
1.11 + * interface with the given string name, using the given class loader.
1.12 + * Given the fully qualified name for a class or interface (in the same
1.13 + * format returned by {@code getName}) this method attempts to
1.14 + * locate, load, and link the class or interface. The specified class
1.15 + * loader is used to load the class or interface. If the parameter
1.16 + * {@code loader} is null, the class is loaded through the bootstrap
1.17 + * class loader. The class is initialized only if the
1.18 + * {@code initialize} parameter is {@code true} and if it has
1.19 + * not been initialized earlier.
1.20 + *
1.21 + * <p> If {@code name} denotes a primitive type or void, an attempt
1.22 + * will be made to locate a user-defined class in the unnamed package whose
1.23 + * name is {@code name}. Therefore, this method cannot be used to
1.24 + * obtain any of the {@code Class} objects representing primitive
1.25 + * types or void.
1.26 + *
1.27 + * <p> If {@code name} denotes an array class, the component type of
1.28 + * the array class is loaded but not initialized.
1.29 + *
1.30 + * <p> For example, in an instance method the expression:
1.31 + *
1.32 + * <blockquote>
1.33 + * {@code Class.forName("Foo")}
1.34 + * </blockquote>
1.35 + *
1.36 + * is equivalent to:
1.37 + *
1.38 + * <blockquote>
1.39 + * {@code Class.forName("Foo", true, this.getClass().getClassLoader())}
1.40 + * </blockquote>
1.41 + *
1.42 + * Note that this method throws errors related to loading, linking or
1.43 + * initializing as specified in Sections 12.2, 12.3 and 12.4 of <em>The
1.44 + * Java Language Specification</em>.
1.45 + * Note that this method does not check whether the requested class
1.46 + * is accessible to its caller.
1.47 + *
1.48 + * <p> If the {@code loader} is {@code null}, and a security
1.49 + * manager is present, and the caller's class loader is not null, then this
1.50 + * method calls the security manager's {@code checkPermission} method
1.51 + * with a {@code RuntimePermission("getClassLoader")} permission to
1.52 + * ensure it's ok to access the bootstrap class loader.
1.53 + *
1.54 + * @param name fully qualified name of the desired class
1.55 + * @param initialize whether the class must be initialized
1.56 + * @param loader class loader from which the class must be loaded
1.57 + * @return class object representing the desired class
1.58 + *
1.59 + * @exception LinkageError if the linkage fails
1.60 + * @exception ExceptionInInitializerError if the initialization provoked
1.61 + * by this method fails
1.62 + * @exception ClassNotFoundException if the class cannot be located by
1.63 + * the specified class loader
1.64 + *
1.65 + * @see java.lang.Class#forName(String)
1.66 + * @see java.lang.ClassLoader
1.67 + * @since 1.2
1.68 + */
1.69 + public static Class<?> forName(String name, boolean initialize,
1.70 + ClassLoader loader)
1.71 + throws ClassNotFoundException
1.72 + {
1.73 + return forName(name);
1.74 + }
1.75
1.76 @JavaScriptBody(args = {"n", "c" }, body =
1.77 "if (vm[c]) return vm[c].$class;\n"