bytearray.java: New file.
2005-04-06 Andrew Haley <aph@redhat.com> * testsuite/libjava.lang/bytearray.java: New file. * testsuite/libjava.lang/bytearray.out: New file. * java/lang/ClassLoader.java (loadClassFromSig): Declare (loadClass): Use it. * java/lang/natClassLoader.cc (loadClassFromSig): New method. From-SVN: r97756
This commit is contained in:
parent
3425638af5
commit
58bf803e6c
|
@ -1,3 +1,11 @@
|
||||||
|
2005-04-06 Andrew Haley <aph@redhat.com>
|
||||||
|
|
||||||
|
* testsuite/libjava.lang/bytearray.java: New file.
|
||||||
|
* testsuite/libjava.lang/bytearray.out: New file.
|
||||||
|
* java/lang/ClassLoader.java (loadClassFromSig): Declare
|
||||||
|
(loadClass): Use it.
|
||||||
|
* java/lang/natClassLoader.cc (loadClassFromSig): New method.
|
||||||
|
|
||||||
2005-04-06 Mohan Embar <gnustuff@thisiscool.com>
|
2005-04-06 Mohan Embar <gnustuff@thisiscool.com>
|
||||||
|
|
||||||
* Makefile.am ($(db_name)): Add $(EXEEXT) suffix to
|
* Makefile.am ($(db_name)): Add $(EXEEXT) suffix to
|
||||||
|
|
|
@ -260,6 +260,9 @@ public abstract class ClassLoader
|
||||||
return loadClass(name, false);
|
return loadClass(name, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native Class loadClassFromSig(String name)
|
||||||
|
throws ClassNotFoundException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load a class using this ClassLoader or its parent, possibly resolving
|
* Load a class using this ClassLoader or its parent, possibly resolving
|
||||||
* it as well using <code>resolveClass()</code>. It first tries to find
|
* it as well using <code>resolveClass()</code>. It first tries to find
|
||||||
|
@ -283,29 +286,36 @@ public abstract class ClassLoader
|
||||||
protected synchronized Class loadClass(String name, boolean resolve)
|
protected synchronized Class loadClass(String name, boolean resolve)
|
||||||
throws ClassNotFoundException
|
throws ClassNotFoundException
|
||||||
{
|
{
|
||||||
// Have we already loaded this class?
|
// Arrays are handled specially.
|
||||||
Class c = findLoadedClass(name);
|
Class c;
|
||||||
if (c == null)
|
if (name.charAt(0) == '[')
|
||||||
|
c = loadClassFromSig(name);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
// Can the class be loaded by a parent?
|
// Have we already loaded this class?
|
||||||
try
|
c = findLoadedClass(name);
|
||||||
|
if (c == null)
|
||||||
{
|
{
|
||||||
if (parent == null)
|
// Can the class be loaded by a parent?
|
||||||
|
try
|
||||||
{
|
{
|
||||||
c = VMClassLoader.loadClass(name, resolve);
|
if (parent == null)
|
||||||
if (c != null)
|
{
|
||||||
return c;
|
c = VMClassLoader.loadClass(name, resolve);
|
||||||
|
if (c != null)
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return parent.loadClass(name, resolve);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
catch (ClassNotFoundException e)
|
||||||
{
|
{
|
||||||
return parent.loadClass(name, resolve);
|
|
||||||
}
|
}
|
||||||
|
// Still not found, we have to do it ourself.
|
||||||
|
c = findClass(name);
|
||||||
}
|
}
|
||||||
catch (ClassNotFoundException e)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
// Still not found, we have to do it ourself.
|
|
||||||
c = findClass(name);
|
|
||||||
}
|
}
|
||||||
if (resolve)
|
if (resolve)
|
||||||
resolveClass(c);
|
resolveClass(c);
|
||||||
|
|
|
@ -63,6 +63,17 @@ static jclass bootstrap_class_list[BOOTSTRAP_CLASS_LIST_SIZE];
|
||||||
static int bootstrap_index;
|
static int bootstrap_index;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
jclass
|
||||||
|
java::lang::ClassLoader::loadClassFromSig(jstring name)
|
||||||
|
{
|
||||||
|
int len = _Jv_GetStringUTFLength (name);
|
||||||
|
char sig[len + 1];
|
||||||
|
_Jv_GetStringUTFRegion (name, 0, name->length(), sig);
|
||||||
|
return _Jv_FindClassFromSignature(sig, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This tries to find a class in our built-in cache. This cache is
|
// This tries to find a class in our built-in cache. This cache is
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
public class bytearray
|
||||||
|
{
|
||||||
|
public static void main (String[] argv) throws Throwable {
|
||||||
|
Class c = Class.forName ("[Ljava.lang.String;");
|
||||||
|
c = Class.forName ("[B");
|
||||||
|
System.out.println (c);
|
||||||
|
c = ClassLoader.getSystemClassLoader().loadClass ("[[Ljava.lang.String;");
|
||||||
|
System.out.println (c);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,2 @@
|
||||||
|
class [B
|
||||||
|
class [[Ljava.lang.String;
|
Loading…
Reference in New Issue