Makefile.in: Rebuilt.
* Makefile.in: Rebuilt. * Makefile.am (AM_CXXFLAGS): Define TOOLEXECLIBDIR. (libgcj0_convenience_la_SOURCES): Don't include gnu_xml_source_files. (libgcj0_convenience_la_LIBADD): New variable. (libgcj_la_LIBADD): Don't include sax or w3c_dom. (all_java_source_files): javax_imageio_source_files, javax_xml_source_files, and gnu_java_beans_source_files. ($(gnu_xml_source_files:.java=.lo)): Removed target. (gnu-xml.lo): New target. (javax-imageio.lo): Likewise. (javax-xml.lo): Likewise. (gnu-java-beans.lo): Likewise. (gnu_java_beans_source_files): New variable. (javax_imageio_source_files): Likewise. (javax_xml_source_files): Likewise. (javax_source_files): Moved files to other variable. (awt_java_source_files): Likewise. (ordinary_java_source_files): Added BootClassLoader.java. * java/lang/natVMClassLoader.cc (defineClass): Use boot loader, not system class loader. (initBootLoader): New method. (loadClass): Search bootLoader. * java/lang/natClassLoader.cc (_Jv_RegisterInitiatingLoader): Use boot loader, not system class loader. (_Jv_UnregisterInitiatingLoader): Likewise. (_Jv_FindClass): Likewise. Ensure entries in bootstrap_class_list are unique. * java/lang/natClass.cc (getClassLoader): Don't special case system class loader. * java/lang/VMClassLoader.java (bootLoader): New field. (getResource): Use bootLoader. (getResources): Likewise. (initBootLoader): Declare. * gnu/gcj/runtime/BootClassLoader.java: New file. * external/sax/org/xml/sax/helpers/NamespaceSupport.java (EMPTY_ENUMERATION): Now package-private. * external/w3c_com/Makefile.in: Rebuilt. * external/w3c_com/Makefile.am (MULTIBUILDTOP): New variable. (w3c.jar): New target. (classes.stamp): Updated. (toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES. Changed name of library. (libw3c_gcj_la_SOURCES): New variable. (libw3c_gcj_la_GCJFLAGS): Likewise. (source_files): Renamed from lib3c_convenience_la_SOURCES. * external/sax/Makefile.in: Rebuilt. * external/sax/Makefile.am (MULTIBUILDTOP): New variable. (sax.jar): New target. (classes.stamp): Updated. (toolexeclib_LTLIBRARIES): Renamed from noinst_LTLIBRARIES. Changed name of library. (libsax_gcj_la_SOURCES): New variable. (libsax_gcj_la_GCJFLAGS): Likewise. (source_files): Renamed from libsax_convenience_la_SOURCES. * stacktrace.cc (non_system_trace_fn): Don't look at system class loader. * prims.cc (_Jv_CreateJavaVM): Initialize the bootstrap class loader. (_Jv_RunMain): Handle case where 'runtime' is NULL at exit. From-SVN: r96960
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
/* Copyright (C) 2005 Free Software Foundation
|
||||
|
||||
This file is part of libgcj.
|
||||
|
||||
This software is copyrighted work licensed under the terms of the
|
||||
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
|
||||
details. */
|
||||
|
||||
package gnu.gcj.runtime;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashSet;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
/**
|
||||
* This is a helper for the bootstrap class loader. It is a
|
||||
* URLClassLoader so that we can read a class path and re-use all the
|
||||
* existing code for finding classes, extracting them from jars, etc.
|
||||
* However, it is never called the way that an ordinary ClassLoader is
|
||||
* called. For instance, loadClass() is never used.
|
||||
*/
|
||||
public final class BootClassLoader extends URLClassLoader
|
||||
{
|
||||
BootClassLoader(String libdir)
|
||||
{
|
||||
super(new URL[0]);
|
||||
|
||||
// Add the contents of the endorsed directories.
|
||||
StringTokenizer st
|
||||
= new StringTokenizer (System.getProperty ("java.endorsed.dirs", ""),
|
||||
File.pathSeparator);
|
||||
try
|
||||
{
|
||||
while (st.hasMoreElements ())
|
||||
{
|
||||
String dirname = st.nextToken ();
|
||||
File dir = new File (dirname);
|
||||
if (dir.exists ())
|
||||
{
|
||||
if (! dirname.endsWith (File.separator))
|
||||
dirname = dirname + File.separator;
|
||||
String files[] = dir.list (new FilenameFilter ()
|
||||
{
|
||||
public boolean accept (File dir, String name)
|
||||
{
|
||||
return name.endsWith (".jar") || name.endsWith (".zip");
|
||||
}
|
||||
});
|
||||
for (int i = files.length - 1; i >= 0; i--)
|
||||
addURL(new URL("file", "", -1, dirname + files[i]));
|
||||
}
|
||||
}
|
||||
|
||||
String w3clib = (libdir + File.separator
|
||||
+ System.mapLibraryName ("w3c-gcj"));
|
||||
addURL(new URL("gcjlib", "", -1, w3clib));
|
||||
String saxlib = (libdir + File.separator
|
||||
+ System.mapLibraryName ("sax-gcj"));
|
||||
addURL(new URL("gcjlib", "", -1, saxlib));
|
||||
}
|
||||
catch (java.net.MalformedURLException x)
|
||||
{
|
||||
// This should never happen.
|
||||
throw new RuntimeException(x);
|
||||
}
|
||||
}
|
||||
|
||||
public Class bootLoadClass(String name)
|
||||
throws ClassNotFoundException
|
||||
{
|
||||
Class c = findLoadedClass(name);
|
||||
if (c == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
// We could hack URLClassLoader to make this more
|
||||
// efficient, if it mattered.
|
||||
c = findClass(name);
|
||||
}
|
||||
catch (ClassNotFoundException _)
|
||||
{
|
||||
c = null;
|
||||
}
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
public URL bootGetResource(String name)
|
||||
{
|
||||
return findResource(name);
|
||||
}
|
||||
|
||||
public Enumeration bootGetResources(String name) throws IOException
|
||||
{
|
||||
return findResources(name);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user