This is the mail archive of the java-patches@gcc.gnu.org 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]
Other format: [Raw text]

FYI: Patch: Method.toString() extra whitespace


Method.toString() inserted an extra " " when printing a package-private method. This patch fixes it.

Bryce.

2003-10-25 Bryce McKinlay <bryce@mckinlay.net.nz>

	* java/lang/reflect/Method.java (toString): Avoid extra whitespace
	on method with no modifiers.

--- java/lang/reflect/Method.java 5 Aug 2003 19:50:54 -0000 1.13
+++ java/lang/reflect/Method.java 25 Oct 2003 06:50:21 -0000
@@ -163,8 +163,12 @@
getType ();


     StringBuffer b = new StringBuffer ();
-    Modifier.toString(getModifiers(), b);
-    b.append(" ");
+    int mods = getModifiers();
+    if (mods != 0)
+      {
+       Modifier.toString(mods, b);
+       b.append(" ");
+      }
     appendClassName (b, return_type);
     b.append(" ");
     appendClassName (b, declaringClass);



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