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
This commit is contained in:
Per Bothner 2001-08-31 18:17:24 -07:00 committed by Per Bothner
parent 788d7b942c
commit 8635bb79f2
4 changed files with 18 additions and 13 deletions

View File

@ -1,3 +1,14 @@
2001-08-31 Per Bothner <per@bothner.com>
* 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 <tromey@redhat.com>
* java/io/BufferedReader.java, java/io/ObjectInput.java,

View File

@ -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);
}
/*

View File

@ -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);

View File

@ -64,6 +64,7 @@ details. */
#include <java/lang/reflect/Modifier.h>
#include <java/io/PrintStream.h>
#include <java/lang/UnsatisfiedLinkError.h>
#include <gnu/gcj/runtime/VMClassLoader.h>
#ifdef USE_LTDL
#include <ltdl.h>
@ -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)