aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/runtime/SystemClassLoader.java
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2006-05-04 15:29:22 +0000
committerTom Tromey <tromey@gcc.gnu.org>2006-05-04 15:29:22 +0000
commitb149e89e77531944d9575190084dee9816391bc2 (patch)
tree1e7ea10ce538133713a486e931169337b691095b /libjava/gnu/gcj/runtime/SystemClassLoader.java
parent5eedb0ce4e6a6d96af8f9ba956dcf0c88796e26f (diff)
downloadgcc-b149e89e77531944d9575190084dee9816391bc2.zip
gcc-b149e89e77531944d9575190084dee9816391bc2.tar.gz
gcc-b149e89e77531944d9575190084dee9816391bc2.tar.bz2
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
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 d012211..7470542 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