319 * {@code X} to be initialized. |
319 * {@code X} to be initialized. |
320 * |
320 * |
321 * @param className the fully qualified name of the desired class. |
321 * @param className the fully qualified name of the desired class. |
322 * @return the {@code Class} object for the class with the |
322 * @return the {@code Class} object for the class with the |
323 * specified name. |
323 * specified name. |
324 * @exception LinkageError if the linkage fails |
324 * @throws LinkageError if the linkage fails |
325 * @exception ExceptionInInitializerError if the initialization provoked |
325 * @throws ExceptionInInitializerError if the initialization provoked |
326 * by this method fails |
326 * by this method fails |
327 * @exception ClassNotFoundException if the class cannot be located |
327 * @throws ClassNotFoundException if the class cannot be located |
328 */ |
328 */ |
329 @CallerSensitive |
329 @CallerSensitive |
330 public static Class<?> forName(String className) |
330 public static Class<?> forName(String className) |
331 throws ClassNotFoundException { |
331 throws ClassNotFoundException { |
332 Class<?> caller = Reflection.getCallerClass(); |
332 Class<?> caller = Reflection.getCallerClass(); |
377 * @param initialize if {@code true} the class will be initialized. |
377 * @param initialize if {@code true} the class will be initialized. |
378 * See Section 12.4 of <em>The Java Language Specification</em>. |
378 * See Section 12.4 of <em>The Java Language Specification</em>. |
379 * @param loader class loader from which the class must be loaded |
379 * @param loader class loader from which the class must be loaded |
380 * @return class object representing the desired class |
380 * @return class object representing the desired class |
381 * |
381 * |
382 * @exception LinkageError if the linkage fails |
382 * @throws LinkageError if the linkage fails |
383 * @exception ExceptionInInitializerError if the initialization provoked |
383 * @throws ExceptionInInitializerError if the initialization provoked |
384 * by this method fails |
384 * by this method fails |
385 * @exception ClassNotFoundException if the class cannot be located by |
385 * @throws ClassNotFoundException if the class cannot be located by |
386 * the specified class loader |
386 * the specified class loader |
387 * @exception SecurityException |
387 * @throws SecurityException |
388 * if a security manager is present, and the {@code loader} is |
388 * if a security manager is present, and the {@code loader} is |
389 * {@code null}, and the caller's class loader is not |
389 * {@code null}, and the caller's class loader is not |
390 * {@code null}, and the caller does not have the |
390 * {@code null}, and the caller does not have the |
391 * {@link RuntimePermission}{@code ("getClassLoader")} |
391 * {@link RuntimePermission}{@code ("getClassLoader")} |
392 * |
392 * |
665 * specified {@code Class} parameter can be converted to the type |
665 * specified {@code Class} parameter can be converted to the type |
666 * represented by this {@code Class} object via an identity conversion |
666 * represented by this {@code Class} object via an identity conversion |
667 * or via a widening reference conversion. See <em>The Java Language |
667 * or via a widening reference conversion. See <em>The Java Language |
668 * Specification</em>, sections 5.1.1 and 5.1.4 , for details. |
668 * Specification</em>, sections 5.1.1 and 5.1.4 , for details. |
669 * |
669 * |
670 * @param cls the {@code Class} object to be checked |
670 * @param cls the {@code Class} object to be checked |
671 * @return the {@code boolean} value indicating whether objects of the |
671 * @return the {@code boolean} value indicating whether objects of the |
672 * type {@code cls} can be assigned to objects of this class |
672 * type {@code cls} can be assigned to objects of this class |
673 * @exception NullPointerException if the specified Class parameter is |
673 * @throws NullPointerException if the specified Class parameter is |
674 * null. |
674 * null. |
675 * @since 1.1 |
675 * @since 1.1 |
676 */ |
676 */ |
677 @HotSpotIntrinsicCandidate |
677 @HotSpotIntrinsicCandidate |
678 public native boolean isAssignableFrom(Class<?> cls); |
678 public native boolean isAssignableFrom(Class<?> cls); |
679 |
679 |
680 |
680 |
1510 /** |
1510 /** |
1511 * Returns the immediately enclosing class of the underlying |
1511 * Returns the immediately enclosing class of the underlying |
1512 * class. If the underlying class is a top level class this |
1512 * class. If the underlying class is a top level class this |
1513 * method returns {@code null}. |
1513 * method returns {@code null}. |
1514 * @return the immediately enclosing class of the underlying class |
1514 * @return the immediately enclosing class of the underlying class |
1515 * @exception SecurityException |
1515 * @throws SecurityException |
1516 * If a security manager, <i>s</i>, is present and the caller's |
1516 * If a security manager, <i>s</i>, is present and the caller's |
1517 * class loader is not the same as or an ancestor of the class |
1517 * class loader is not the same as or an ancestor of the class |
1518 * loader for the enclosing class and invocation of {@link |
1518 * loader for the enclosing class and invocation of {@link |
1519 * SecurityManager#checkPackageAccess s.checkPackageAccess()} |
1519 * SecurityManager#checkPackageAccess s.checkPackageAccess()} |
1520 * denies access to the package of the enclosing class |
1520 * denies access to the package of the enclosing class |