bug in java::lang::Class::getDeclaredMethods

Per Bothner per@bothner.com
Tue Dec 21 17:13:00 GMT 1999


This is rather strange. I made another attempt to run Kawa using
gij. It crashed because the offset in a java.lang.reflect.Method
was wrong. Sure enough, Class::getDeclaredMethod is setting
the offset to the method's offset in the *result* array, which
makes no sense. Instead, the offset should be the offset of
the corresponding _Jv_Method in the declaringClass's `methods' array:
Index: natClass.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/natClass.cc,v
retrieving revision 1.8
diff -u -r1.8 natClass.cc
--- natClass.cc	1999年11月18日 07:19:00	1.8
+++ natClass.cc	1999年12月22日 01:03:29
@@ -219,7 +219,7 @@
 	 || _Jv_equalUtf8Consts (method->name, init_name))
 	continue;
 java::lang::reflect::Method* rmethod = new java::lang::reflect::Method ();
- rmethod->offset = (char*) mptr - (char*) elements (result);
+ rmethod->offset = (char*) method - (char*) methods;
 rmethod->declaringClass = this;
 *mptr++ = rmethod;
 }
The problem is it looks like the fix causes gij to crash *earlier*
than it did without the fix! Either my fix is wrong, or there is
some *other* bug which depends on this bug in getDeclaredMethods!
Any ideas?
-- 
	--Per Bothner
per@bothner.com http://www.bothner.com/~per/


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /