prims.cc (_Jv_NewObjectArray): Undo placement change.
2000-11-25 Anthony Green <green@redhat.com> * prims.cc (_Jv_NewObjectArray): Undo placement change. (_Jv_NewPrimArray): Likewise. * gcj/array.h (__JArray): Undo const change. Removed constructor. (class JArray): Removed constructor. * java/lang/Thread.java (context_class_loader): New private data. (getContextClassLoader): New method. (setContextClassLoader): New method. (Thread): Initialize context_class_loader. * java/net/URLClassLoader.java: Import java.util.Enumeration. (getResource): Rename to findResource. (findResource): New method. Used to be getResource. (getResourceAsStream): Deleted. (jarFileize): Extracted logic from URLClassLoader constructor into this new private method. (addURL): New protected method. (URLClassLoader): Call jarFileize. Use addElement instead of insertElementAt. (findResources): New method. * java/lang/ClassLoader.java: Import java.util.Enumeration. (getResource): Implement correct logic. (findResource): New method. (getResources): New method. (findClass): Create a ClassNotFoundException with the name of the class rather than nothing at all. (defineClass) Only throw ClassFormatError. * java/lang/Class.java (forName): New method. * java/lang/Class.h (forName): New method. * java/lang/natClass.cc (forName): New method. From-SVN: r37751
This commit is contained in:
@@ -72,7 +72,7 @@ static _Jv_Utf8Const *finit_leg_name = _Jv_makeUtf8Const ("$finit$", 7);
|
||||
|
||||
|
||||
jclass
|
||||
java::lang::Class::forName (jstring className)
|
||||
java::lang::Class::forName (jstring className, java::lang::ClassLoader *loader)
|
||||
{
|
||||
if (! className)
|
||||
JvThrow (new java::lang::NullPointerException);
|
||||
@@ -85,10 +85,10 @@ java::lang::Class::forName (jstring className)
|
||||
// IllegalArgumentException on failure.
|
||||
_Jv_Utf8Const *name = _Jv_makeUtf8Const (buffer, length);
|
||||
|
||||
// FIXME: should use class loader from calling method.
|
||||
// FIXME: should use bootstrap class loader if loader is null.
|
||||
jclass klass = (buffer[0] == '['
|
||||
? _Jv_FindClassFromSignature (name->data, NULL)
|
||||
: _Jv_FindClass (name, NULL));
|
||||
? _Jv_FindClassFromSignature (name->data, loader)
|
||||
: _Jv_FindClass (name, loader));
|
||||
|
||||
if (klass)
|
||||
_Jv_InitClass (klass);
|
||||
@@ -98,6 +98,13 @@ java::lang::Class::forName (jstring className)
|
||||
return klass;
|
||||
}
|
||||
|
||||
jclass
|
||||
java::lang::Class::forName (jstring className)
|
||||
{
|
||||
// FIXME: should use class loader from calling method.
|
||||
return forName (className, NULL);
|
||||
}
|
||||
|
||||
java::lang::reflect::Constructor *
|
||||
java::lang::Class::getConstructor (JArray<jclass> *param_types)
|
||||
{
|
||||
@@ -608,7 +615,7 @@ java::lang::Class::getMethods (void)
|
||||
return result;
|
||||
}
|
||||
|
||||
jboolean
|
||||
inline jboolean
|
||||
java::lang::Class::isAssignableFrom (jclass klass)
|
||||
{
|
||||
// Arguments may not have been initialized, given ".class" syntax.
|
||||
@@ -899,7 +906,7 @@ _Jv_LookupInterfaceMethodIdx (jclass klass, jclass iface, int method_idx)
|
||||
return cldt->cls.itable[idx];
|
||||
}
|
||||
|
||||
inline jboolean
|
||||
jboolean
|
||||
_Jv_IsAssignableFrom (jclass target, jclass source)
|
||||
{
|
||||
if (target == &ObjectClass
|
||||
|
||||
Reference in New Issue
Block a user