aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/lang/reflect
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2007-04-02 16:36:52 +0000
committerAndrew Haley <aph@gcc.gnu.org>2007-04-02 16:36:52 +0000
commita0036853d2b6260c0a322da8d411dcebd3ac4f9e (patch)
tree826918a6ab1985e623a1617586fc734818568de0 /libjava/java/lang/reflect
parente6c45b1e3435efa993309f69654ac5411327d755 (diff)
downloadgcc-a0036853d2b6260c0a322da8d411dcebd3ac4f9e.zip
gcc-a0036853d2b6260c0a322da8d411dcebd3ac4f9e.tar.gz
gcc-a0036853d2b6260c0a322da8d411dcebd3ac4f9e.tar.bz2
natVMProxy.cc (run_proxy): Use _Jv_LookupProxyMethod to find the Method.
2007-04-02 Andrew Haley <aph@redhat.com> * java/lang/reflect/natVMProxy.cc (run_proxy): Use _Jv_LookupProxyMethod to find the Method. If parameter_types->length == 0, pass a null paramameter list, not a zero-length parameter list. * java/lang/natClass.cc (_Jv_LookupProxyMethod): New function. * java/lang/Class.h (_Jv_LookupProxyMethod): Declare. From-SVN: r123431
Diffstat (limited to 'libjava/java/lang/reflect')
-rw-r--r--libjava/java/lang/reflect/Method.h2
-rw-r--r--libjava/java/lang/reflect/natVMProxy.cc21
2 files changed, 16 insertions, 7 deletions
diff --git a/libjava/java/lang/reflect/Method.h b/libjava/java/lang/reflect/Method.h
index 8a843d5..17056c1 100644
--- a/libjava/java/lang/reflect/Method.h
+++ b/libjava/java/lang/reflect/Method.h
@@ -13,6 +13,7 @@
jmethodID _Jv_FromReflectedMethod (java::lang::reflect::Method *);
jobject _Jv_JNI_ToReflectedMethod (_Jv_JNIEnv *, jclass, jmethodID, jboolean);
::java::lang::reflect::Method *_Jv_GetReflectedMethod (jclass, _Jv_Utf8Const*, _Jv_Utf8Const*);
+::java::lang::reflect::Method *_Jv_LookupProxyMethod (jclass, _Jv_Utf8Const *, _Jv_Utf8Const *);
class java::lang::reflect::Method : public ::java::lang::reflect::AccessibleObject
{
@@ -79,6 +80,7 @@ public:
friend class java::lang::Class;
friend class java::io::ObjectInputStream;
friend java::lang::reflect::Method* ::_Jv_GetReflectedMethod (jclass, _Jv_Utf8Const*, _Jv_Utf8Const*);
+ friend java::lang::reflect::Method* ::_Jv_LookupProxyMethod (jclass, _Jv_Utf8Const *, _Jv_Utf8Const *);
};
#endif // __java_lang_reflect_Method__
diff --git a/libjava/java/lang/reflect/natVMProxy.cc b/libjava/java/lang/reflect/natVMProxy.cc
index 5704049..f0191760 100644
--- a/libjava/java/lang/reflect/natVMProxy.cc
+++ b/libjava/java/lang/reflect/natVMProxy.cc
@@ -301,6 +301,8 @@ run_proxy (ffi_cif *cif,
void **args,
void*user_data)
{
+ using namespace java::lang::reflect;
+
Proxy *proxy = *(Proxy**)args[0];
ncode_closure *self = (ncode_closure *) user_data;
@@ -312,17 +314,22 @@ run_proxy (ffi_cif *cif,
Thread *thread = Thread::currentThread();
_Jv_InterpFrame frame_desc (self->self, thread, proxy->getClass());
- Method *meth = _Jv_GetReflectedMethod (proxy->getClass(),
- self->self->name,
- self->self->signature);
+ Method *meth = _Jv_LookupProxyMethod (proxy->getClass(),
+ self->self->name,
+ self->self->signature);
JArray<jclass> *parameter_types = meth->internalGetParameterTypes ();
JArray<jclass> *exception_types = meth->internalGetExceptionTypes ();
InvocationHandler *handler = proxy->h;
- void *poo
- = _Jv_NewObjectArray (parameter_types->length, &Object::class$, NULL);
- JArray<jobject> *argsArray = (JArray<jobject> *) poo;
- jobject *jargs = elements(argsArray);
+ JArray<jobject> *argsArray = NULL;
+ jobject *jargs = NULL;
+ if (parameter_types->length)
+ {
+ void *poo
+ = _Jv_NewObjectArray (parameter_types->length, &Object::class$, NULL);
+ argsArray = (JArray<jobject> *) poo;
+ jargs = elements(argsArray);
+ }
// FIXME: It must be possible to use fast interface dispatch here,
// but I've not quite figured out how to do it.