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: reflection fixlets


I'm checking this in.  It fixes a couple formatting bugs in toString()
implementations in java.lang.reflect.

(Oops, I accidentally checked it in already with my last commit.  Here
it is anyway.)

2000-08-07  Tom Tromey  <tromey@cygnus.com>

	* java/lang/reflect/Method.java (toString): Use Class.getName, not
	Class.toString.
	* java/lang/reflect/Field.java (toString): Correct formatting.
	From Corey Minyard.

Tom

Index: Field.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/Field.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Field.java	2000/03/07 19:55:27	1.3
+++ Field.java	2000/08/07 19:59:48	1.4
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000  Free Software Foundation
 
    This file is part of libgcj.
 
@@ -253,10 +253,13 @@
     StringBuffer sbuf = new StringBuffer ();
     int mods = getModifiers();
     if (mods != 0)
-      Modifier.toString(mods, sbuf);
+      {
+	Modifier.toString(mods, sbuf);
+	sbuf.append(' ');
+      }
     sbuf.append(getType());
     sbuf.append(' ');
-    sbuf.append(getDeclaringClass());
+    sbuf.append(getDeclaringClass().getName());
     sbuf.append('.');
     sbuf.append(getName());
     return sbuf.toString();
Index: Method.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/lang/reflect/Method.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- Method.java	2000/03/07 19:55:27	1.7
+++ Method.java	2000/08/07 19:59:48	1.8
@@ -78,17 +78,17 @@
 	getType ();
 
       StringBuffer b = new StringBuffer ();
-      b.append(Modifier.toString(getModifiers()));
+      Modifier.toString(getModifiers(), b);
       b.append(" ");
       b.append(return_type.toString());
       b.append(" ");
-      b.append(declaringClass.toString());
+      b.append(declaringClass.getName());
       b.append(".");
       b.append(name);
       b.append("(");
       for (int i = 0; i < parameter_types.length; ++i)
 	{
-	  b.append(parameter_types[i].toString());
+	  b.append(parameter_types[i].getName());
 	  if (i < parameter_types.length - 1)
 	    b.append(",");
 	}
@@ -98,7 +98,7 @@
 	  b.append(" throws ");
 	  for (int i = 0; i < exception_types.length; ++i)
 	    {
-	      b.append(exception_types[i].toString());
+	      b.append(exception_types[i].getName());
 	      if (i < exception_types.length - 1)
 		b.append(",");
 	    }

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