From 78fe727c6d75fdb4de25144dbaaa25cbc9b43e81 Mon Sep 17 00:00:00 2001 From: Eric McCorkle Date: Tue, 19 Feb 2013 17:09:25 +0000 Subject: [PATCH] 8008312: Re-enable MethodParameter tests in JDK Reviewed-by: darcy --- .../classes/java/lang/reflect/Parameter.java | 4 ++- .../reflect/Parameter/WithParameters.java | 25 +++++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/jdk/src/share/classes/java/lang/reflect/Parameter.java b/jdk/src/share/classes/java/lang/reflect/Parameter.java index 9c808310c0c..e479bfd9326 100644 --- a/jdk/src/share/classes/java/lang/reflect/Parameter.java +++ b/jdk/src/share/classes/java/lang/reflect/Parameter.java @@ -115,7 +115,9 @@ public final class Parameter implements AnnotatedElement { (type.toString()); sb.append(Modifier.toString(getModifiers())); - sb.append(" "); + + if(0 != modifiers) + sb.append(" "); if(isVarArgs()) sb.append(typename.replaceFirst("\\[\\]$", "...")); diff --git a/jdk/test/java/lang/reflect/Parameter/WithParameters.java b/jdk/test/java/lang/reflect/Parameter/WithParameters.java index c4ffec6de30..bddebf1c782 100644 --- a/jdk/test/java/lang/reflect/Parameter/WithParameters.java +++ b/jdk/test/java/lang/reflect/Parameter/WithParameters.java @@ -22,7 +22,6 @@ */ /* - * @ignore * @test * @compile -parameters WithParameters.java * @run main WithParameters @@ -85,8 +84,8 @@ public class WithParameters { 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 @@ public class WithParameters { 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 @@ public class WithParameters { 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 @@ public class WithParameters { error++; } } - if(parameters[3].toString().equals("java.util.List l")) { - System.err.println("toString for l2 is wrong"); + if(!parameters[3].toString().equals("java.util.List l2")) { + System.err.println("toString for l2 is wrong, expected \"java.util.List l2\", got \"" + parameters[3] + "\""); error++; } if(parameters[3].isVarArgs()) { @@ -177,8 +176,8 @@ public class WithParameters { error++; } } - if(parameters[4].toString().equals("java.util.List l")) { - System.err.println("toString for l3 is wrong"); + if(!parameters[4].toString().equals("java.util.List l3")) { + System.err.println("toString for l3 is wrong, expected \"java.util.List l3\", got \"" + parameters[3] + "\""); error++; } if(parameters[4].isVarArgs()) { @@ -212,8 +211,8 @@ public class WithParameters { } } } - 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()) {