summaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/runtime/SystemClassLoader.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/gnu/gcj/runtime/SystemClassLoader.java')
-rw-r--r--libjava/gnu/gcj/runtime/SystemClassLoader.java22
1 files changed, 6 insertions, 16 deletions
diff --git a/libjava/gnu/gcj/runtime/SystemClassLoader.java b/libjava/gnu/gcj/runtime/SystemClassLoader.java
index d01221167a7..7470542cb7c 100644
--- a/libjava/gnu/gcj/runtime/SystemClassLoader.java
+++ b/libjava/gnu/gcj/runtime/SystemClassLoader.java
@@ -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