natClassLoader.cc (_Jv_PrepareCompiledClass): Renamed from _Jv_InternClassStrings.
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Renamed from _Jv_InternClassStrings. * prims.cc (_Jv_RunMain): New function. (JvRunMain): Remove gij-support. * gij.cc (main): Use _Jv_RunMain. * java/util/zip/ZipFile.java: Call readDirectory in constructor. * interpret.cc (PUSHA, PUSHI, PUSHF, PUSHL, PUSHD): Don't store argument in temp variable. (continue1): For all op_x2y insns, use temp variable for intermediate value. Also remove some comments. * java/lang/natClass.cc (newInstance): Call _Jv_InitClass. (forName): Don't call _Jv_InitClass. * java/lang/Class.java (getResource,getResourceAsStream): Implement. * java/util/zip/ZipEntry.java (ZipEntry(ZipEntry)): New construcor. * java/util/jar/JarInputStream.java: New file. * java/util/jar/JarEntry.java: New file. * java/util/jar/JarFile.java: New file. * java/net/URLClassLoader.java: New file. * java/net/JarURLConnection.java: New file. * gnu/gcj/protocol/jar/Handler.java: New file. * gnu/gcj/protocol/jar/Connection.java: New file. * java/security/SecureClassLoader.java: New file. * java/lang/ClassLoader.java (parent): New variable. (ClassLoader (ClassLoader)): new constructor. (findClass): New method. (loadClass): Add default 1.2 implementation. (getSystemResourceAsBytes, getResourceAsBytes): Removed. (readfully): Removed. * gnu/gcj/runtime/VMClassLoader.java: Moved from java/lang. (findSystemClass): New method. (VMClassLoader): Constructor rewritten. (init): New method. All other methods removed. * java/lang/natClassLoader.cc: Change use of java::lang::VMClassLoader to gnu::gcj::runtime::VMClassLoader. (_Jv_InternClassStrings): Use _Jv_ResolvePoolEntry. Also handle class entries. (VMClassLoader::findSystemClass): renamed from findBootClass. * Makefile.am: Add new files. (FirstThread.h, ThreadGroup.h): Add _Jv_Main friend. * Makefile.in: Rebuilt. From-SVN: r28748
This commit is contained in:
parent
312f625598
commit
eb4534a636
26 changed files with 2195 additions and 517 deletions
|
@ -80,13 +80,41 @@ public final class Class implements Serializable
|
|||
public native int getModifiers ();
|
||||
public native String getName ();
|
||||
|
||||
// FIXME: can't implement this until we have java.net.
|
||||
// public URL getResource (String resourceName);
|
||||
|
||||
// FIXME: implement.
|
||||
public InputStream getResourceAsStream (String resourceName)
|
||||
public java.net.URL getResource (String resourceName)
|
||||
{
|
||||
return null;
|
||||
String name = resourcePath (resourceName);
|
||||
ClassLoader loader = getClassLoader ();
|
||||
if (loader == null)
|
||||
return ClassLoader.getSystemResource (name);
|
||||
else
|
||||
return loader.getResource (name);
|
||||
}
|
||||
|
||||
public java.io.InputStream getResourceAsStream (String resourceName)
|
||||
{
|
||||
String name = resourcePath (resourceName);
|
||||
ClassLoader loader = getClassLoader ();
|
||||
if (loader == null)
|
||||
return ClassLoader.getSystemResourceAsStream (name);
|
||||
else
|
||||
return loader.getResourceAsStream (name);
|
||||
}
|
||||
|
||||
private String resourcePath (String resourceName)
|
||||
{
|
||||
if (resourceName.startsWith ("/"))
|
||||
return resourceName.substring (1);
|
||||
|
||||
Class c = this;
|
||||
while (c.isArray ())
|
||||
c = c.getComponentType ();
|
||||
|
||||
String packageName = c.getName ().replace ('.', '/');
|
||||
int end = packageName.lastIndexOf ('/');
|
||||
if (end == -1)
|
||||
return resourceName;
|
||||
else
|
||||
return packageName.substring (0, end+1) + resourceName;
|
||||
}
|
||||
|
||||
// FIXME: implement. Requires java.security.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue