This is the mail archive of the
java-patches@sources.redhat.com
mailing list for the Java project.
Patch: Method.toString fixes
- To: Java Patch List <java-patches at sourceware dot cygnus dot com>
- Subject: Patch: Method.toString fixes
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 07 Aug 2000 21:40:15 -0600
- Reply-To: tromey at cygnus dot com
I'm checking this in. It fixes some long-standing bugs in
java.lang.reflect.Method. Without this patch libgcj fails the (new)
Mauve Method.toString test.
I've submitted a PR so that we'll remember to someday add exception
information to the reflection data.
2000-08-07 Tom Tromey <tromey@cygnus.com>
* java/lang/reflect/Method.java (hashCode): Use getName().
(toString): Likewise.
* java/lang/reflect/natMethod.cc (getType): Initialize
exception_types.
Tom
Index: java/lang/reflect/Method.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/Method.java,v
retrieving revision 1.8
diff -u -r1.8 Method.java
--- Method.java 2000/08/07 19:59:48 1.8
+++ Method.java 2000/08/08 03:08:23
@@ -65,7 +65,7 @@
public int hashCode ()
{
// FIXME.
- return name.hashCode() + declaringClass.getName().hashCode();
+ return getName().hashCode() + declaringClass.getName().hashCode();
}
public native Object invoke (Object obj, Object[] args)
@@ -84,7 +84,7 @@
b.append(" ");
b.append(declaringClass.getName());
b.append(".");
- b.append(name);
+ b.append(getName());
b.append("(");
for (int i = 0; i < parameter_types.length; ++i)
{
Index: java/lang/reflect/natMethod.cc
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/natMethod.cc,v
retrieving revision 1.13
diff -u -r1.13 natMethod.cc
--- natMethod.cc 2000/08/02 03:25:13 1.13
+++ natMethod.cc 2000/08/08 03:08:23
@@ -203,6 +203,10 @@
declaringClass,
¶meter_types,
&return_type);
+
+ // FIXME: for now we have no way to get exception information.
+ exception_types = (JArray<jclass> *) JvNewObjectArray (0, &ClassClass,
+ NULL);
}
void