8008312: Re-enable MethodParameter tests in JDK
authoremc
Tue, 19 Feb 2013 17:09:25 +0000
changeset 16009 c63e8173a808
parent 16008 2734ca906c3e
child 16010 2727163b5df5
8008312: Re-enable MethodParameter tests in JDK Reviewed-by: darcy
jdk/src/share/classes/java/lang/reflect/Parameter.java
jdk/test/java/lang/reflect/Parameter/WithParameters.java
--- a/jdk/src/share/classes/java/lang/reflect/Parameter.java	Tue Feb 19 16:19:09 2013 +0000
+++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java	Tue Feb 19 17:09:25 2013 +0000
@@ -115,7 +115,9 @@
             (type.toString());
 
         sb.append(Modifier.toString(getModifiers()));
-        sb.append(" ");
+
+        if(0 != modifiers)
+            sb.append(" ");
 
         if(isVarArgs())
             sb.append(typename.replaceFirst("\\[\\]$", "..."));
--- a/jdk/test/java/lang/reflect/Parameter/WithParameters.java	Tue Feb 19 16:19:09 2013 +0000
+++ b/jdk/test/java/lang/reflect/Parameter/WithParameters.java	Tue Feb 19 17:09:25 2013 +0000
@@ -22,7 +22,6 @@
  */
 
 /*
- * @ignore
  * @test
  * @compile -parameters WithParameters.java
  * @run main WithParameters
@@ -85,8 +84,8 @@
                         error++;
                     }
                 }
-                if(parameters[0].toString().equals("int quux")) {
-                    System.err.println("toString for quux is wrong");
+                if(!parameters[0].toString().equals("final int quux")) {
+                    System.err.println("toString for quux is wrong, expected \"final int quux\", got \"" + parameters[0] + "\"");
                     error++;
                 }
                 if(parameters[0].getModifiers() != Modifier.FINAL) {
@@ -101,8 +100,8 @@
                     System.err.println("getParameterizedType for quux is wrong");
                     error++;
                 }
-                if(parameters[1].toString().equals("WithParameters$Foo quuux")) {
-                    System.err.println("toString for quuux is wrong");
+                if(!parameters[1].toString().equals("WithParameters$Foo quuux")) {
+                    System.err.println("toString for quuux is wrong, expected \"WithParameters$Foo quuux\", got \"" + parameters[1] + "\"");
                     error++;
                 }
                 if(parameters[1].isVarArgs()) {
@@ -121,8 +120,8 @@
                     System.err.println("getAnnotations has the wrong annotation");
                     error++;
                 }
-                if(parameters[2].toString().equals("java.util.List<?> quuux")) {
-                    System.err.println("toString for l is wrong");
+                if(!parameters[2].toString().equals("java.util.List<?> l")) {
+                    System.err.println("toString for l is wrong, expected \"java.util.List<?> l\", got \"" + parameters[2] + "\"");
                     error++;
                 }
                 if(parameters[2].isVarArgs()) {
@@ -149,8 +148,8 @@
                         error++;
                     }
                 }
-                if(parameters[3].toString().equals("java.util.List<WithParameters$Foo> l")) {
-                    System.err.println("toString for l2 is wrong");
+                if(!parameters[3].toString().equals("java.util.List<WithParameters$Foo> l2")) {
+                    System.err.println("toString for l2 is wrong, expected \"java.util.List<WithParameters$Foo> l2\", got \"" + parameters[3] + "\"");
                     error++;
                 }
                 if(parameters[3].isVarArgs()) {
@@ -177,8 +176,8 @@
                         error++;
                     }
                 }
-                if(parameters[4].toString().equals("java.util.List<? extends WithParameters$Foo> l")) {
-                    System.err.println("toString for l3 is wrong");
+                if(!parameters[4].toString().equals("java.util.List<? extends WithParameters$Foo> l3")) {
+                    System.err.println("toString for l3 is wrong, expected \"java.util.List<? extends WithParameters$Foo> l3\", got \"" + parameters[3] + "\"");
                     error++;
                 }
                 if(parameters[4].isVarArgs()) {
@@ -212,8 +211,8 @@
                         }
                     }
                 }
-                if(parameters[5].toString().equals("java.lang.String... rest")) {
-                    System.err.println("toString for l is wrong");
+                if(!parameters[5].toString().equals("java.lang.String... rest")) {
+                    System.err.println("toString for rest is wrong, expected \"java.lang.String... rest\", got \"" + parameters[5] + "\"");
                     error++;
                 }
                 if(!parameters[5].isVarArgs()) {