This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: fix getPackage for bootstrap loader


I'm checking this in on the 4.1 branch and the trunk.

This fixes getPackage() on a class loaded by the bootstrap loader.
It is essentially a Classpath merge -- another lesson about the
difficulties of divergence.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/lang/Class.java (getPackage): Get package from
	VMClassLoader if needed.

Index: java/lang/Class.java
===================================================================
--- java/lang/Class.java	(revision 108588)
+++ java/lang/Class.java	(working copy)
@@ -455,8 +455,7 @@
   /**
    * Returns the <code>Package</code> in which this class is defined
    * Returns null when this information is not available from the
-   * classloader of this class or when the classloader of this class
-   * is null.
+   * classloader of this class.
    *
    * @return the package for this class, if it is available
    * @since 1.2
@@ -466,7 +465,8 @@
     ClassLoader cl = getClassLoader();
     if (cl != null)
       return cl.getPackage(getPackagePortion(getName()));
-    return null;
+    else
+      return VMClassLoader.getPackage(getPackagePortion(getName()));
   }
 
   /**


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]