classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: Package and VMClassLoader


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: Package and VMClassLoader
Date: 07 Jan 2005 14:56:23 -0700
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

I'm checking this in.

This changes Package.getPackage() and Package.getPackages() to use
VMClassLoader if there is no current class loader.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * java/lang/Package.java (getPackages): Use VMClassLoader when
        appropriate.
        (getPackage): Likewise.

Index: java/lang/Package.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Package.java,v
retrieving revision 1.15
diff -u -r1.15 Package.java
--- java/lang/Package.java 7 Jan 2005 15:08:23 -0000 1.15
+++ java/lang/Package.java 7 Jan 2005 21:57:58 -0000
@@ -1,5 +1,5 @@
 /* Package.java -- information about a package
-   Copyright (C) 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -276,7 +276,7 @@
   {
     // Get the caller's classloader
     ClassLoader cl = VMStackWalker.getCallingClassLoader();
-    return cl != null ? cl.getPackage(name) : null;
+    return cl != null ? cl.getPackage(name) : VMClassLoader.getPackage(name);
   }
 
   /**
@@ -289,10 +289,7 @@
   {
     // Get the caller's classloader
     ClassLoader cl = VMStackWalker.getCallingClassLoader();
-    // Sun's implementation returns the packages loaded by the bootstrap
-    // classloader if cl is null, but right now our bootstrap classloader
-    // does not create any Packages.
-    return cl != null ? cl.getPackages() : new Package[0];
+    return cl != null ? cl.getPackages() : VMClassLoader.getPackages();
   }
 
   /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]