This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
bug in java::lang::Class::getDeclaredMethods
- To: java-discuss at sourceware dot cygnus dot com
- Subject: bug in java::lang::Class::getDeclaredMethods
- From: Per Bothner <per at bothner dot com>
- Date: 21 Dec 1999 17:13:40 -0800
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/