From ec858596f78dd4ddc318edd3d3f4ec537780c854 Mon Sep 17 00:00:00 2001 From: Archie Cobbs Date: Fri, 7 Jan 2005 15:08:21 +0000 Subject: Re-committing now that the 0.13 release has been tagged: * NEWS: Document changes. * java/lang/Class.java (newInstance(), getClassLoader(), forName(String), forName(String, boolean, ClassLoader)): Use new VMStackWalker methods. * java/lang/ClassLoader.java (getParent(), getSystemClassLoader()): Likewise. * java/lang/Package.java (getPackages()): Likewise. * java/lang/SecurityManager.java (getClassContext()): Likewise. * java/util/ResourceBundle.java (getBundle()): Likewise. * java/lang/Runtime.java (load(), loadLibrary()): Load the native library using the calling class' class loader. * java/lang/System.java (load(), loadLibrary()): Likewise. (currentClassLoader()): implement via currentLoadedClass(). * vm/reference/gnu/classpath/VMStackWalker.java: New class. * vm/reference/java/lang/VMRuntime.java (nativeLoad()): Add a ClassLoader parameter. * vm/reference/java/lang/VMSecurityManager.java: Removed. --- java/lang/System.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'java/lang/System.java') diff --git a/java/lang/System.java b/java/lang/System.java index a639cac40..d0e32a3e5 100644 --- a/java/lang/System.java +++ b/java/lang/System.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.lang; +import gnu.classpath.VMStackWalker; import gnu.classpath.SystemProperties; import java.io.InputStream; @@ -480,6 +481,10 @@ public final class System * check may be performed, checkLink. This just calls * Runtime.getRuntime().load(filename). * + *

+ * The library is loaded using the class loader associated with the + * class associated with the invoking method. + * * @param filename the code file to load * @throws SecurityException if permission is denied * @throws UnsatisfiedLinkError if the file cannot be loaded @@ -487,7 +492,7 @@ public final class System */ public static void load(String filename) { - Runtime.getRuntime().load(filename); + Runtime.getRuntime().load(filename, VMStackWalker.getCallingClassLoader()); } /** @@ -495,6 +500,10 @@ public final class System * check may be performed, checkLink. This just calls * Runtime.getRuntime().load(filename). * + *

+ * The library is loaded using the class loader associated with the + * class associated with the invoking method. + * * @param libname the library file to load * @throws SecurityException if permission is denied * @throws UnsatisfiedLinkError if the file cannot be loaded @@ -502,7 +511,8 @@ public final class System */ public static void loadLibrary(String libname) { - Runtime.getRuntime().loadLibrary(libname); + Runtime.getRuntime().loadLibrary(libname, + VMStackWalker.getCallingClassLoader()); } /** -- cgit v1.2.1