summaryrefslogtreecommitdiff
path: root/libjava/java/lang/reflect
diff options
context:
space:
mode:
authoraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-17 15:13:44 +0000
committeraph <aph@138bc75d-0d04-0410-961f-82ee72b054a4>2004-12-17 15:13:44 +0000
commit34ac03a9d40cb9f1cffd7f99fe1b2c520cc0c162 (patch)
tree4ec6af89798d7c2aedf38df69842202141f35b02 /libjava/java/lang/reflect
parentcc1a5185c7d9f249a5026abe7c40d91a05651e6a (diff)
downloadgcc-34ac03a9d40cb9f1cffd7f99fe1b2c520cc0c162.tar.gz
2004-12-10 Andrew Haley <aph@redhat.com>
PR java/15001 * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Look up abstract methods by name. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92315 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/java/lang/reflect')
-rw-r--r--libjava/java/lang/reflect/natMethod.cc23
1 files changed, 22 insertions, 1 deletions
diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc
index b194067300b..b4b3a7a9b06 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);