Class.h (JV_STATE_LOADING): Added comment.

* java/lang/Class.h (JV_STATE_LOADING): Added comment.
	* Makefile.in: Rebuilt.
	* Makefile.am (nat_source_files): Added natSystemClassLoader.cc.
	* gnu/gcj/runtime/natSystemClassLoader.cc: New file.
	* gnu/gcj/runtime/SystemClassLoader.java (nativeClasses):
	New field.
	(loadedClasses): Removed.
	(findClass): Declare.
	(addClass): Add to nativeClasses, not loadedClasses.

From-SVN: r113530
This commit is contained in:
Tom Tromey
2006-05-04 15:29:22 +00:00
committed by Tom Tromey
parent 5eedb0ce4e
commit b149e89e77
6 changed files with 67 additions and 16 deletions
+6 -16
View File
@@ -22,7 +22,9 @@ public final class SystemClassLoader extends URLClassLoader
super(new URL[0], parent);
}
private HashMap loadedClasses;
// This holds all the "native" classes linked into the executable
// and registered with this loader.
private HashMap nativeClasses = new HashMap();
// This is called to register a native class which was linked into
// the application but which is registered with the system class
@@ -42,23 +44,11 @@ public final class SystemClassLoader extends URLClassLoader
}
// Use reflection to access the package-private "loadedClasses" field.
if (this.loadedClasses == null)
{
try
{
Class cl = java.lang.ClassLoader.class;
Field lcField = cl.getDeclaredField("loadedClasses");
lcField.setAccessible(true);
this.loadedClasses = (HashMap) lcField.get(this);
}
catch (Exception x)
{
throw new RuntimeException(x);
}
}
this.loadedClasses.put(className, klass);
nativeClasses.put(className, klass);
}
protected native Class findClass(String name);
// We add the URLs to the system class loader late. The reason for
// this is that during bootstrap we don't want to parse URLs or
// create URL connections, since that will result in circularities