diff options
Diffstat (limited to 'libjava/gnu/gcj')
-rw-r--r-- | libjava/gnu/gcj/runtime/SystemClassLoader.java | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/libjava/gnu/gcj/runtime/SystemClassLoader.java b/libjava/gnu/gcj/runtime/SystemClassLoader.java index 1bb5ef9..efd3323 100644 --- a/libjava/gnu/gcj/runtime/SystemClassLoader.java +++ b/libjava/gnu/gcj/runtime/SystemClassLoader.java @@ -1,4 +1,4 @@ -/* Copyright (C) 2005 Free Software Foundation +/* Copyright (C) 2005, 2006 Free Software Foundation This file is part of libgcj. @@ -21,6 +21,25 @@ public final class SystemClassLoader extends URLClassLoader super(new URL[0], parent); } + // This is called to register a native class which was linked into + // the application but which is registered with the system class + // loader after the VM is initialized. + void addClass(Class klass) + { + String packageName = null; + String className = klass.getName(); + int lastDot = className.lastIndexOf('.'); + if (lastDot != -1) + packageName = className.substring(0, lastDot); + if (packageName != null && getPackage(packageName) == null) + { + // Should have some way to store this information in a + // precompiled manifest. + definePackage(packageName, null, null, null, null, null, null, null); + } + loadedClasses.put(className, klass); + } + // 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 |