This is the mail archive of the java-patches@sources.redhat.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: Method.toString fixes


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,
 			     &parameter_types,
 			     &return_type);
+
+  // FIXME: for now we have no way to get exception information.
+  exception_types = (JArray<jclass> *) JvNewObjectArray (0, &ClassClass,
+							 NULL);
 }
 
 void

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]