From 8635bb79f219f8d11e47b8403e54c5111712176b Mon Sep 17 00:00:00 2001 From: Per Bothner Date: Fri, 31 Aug 2001 18:17:24 -0700 Subject: [PATCH] ClassLoader.java (system): Remove static field. * java/lang/ClassLoader.java (system): Remove static field. (getSystemClassLoader): Get gnu.gcj.runtime.VMClassLoader.instance directly instead of using it to set the system field. (loadClass): Use VMClassLoader.instance instead of system field. (findSystemClass): Similar. * prims.cc (_Jv_RunMain): Clear VMClassLoader::instance rather than ClassLoader::system which no longer exists. * java/lang/natClassLoader.java (_Jv_FindClass): Simplify. From-SVN: r45343 --- libjava/ChangeLog | 11 +++++++++++ libjava/java/lang/ClassLoader.java | 9 +++------ libjava/java/lang/natClassLoader.cc | 8 ++------ libjava/prims.cc | 3 ++- 4 files changed, 18 insertions(+), 13 deletions(-) diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 103e32b6dcd..5170b9a1c83 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,14 @@ +2001-08-31 Per Bothner + + * java/lang/ClassLoader.java (system): Remove static field. + (getSystemClassLoader): Get gnu.gcj.runtime.VMClassLoader.instance + directly instead of using it to set the system field. + (loadClass): Use VMClassLoader.instance instead of system field. + (findSystemClass): Similar. + * prims.cc (_Jv_RunMain): Clear VMClassLoader::instance rather + than ClassLoader::system which no longer exists. + * java/lang/natClassLoader.java (_Jv_FindClass): Simplify. + 2001-08-31 Tom Tromey * java/io/BufferedReader.java, java/io/ObjectInput.java, diff --git a/libjava/java/lang/ClassLoader.java b/libjava/java/lang/ClassLoader.java index 9c4b3c8ad75..ce6962ee70e 100644 --- a/libjava/java/lang/ClassLoader.java +++ b/libjava/java/lang/ClassLoader.java @@ -34,7 +34,6 @@ import java.util.Stack; public abstract class ClassLoader { - static private ClassLoader system; private ClassLoader parent; private HashMap definedPackages = new HashMap(); @@ -46,9 +45,7 @@ public abstract class ClassLoader public static ClassLoader getSystemClassLoader () { - if (system == null) - system = gnu.gcj.runtime.VMClassLoader.instance; - return system; + return gnu.gcj.runtime.VMClassLoader.instance; } /** @@ -120,7 +117,7 @@ public abstract class ClassLoader if (parent != null) return parent.loadClass (name, link); else - c = system.findClass (name); + c = gnu.gcj.runtime.VMClassLoader.instance.findClass (name); } catch (ClassNotFoundException ex) { /* ignore, we'll try findClass */; } @@ -464,7 +461,7 @@ public abstract class ClassLoader protected final Class findSystemClass(String name) throws java.lang.ClassNotFoundException { - return getSystemClassLoader ().loadClass (name); + return gnu.gcj.runtime.VMClassLoader.instance.loadClass (name); } /* diff --git a/libjava/java/lang/natClassLoader.cc b/libjava/java/lang/natClassLoader.cc index 0a82ee9c84d..f0794c74111 100644 --- a/libjava/java/lang/natClassLoader.cc +++ b/libjava/java/lang/natClassLoader.cc @@ -481,12 +481,8 @@ _Jv_FindClass (_Jv_Utf8Const *name, java::lang::ClassLoader *loader) } else { - java::lang::ClassLoader *sys = java::lang::ClassLoader::system; - if (sys == NULL) - { - _Jv_InitClass (&ClassLoaderClass); - sys = java::lang::ClassLoader::getSystemClassLoader (); - } + java::lang::ClassLoader *sys + = java::lang::ClassLoader::getSystemClassLoader (); // Load using the bootstrap loader jvmspec 5.3.1. klass = sys->loadClass (sname, false); diff --git a/libjava/prims.cc b/libjava/prims.cc index 01c23b89820..6a13ed5fe75 100644 --- a/libjava/prims.cc +++ b/libjava/prims.cc @@ -64,6 +64,7 @@ details. */ #include #include #include +#include #ifdef USE_LTDL #include @@ -921,7 +922,7 @@ _Jv_RunMain (jclass klass, const char *name, int argc, const char **argv, // jar file only. The easiest way to do this is to lose our // reference to the previous classloader. _Jv_Jar_Class_Path = strdup (name); - java::lang::ClassLoader::system = NULL; + gnu::gcj::runtime::VMClassLoader::instance = NULL; } } catch (java::lang::Throwable *t)