diff options
author | Andrew Haley <aph@redhat.com> | 2004-12-17 15:13:44 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2004-12-17 15:13:44 +0000 |
commit | 64d200483a9bb5597dd435c0206e052cf04a3b4c (patch) | |
tree | 4ec6af89798d7c2aedf38df69842202141f35b02 /libjava | |
parent | cd5fcd336698c4a9acaf5ec42c2444b3d432aaf2 (diff) | |
download | gcc-64d200483a9bb5597dd435c0206e052cf04a3b4c.zip gcc-64d200483a9bb5597dd435c0206e052cf04a3b4c.tar.gz gcc-64d200483a9bb5597dd435c0206e052cf04a3b4c.tar.bz2 |
re PR libgcj/15001 ([3.4 only] Using JNI with interpreter and interface methods yields SIGSEGV)
2004-12-10 Andrew Haley <aph@redhat.com>
PR java/15001
* java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Look up
abstract methods by name.
From-SVN: r92315
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 6 | ||||
-rw-r--r-- | libjava/java/lang/reflect/natMethod.cc | 23 |
2 files changed, 28 insertions, 1 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index f91dd13..9273fc9 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,9 @@ +2004-12-10 Andrew Haley <aph@redhat.com> + + PR java/15001 + * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Look up + abstract methods by name. + 2004-12-08 Ranjit Mathew <rmathew@hotmail.com> * java/util/IdentityHashMap.java (put): Replace mistaken use diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc index b194067..b4b3a7a 100644 --- a/libjava/java/lang/reflect/natMethod.cc +++ b/libjava/java/lang/reflect/natMethod.cc @@ -30,6 +30,7 @@ details. */ #include <java/lang/Double.h> #include <java/lang/IllegalAccessException.h> #include <java/lang/IllegalArgumentException.h> +#include <java/lang/IncompatibleClassChangeError.h> #include <java/lang/NullPointerException.h> #include <java/lang/ArrayIndexOutOfBoundsException.h> #include <java/lang/VirtualMachineError.h> @@ -480,7 +481,27 @@ _Jv_CallAnyMethodA (jobject obj, { _Jv_VTable *vtable = *(_Jv_VTable **) obj; if (iface == NULL) - ncode = vtable->get_method (meth->index); + { + if (is_jni_call && Modifier::isAbstract (meth->accflags)) + { + // With JNI we don't know if this is an interface call + // or a call to an abstract method. Look up the method + // by name, the slow way. + _Jv_Method *concrete_meth + = _Jv_LookupDeclaredMethod (vtable->clas, + meth->name, + meth->signature, + NULL); + if (concrete_meth == NULL + || concrete_meth->ncode == NULL + || Modifier::isAbstract(concrete_meth->accflags)) + throw new java::lang::IncompatibleClassChangeError + (_Jv_GetMethodString (vtable->clas, meth->name)); + ncode = concrete_meth->ncode; + } + else + ncode = vtable->get_method (meth->index); + } else ncode = _Jv_LookupInterfaceMethodIdx (vtable->clas, iface, meth->index); |