37 |
|
|
38 |
package java.lang; |
package java.lang; |
39 |
|
|
40 |
|
import gnu.classpath.VMStackWalker; |
41 |
|
|
42 |
import java.net.URL; |
import java.net.URL; |
43 |
import java.util.NoSuchElementException; |
import java.util.NoSuchElementException; |
44 |
import java.util.StringTokenizer; |
import java.util.StringTokenizer; |
275 |
public static Package getPackage(String name) |
public static Package getPackage(String name) |
276 |
{ |
{ |
277 |
// Get the caller's classloader |
// Get the caller's classloader |
278 |
ClassLoader cl = VMSecurityManager.currentClassLoader(); |
ClassLoader cl = VMStackWalker.getCallingClassLoader(); |
279 |
return cl != null ? cl.getPackage(name) : null; |
return cl != null ? cl.getPackage(name) : null; |
280 |
} |
} |
281 |
|
|
288 |
public static Package[] getPackages() |
public static Package[] getPackages() |
289 |
{ |
{ |
290 |
// Get the caller's classloader |
// Get the caller's classloader |
291 |
Class c = VMSecurityManager.getClassContext()[1]; |
ClassLoader cl = VMStackWalker.getCallingClassLoader(); |
|
ClassLoader cl = c.getClassLoader(); |
|
292 |
// Sun's implementation returns the packages loaded by the bootstrap |
// Sun's implementation returns the packages loaded by the bootstrap |
293 |
// classloader if cl is null, but right now our bootstrap classloader |
// classloader if cl is null, but right now our bootstrap classloader |
294 |
// does not create any Packages. |
// does not create any Packages. |