[ecj] java.lang.ClassLoader partial merge

Gary Benson gbenson@redhat.com
Thu Nov 30 12:38:00 GMT 2006


Hi again,

This commit makes java.lang.ClassLoader use VMStackWalker to
determine when security checks can be omitted.  As before I
also merged the javadoc.

Cheers,
Gary
-------------- next part --------------
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 119359)
+++ ChangeLog	(working copy)
@@ -1,3 +1,8 @@
+2006-11-30  Gary Benson  <gbenson@redhat.com>
+
+	* java/lang/ClassLoader.java: Merged javadoc.
+	(getParent, getSystemClassLoader): Use VMStackWalker.
+
 2006-11-30  Gary Benson  <gbenson@redhat.com>
 
 	* java/lang/Thread.java: Merged javadoc.
Index: java/lang/ClassLoader.java
===================================================================
--- java/lang/ClassLoader.java	(revision 119314)
+++ java/lang/ClassLoader.java	(working copy)
@@ -39,6 +39,7 @@
 package java.lang;
 
 import gnu.classpath.SystemProperties;
+import gnu.classpath.VMStackWalker;
 import gnu.java.util.DoubleEnumeration;
 import gnu.java.util.EmptyEnumeration;
 
@@ -530,8 +531,7 @@
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
       {
-        Class c = VMSecurityManager.getClassContext(ClassLoader.class)[0];
-        ClassLoader cl = c.getClassLoader();
+	ClassLoader cl = VMStackWalker.getCallingClassLoader();
 	if (cl != null && ! cl.isAncestorOf(this))
           sm.checkPermission(new RuntimePermission("getClassLoader"));
       }
@@ -744,14 +744,15 @@
 
   /**
    * Returns the system classloader. The system classloader (also called
-   * the application classloader) is the classloader that was used to
+   * the application classloader) is the classloader that is used to
    * load the application classes on the classpath (given by the system
    * property <code>java.class.path</code>. This is set as the context
    * class loader for a thread. The system property
    * <code>java.system.class.loader</code>, if defined, is taken to be the
    * name of the class to use as the system class loader, which must have
-   * a public constructor which takes a ClassLoader as a parent; otherwise this
-   * uses gnu.java.lang.SystemClassLoader.
+   * a public constructor which takes a ClassLoader as a parent. The parent
+   * class loader passed in the constructor is the default system class
+   * loader.
    *
    * <p>Note that this is different from the bootstrap classloader that
    * actually loads all the real "system" classes (the bootstrap classloader
@@ -773,8 +774,7 @@
     SecurityManager sm = System.getSecurityManager();
     if (sm != null)
       {
-	Class c = VMSecurityManager.getClassContext(ClassLoader.class)[0];
-	ClassLoader cl = c.getClassLoader();
+	ClassLoader cl = VMStackWalker.getCallingClassLoader();
 	if (cl != null && cl != systemClassLoader)
 	  sm.checkPermission(new RuntimePermission("getClassLoader"));
       }
@@ -898,7 +898,7 @@
    *
    * @param name the (system specific) name of the requested library
    * @return the full pathname to the requested library, or null
-   * @see Runtime#loadLibrary()
+   * @see Runtime#loadLibrary(String)
    * @since 1.2
    */
   protected String findLibrary(String name)
@@ -928,7 +928,7 @@
    *
    * @param name the package (and subpackages) to affect
    * @param enabled true to set the default to enabled
-   * @see #setDefaultAssertionStatus(String, boolean)
+   * @see #setDefaultAssertionStatus(boolean)
    * @see #setClassAssertionStatus(String, boolean)
    * @see #clearAssertionStatus()
    * @since 1.4
@@ -949,7 +949,7 @@
    * @param name the class to affect
    * @param enabled true to set the default to enabled
    * @throws NullPointerException if name is null
-   * @see #setDefaultAssertionStatus(String, boolean)
+   * @see #setDefaultAssertionStatus(boolean)
    * @see #setPackageAssertionStatus(String, boolean)
    * @see #clearAssertionStatus()
    * @since 1.4


More information about the Java-patches mailing list