From 79afcdfe19be21cea03d0f20ae60157660563afb Mon Sep 17 00:00:00 2001 From: aph Date: Thu, 26 Feb 2004 15:22:20 +0000 Subject: [PATCH] 2004-02-25 Andrew Haley PR java/14296: * java/lang/reflect/natMethod.cc (_Jv_CallAnyMethodA): Make sure we have a valid method index. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@78504 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/java/lang/reflect/natMethod.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libjava/java/lang/reflect/natMethod.cc b/libjava/java/lang/reflect/natMethod.cc index ed122ea..736103b 100644 --- a/libjava/java/lang/reflect/natMethod.cc +++ b/libjava/java/lang/reflect/natMethod.cc @@ -466,7 +466,16 @@ _Jv_CallAnyMethodA (jobject obj, void *ncode; - if (is_virtual_call && ! Modifier::isFinal (meth->accflags)) + // FIXME: If a vtable index is -1 at this point it is invalid, so we + // have to use the ncode. + // + // This can happen because methods in final classes don't have + // vtable entries, but _Jv_isVirtualMethod() doesn't know that. We + // could solve this problem by allocating a vtable index for methods + // in final classes. + if (is_virtual_call + && ! Modifier::isFinal (meth->accflags) + && (_Jv_ushort)-1 != meth->index) { _Jv_VTable *vtable = *(_Jv_VTable **) obj; ncode = vtable->get_method (meth->index); -- 2.7.4