< prev index next >

src/java.base/share/classes/java/lang/Class.java

Print this page




 674      * @see java.lang.ClassLoader
 675      * @see SecurityManager#checkPermission
 676      * @see java.lang.RuntimePermission
 677      */
 678     @CallerSensitive
 679     public ClassLoader getClassLoader() {
 680         ClassLoader cl = getClassLoader0();
 681         if (cl == null)
 682             return null;
 683         SecurityManager sm = System.getSecurityManager();
 684         if (sm != null) {
 685             ClassLoader.checkClassLoaderPermission(cl, Reflection.getCallerClass());
 686         }
 687         return cl;
 688     }
 689 
 690     // Package-private to allow ClassLoader access
 691     ClassLoader getClassLoader0() { return classLoader; }
 692 
 693     // Initialized in JVM not by private constructor


 694     private final ClassLoader classLoader;
 695 
 696     /**
 697      * Returns an array of {@code TypeVariable} objects that represent the
 698      * type variables declared by the generic declaration represented by this
 699      * {@code GenericDeclaration} object, in declaration order.  Returns an
 700      * array of length 0 if the underlying generic declaration declares no type
 701      * variables.
 702      *
 703      * @return an array of {@code TypeVariable} objects that represent
 704      *     the type variables declared by this generic declaration
 705      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
 706      *     signature of this generic declaration does not conform to
 707      *     the format specified in
 708      *     <cite>The Java&trade; Virtual Machine Specification</cite>
 709      * @since 1.5
 710      */
 711     @SuppressWarnings("unchecked")
 712     public TypeVariable<Class<T>>[] getTypeParameters() {
 713         ClassRepository info = getGenericInfo();




 674      * @see java.lang.ClassLoader
 675      * @see SecurityManager#checkPermission
 676      * @see java.lang.RuntimePermission
 677      */
 678     @CallerSensitive
 679     public ClassLoader getClassLoader() {
 680         ClassLoader cl = getClassLoader0();
 681         if (cl == null)
 682             return null;
 683         SecurityManager sm = System.getSecurityManager();
 684         if (sm != null) {
 685             ClassLoader.checkClassLoaderPermission(cl, Reflection.getCallerClass());
 686         }
 687         return cl;
 688     }
 689 
 690     // Package-private to allow ClassLoader access
 691     ClassLoader getClassLoader0() { return classLoader; }
 692 
 693     // Initialized in JVM not by private constructor
 694     // This field is an internal optimization for Class.getClassLoader() and
 695     // should not be returned by Class.class.getDeclaredField()
 696     private final ClassLoader classLoader;
 697 
 698     /**
 699      * Returns an array of {@code TypeVariable} objects that represent the
 700      * type variables declared by the generic declaration represented by this
 701      * {@code GenericDeclaration} object, in declaration order.  Returns an
 702      * array of length 0 if the underlying generic declaration declares no type
 703      * variables.
 704      *
 705      * @return an array of {@code TypeVariable} objects that represent
 706      *     the type variables declared by this generic declaration
 707      * @throws java.lang.reflect.GenericSignatureFormatError if the generic
 708      *     signature of this generic declaration does not conform to
 709      *     the format specified in
 710      *     <cite>The Java&trade; Virtual Machine Specification</cite>
 711      * @since 1.5
 712      */
 713     @SuppressWarnings("unchecked")
 714     public TypeVariable<Class<T>>[] getTypeParameters() {
 715         ClassRepository info = getGenericInfo();


< prev index next >