diff options
| author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-02 20:59:41 +0000 |
|---|---|---|
| committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-02-02 20:59:41 +0000 |
| commit | 6f7d00dadbb6b75c3b73214a3b258a3f43b63258 (patch) | |
| tree | 549b32af6b15702bf023898cb2c6638202d540ed /libjava/gnu/gcj/runtime/VMClassLoader.java | |
| parent | 5d93b6ec3e3b11d61a7e92ed06ef480032f6ba60 (diff) | |
| download | ppe42-gcc-6f7d00dadbb6b75c3b73214a3b258a3f43b63258.tar.gz ppe42-gcc-6f7d00dadbb6b75c3b73214a3b258a3f43b63258.zip | |
PR libgcj/19681:
* Makefile.in: Rebuilt.
* Makefile.am (ordinary_java_source_files): Added new class.
* java/lang/natVMClassLoader.cc (getSystemClassLoaderInternal):
Use system_instance, not instance.
* gnu/gcj/runtime/SystemClassLoader.java: New file.
* gnu/gcj/runtime/VMClassLoader.java (init): Don't search
java.class.path.
(system_instance): New field.
(initialize): Initialize the system loader as well.
(VMClassLoader): Default to LIB_CACHE.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@94611 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/runtime/VMClassLoader.java')
| -rw-r--r-- | libjava/gnu/gcj/runtime/VMClassLoader.java | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/libjava/gnu/gcj/runtime/VMClassLoader.java b/libjava/gnu/gcj/runtime/VMClassLoader.java index 2d46ebcb770..1ded892a06d 100644 --- a/libjava/gnu/gcj/runtime/VMClassLoader.java +++ b/libjava/gnu/gcj/runtime/VMClassLoader.java @@ -14,8 +14,12 @@ import java.io.*; import java.util.StringTokenizer; import java.util.HashSet; import java.net.URL; +import java.net.URLClassLoader; -public final class VMClassLoader extends java.net.URLClassLoader +// Despite its name, this class is really the extension loader for +// libgcj. Class loader bootstrap is a bit tricky, see prims.cc and +// SystemClassLoader for some details. +public final class VMClassLoader extends URLClassLoader { private VMClassLoader () { @@ -28,44 +32,17 @@ public final class VMClassLoader extends java.net.URLClassLoader else if ("cache".equals(p)) lib_control = LIB_CACHE; else if ("full".equals(p)) - { - // In case we ever want to change the default. - lib_control = LIB_FULL; - } - else lib_control = LIB_FULL; + else + lib_control = LIB_CACHE; } private void init() { - StringTokenizer st - = new StringTokenizer (System.getProperty ("java.class.path", "."), - System.getProperty ("path.separator", ":")); - - while (st.hasMoreElements ()) - { - String e = st.nextToken (); - try - { - File path = new File(e); - // Ignore invalid paths. - if (!path.exists()) - continue; - if (!e.endsWith (File.separator) && path.isDirectory ()) - addURL(new URL("file", "", -1, e + File.separator)); - else - addURL(new URL("file", "", -1, e)); - } - catch (java.net.MalformedURLException x) - { - // This should never happen. - throw new RuntimeException(x); - } - } - // Add the contents of the extensions directories. - st = new StringTokenizer (System.getProperty ("java.ext.dirs"), - System.getProperty ("path.separator", ":")); + StringTokenizer st + = new StringTokenizer (System.getProperty ("java.ext.dirs"), + File.pathSeparator); try { @@ -91,8 +68,8 @@ public final class VMClassLoader extends java.net.URLClassLoader } } - // Add core:/ to the end of the java.class.path so any resources - // compiled into this executable may be found. + // Add core:/ to the end so any resources compiled into this + // executable may be found. addURL(new URL("core", "", -1, "/")); } catch (java.net.MalformedURLException x) @@ -116,6 +93,7 @@ public final class VMClassLoader extends java.net.URLClassLoader static void initialize () { instance.init(); + system_instance.init(); } // Define a package for something loaded natively. @@ -148,6 +126,8 @@ public final class VMClassLoader extends java.net.URLClassLoader // The only VMClassLoader that can exist. static VMClassLoader instance = new VMClassLoader(); + // The system class loader. + static SystemClassLoader system_instance = new SystemClassLoader(instance); private static final int LIB_FULL = 0; private static final int LIB_CACHE = 1; |

