src/share/classes/java/lang/ClassLoader.java

Print this page

        

@@ -256,11 +256,11 @@
 
     // The initiating protection domains for all classes loaded by this loader
     private final Set<ProtectionDomain> domains;
 
     // Invoked by the VM to record every loaded class with this loader.
-    void addClass(Class c) {
+    void addClass(Class<?> c) {
         classes.addElement(c);
     }
 
     // The packages defined in this class loader.  Each package name is mapped
     // to its corresponding Package object.

@@ -400,11 +400,11 @@
     protected Class<?> loadClass(String name, boolean resolve)
         throws ClassNotFoundException
     {
         synchronized (getClassLoadingLock(name)) {
             // First, check if the class has already been loaded
-            Class c = findLoadedClass(name);
+            Class<?> c = findLoadedClass(name);
             if (c == null) {
                 long t0 = System.nanoTime();
                 try {
                     if (parent != null) {
                         c = parent.loadClass(name, false);

@@ -466,11 +466,11 @@
         }
         return lock;
     }
 
     // This method is invoked by the virtual machine to load a class.
-    private Class loadClassInternal(String name)
+    private Class<?> loadClassInternal(String name)
         throws ClassNotFoundException
     {
         // For backward compatibility, explicitly lock on 'this' when
         // the current class loader is not parallel capable.
         if (parallelLockMap == null) {

@@ -481,11 +481,11 @@
             return loadClass(name);
         }
     }
 
     // Invoked by the VM after loading class with this loader.
-    private void checkPackageAccess(Class cls, ProtectionDomain pd) {
+    private void checkPackageAccess(Class<?> cls, ProtectionDomain pd) {
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
             final String name = cls.getName();
             final int i = name.lastIndexOf('.');
             if (i != -1) {

@@ -667,21 +667,21 @@
             source = cs.getLocation().toString();
         }
         return source;
     }
 
-    private Class defineTransformedClass(String name, byte[] b, int off, int len,
+    private Class<?> defineTransformedClass(String name, byte[] b, int off, int len,
                                          ProtectionDomain pd,
                                          ClassFormatError cfe, String source)
       throws ClassFormatError
     {
         // Class format error - try to transform the bytecode and
         // define the class again
         //
         ClassFileTransformer[] transformers =
             ClassFileTransformer.getTransformers();
-        Class c = null;
+        Class<?> c = null;
 
         if (transformers != null) {
             for (ClassFileTransformer transformer : transformers) {
                 try {
                     // Transform byte code using transformer

@@ -702,11 +702,11 @@
             throw cfe;
 
         return c;
     }
 
-    private void postDefineClass(Class c, ProtectionDomain pd)
+    private void postDefineClass(Class<?> c, ProtectionDomain pd)
     {
         if (pd.getCodeSource() != null) {
             Certificate certs[] = pd.getCodeSource().getCertificates();
             if (certs != null)
                 setSigners(c, certs);

@@ -782,11 +782,11 @@
                                          ProtectionDomain protectionDomain)
         throws ClassFormatError
     {
         protectionDomain = preDefineClass(name, protectionDomain);
 
-        Class c = null;
+        Class<?> c = null;
         String source = defineClassSourceLocation(protectionDomain);
 
         try {
             c = defineClass1(name, b, off, len, protectionDomain, source);
         } catch (ClassFormatError cfe) {

@@ -880,11 +880,11 @@
             }
         }
 
         protectionDomain = preDefineClass(name, protectionDomain);
 
-        Class c = null;
+        Class<?> c = null;
         String source = defineClassSourceLocation(protectionDomain);
 
         try {
             c = defineClass2(name, b, b.position(), len, protectionDomain,
                              source);

@@ -897,17 +897,17 @@
 
         postDefineClass(c, protectionDomain);
         return c;
     }
 
-    private native Class defineClass0(String name, byte[] b, int off, int len,
+    private native Class<?> defineClass0(String name, byte[] b, int off, int len,
                                       ProtectionDomain pd);
 
-    private native Class defineClass1(String name, byte[] b, int off, int len,
+    private native Class<?> defineClass1(String name, byte[] b, int off, int len,
                                       ProtectionDomain pd, String source);
 
-    private native Class defineClass2(String name, java.nio.ByteBuffer b,
+    private native Class<?> defineClass2(String name, java.nio.ByteBuffer b,
                                       int off, int len, ProtectionDomain pd,
                                       String source);
 
     // true if the name is null or has the potential to be a valid binary name
     private boolean checkName(String name) {

@@ -1008,11 +1008,11 @@
      */
     protected final void resolveClass(Class<?> c) {
         resolveClass0(c);
     }
 
-    private native void resolveClass0(Class c);
+    private native void resolveClass0(Class<?> c);
 
     /**
      * Finds a class with the specified <a href="#name">binary name</a>,
      * loading it if necessary.
      *

@@ -1039,11 +1039,11 @@
     {
         ClassLoader system = getSystemClassLoader();
         if (system == null) {
             if (!checkName(name))
                 throw new ClassNotFoundException(name);
-            Class cls = findBootstrapClass(name);
+            Class<?> cls = findBootstrapClass(name);
             if (cls == null) {
                 throw new ClassNotFoundException(name);
             }
             return cls;
         }

@@ -1052,19 +1052,19 @@
 
     /**
      * Returns a class loaded by the bootstrap class loader;
      * or return null if not found.
      */
-    private Class findBootstrapClassOrNull(String name)
+    private Class<?> findBootstrapClassOrNull(String name)
     {
         if (!checkName(name)) return null;
 
         return findBootstrapClass(name);
     }
 
     // return null if not found
-    private native Class findBootstrapClass(String name);
+    private native Class<?> findBootstrapClass(String name);
 
     /**
      * Returns the class with the given <a href="#name">binary name</a> if this
      * loader has been recorded by the Java virtual machine as an initiating
      * loader of a class with that <a href="#name">binary name</a>.  Otherwise

@@ -1082,11 +1082,11 @@
         if (!checkName(name))
             return null;
         return findLoadedClass0(name);
     }
 
-    private native final Class findLoadedClass0(String name);
+    private native final Class<?> findLoadedClass0(String name);
 
     /**
      * Sets the signers of a class.  This should be invoked after defining a
      * class.  </p>
      *

@@ -1526,11 +1526,11 @@
     // NOTE: This must always be invoked when there is exactly one intervening
     // frame from the core libraries on the stack between this method's
     // invocation and the desired invoker.
     static ClassLoader getCallerClassLoader() {
         // NOTE use of more generic Reflection.getCallerClass()
-        Class caller = Reflection.getCallerClass(3);
+        Class<?> caller = Reflection.getCallerClass(3);
         // This can be null if the VM is requesting it
         if (caller == null) {
             return null;
         }
         // Circumvent security check since this is package-private

@@ -1720,19 +1720,19 @@
         long handle;
         // the version of JNI environment the native library requires.
         private int jniVersion;
         // the class from which the library is loaded, also indicates
         // the loader this native library belongs.
-        private Class fromClass;
+        private Class<?> fromClass;
         // the canonicalized name of the native library.
         String name;
 
         native void load(String name);
         native long find(String name);
         native void unload();
 
-        public NativeLibrary(Class fromClass, String name) {
+        public NativeLibrary(Class<?> fromClass, String name) {
             this.name = name;
             this.fromClass = fromClass;
         }
 
         protected void finalize() {

@@ -1756,11 +1756,11 @@
                 }
             }
         }
         // Invoked in the VM to determine the context class in
         // JNI_Load/JNI_Unload
-        static Class getFromClass() {
+        static Class<?> getFromClass() {
             return ClassLoader.nativeLibraryContext.peek().fromClass;
         }
     }
 
     // All native library names we've loaded.

@@ -1811,11 +1811,11 @@
         paths[n] = ldpath.substring(i, ldlen);
         return paths;
     }
 
     // Invoked in the java.lang.Runtime class to implement load and loadLibrary.
-    static void loadLibrary(Class fromClass, String name,
+    static void loadLibrary(Class<?> fromClass, String name,
                             boolean isAbsolute) {
         ClassLoader loader =
             (fromClass == null) ? null : fromClass.getClassLoader();
         if (sys_paths == null) {
             usr_paths = initializePath("java.library.path");

@@ -1858,11 +1858,11 @@
         }
         // Oops, it failed
         throw new UnsatisfiedLinkError("no " + name + " in java.library.path");
     }
 
-    private static boolean loadLibrary0(Class fromClass, final File file) {
+    private static boolean loadLibrary0(Class<?> fromClass, final File file) {
         boolean exists = AccessController.doPrivileged(
             new PrivilegedAction<Object>() {
                 public Object run() {
                     return file.exists() ? Boolean.TRUE : null;
                 }})

@@ -2192,12 +2192,12 @@
         String cls = System.getProperty("java.system.class.loader");
         if (cls == null) {
             return parent;
         }
 
-        Constructor ctor = Class.forName(cls, true, parent)
-            .getDeclaredConstructor(new Class[] { ClassLoader.class });
+        Constructor<?> ctor = Class.forName(cls, true, parent)
+            .getDeclaredConstructor(new Class<?>[] { ClassLoader.class });
         ClassLoader sys = (ClassLoader) ctor.newInstance(
             new Object[] { parent });
         Thread.currentThread().setContextClassLoader(sys);
         return sys;
     }