Commit 7666af89 by Tom Tromey Committed by Tom Tromey

Class.java (getClasses): New method.

	* java/lang/Class.java (getClasses): New method.
	(internalGetClasses): Likewise.
	(getClassLoader): Updated documentation.
	(getDeclaredClasses): New overload; old overload no longer
	native.
	(_getConstructors): Removed.
	(resourcePath): Updated.
	* java/lang/natClass.cc (getClasses): Removed.
	* java/lang/Class.h (getDeclaredClasses, getDeclaredConstructors):
	Updated.
	(_getConstructors): Removed.

From-SVN: r100948
parent c9a3d128
2005-06-14 Tom Tromey <tromey@redhat.com>
* java/lang/Class.java (getClasses): New method.
(internalGetClasses): Likewise.
(getClassLoader): Updated documentation.
(getDeclaredClasses): New overload; old overload no longer
native.
(_getConstructors): Removed.
(resourcePath): Updated.
* java/lang/natClass.cc (getClasses): Removed.
* java/lang/Class.h (getDeclaredClasses, getDeclaredConstructors):
Updated.
(_getConstructors): Removed.
2005-06-13 Jim Huang <jserv@kaffe.org>
PR libgcj/22036:
......
......@@ -273,7 +273,7 @@ public:
java::lang::reflect::Constructor *getConstructor (JArray<jclass> *);
JArray<java::lang::reflect::Constructor *> *getConstructors (void);
java::lang::reflect::Constructor *getDeclaredConstructor (JArray<jclass> *);
JArray<java::lang::reflect::Constructor *> *getDeclaredConstructors (void);
JArray<java::lang::reflect::Constructor *> *getDeclaredConstructors (jboolean);
java::lang::reflect::Field *getDeclaredField (jstring);
JArray<java::lang::reflect::Field *> *getDeclaredFields ();
JArray<java::lang::reflect::Field *> *getDeclaredFields (jboolean);
......@@ -281,12 +281,12 @@ public:
JArray<java::lang::reflect::Method *> *getDeclaredMethods (void);
JArray<jclass> *getDeclaredClasses (void);
JArray<jclass> *getDeclaredClasses (jboolean);
jclass getDeclaringClass (void);
java::lang::reflect::Field *getField (jstring);
private:
JArray<java::lang::reflect::Field *> internalGetFields ();
JArray<java::lang::reflect::Constructor *> *_getConstructors (jboolean);
java::lang::reflect::Field *getField (jstring, jint);
jint _getMethods (JArray<java::lang::reflect::Method *> *result,
jint offset);
......
......@@ -126,15 +126,6 @@ java::lang::Class::getClassLoader (void)
s->checkPermission (new RuntimePermission (JvNewStringLatin1 ("getClassLoader")));
}
// This particular 'return' has been changed a couple of times over
// libgcj's history. This particular approach is a little weird,
// because it means that all classes linked into the application
// will see NULL for their class loader. This may confuse some
// applications that aren't expecting this; the solution is to use a
// different linking model for these applications. In the past we
// returned the system class loader in this case, but that is
// incorrect. Also, back then we didn't have other linkage models
// to fall back on.
return loader;
}
......@@ -167,10 +158,8 @@ java::lang::Class::getConstructor (JArray<jclass> *param_types)
}
JArray<java::lang::reflect::Constructor *> *
java::lang::Class::_getConstructors (jboolean declared)
java::lang::Class::getDeclaredConstructors (jboolean publicOnly)
{
memberAccessCheck(java::lang::reflect::Member::PUBLIC);
int numConstructors = 0;
int max = isPrimitive () ? 0 : method_count;
int i;
......@@ -180,7 +169,7 @@ java::lang::Class::_getConstructors (jboolean declared)
if (method->name == NULL
|| ! _Jv_equalUtf8Consts (method->name, init_name))
continue;
if (! declared
if (publicOnly
&& ! java::lang::reflect::Modifier::isPublic(method->accflags))
continue;
numConstructors++;
......@@ -197,7 +186,7 @@ java::lang::Class::_getConstructors (jboolean declared)
if (method->name == NULL
|| ! _Jv_equalUtf8Consts (method->name, init_name))
continue;
if (! declared
if (publicOnly
&& ! java::lang::reflect::Modifier::isPublic(method->accflags))
continue;
java::lang::reflect::Constructor *cons
......@@ -427,22 +416,8 @@ java::lang::Class::getName (void)
}
JArray<jclass> *
java::lang::Class::getClasses (void)
{
// FIXME: security checking.
// Until we have inner classes, it always makes sense to return an
// empty array.
JArray<jclass> *result
= (JArray<jclass> *) JvNewObjectArray (0, &java::lang::Class::class$,
NULL);
return result;
}
JArray<jclass> *
java::lang::Class::getDeclaredClasses (void)
java::lang::Class::getDeclaredClasses (jboolean /*publicOnly*/)
{
memberAccessCheck (java::lang::reflect::Member::DECLARED);
// Until we have inner classes, it always makes sense to return an
// empty array.
JArray<jclass> *result
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment