Thu, 17 Oct 2013 13:50:00 +0200
8008192: Better ordering checks needed in repeatingAnnotations/combo/ReflectionTest
Reviewed-by: jjg, jfranck
1.1 --- a/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java Thu Oct 17 13:27:36 2013 +0200 1.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/combo/Helper.java Thu Oct 17 13:50:00 2013 +0200 1.3 @@ -54,10 +54,10 @@ 1.4 IMPORTEXPECTED("import expectedFiles.*;\n"), 1.5 REPEATABLE("\n@Repeatable(FooContainer.class)\n"), 1.6 CONTAINER("@interface FooContainer {\n" + " Foo[] value();\n}\n"), 1.7 - BASE("@interface Foo {}\n"), 1.8 - BASEANNO("@Foo"), 1.9 - LEGACYCONTAINER("@FooContainer(value = {@Foo, @Foo})\n"), 1.10 - REPEATABLEANNO("\n@Foo() @Foo()"), 1.11 + BASE("@interface Foo {int value() default Integer.MAX_VALUE;}\n"), 1.12 + BASEANNO("@Foo(0)"), 1.13 + LEGACYCONTAINER("@FooContainer(value = {@Foo(1), @Foo(2)})\n"), 1.14 + REPEATABLEANNO("\n@Foo(1) @Foo(2)"), 1.15 DEPRECATED("\n@Deprecated"), 1.16 DOCUMENTED("\n@Documented"), 1.17 INHERITED("\n@Inherited"),
2.1 --- a/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java Thu Oct 17 13:27:36 2013 +0200 2.2 +++ b/test/tools/javac/annotations/repeatingAnnotations/combo/ReflectionTest.java Thu Oct 17 13:50:00 2013 +0200 2.3 @@ -45,6 +45,8 @@ 2.4 2.5 import expectedFiles.ExpectedBase; 2.6 import expectedFiles.ExpectedContainer; 2.7 +import java.util.Iterator; 2.8 +import java.util.regex.Pattern; 2.9 2.10 /* 2.11 * Objective: 2.12 @@ -99,6 +101,7 @@ 2.13 * Set it to true to get more debug information 2.14 */ 2.15 static final boolean DEBUG = false; 2.16 + static boolean CHECKORDERING; 2.17 2.18 public static void main(String args[]) throws Exception { 2.19 ReflectionTest test = new ReflectionTest(); 2.20 @@ -145,6 +148,23 @@ 2.21 if (c != null) { 2.22 // For the loaded class object, compare expected and actual annotation values 2.23 // for each of the methods under test from java.lang.reflect.AnnotatedElement 2.24 + 2.25 + 2.26 + // Ignoring following test cases since for now they are 2.27 + // failing with ordering issues. 2.28 + // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest 2.29 + // fail with ordering issues 2.30 + List<String> orderingTestFailures = Arrays.asList( 2.31 + "SingleOnSuperContainerOnSub_Inherited_Legacy", 2.32 + "SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy", 2.33 + "ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy", 2.34 + "SingleAnnoWithContainer", 2.35 + "SingleOnSuperContainerAndSingleOnSub_Inherited"); 2.36 + if (orderingTestFailures.contains(testCase.toString())) { 2.37 + CHECKORDERING = false; 2.38 + } else 2.39 + CHECKORDERING = true; 2.40 + 2.41 checkAnnoValues(srcType, c); 2.42 } else { 2.43 error("Could not load className = " + c); 2.44 @@ -167,12 +187,12 @@ 2.45 enum TestCase { 2.46 BasicNonRepeatable_Legacy( 2.47 "@ExpectedBase(value=Foo.class, " 2.48 - + "getAnnotationVal = \"Foo\", " 2.49 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.50 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.51 - + "getDeclAnnoVal = \"Foo\", " 2.52 - + "getAnnosArgs = {\"Foo\"}, " 2.53 - + "getDeclAnnosArgs = {\"Foo\"}) ", 2.54 + + "getAnnotationVal = \"@Foo(value=0)\", " 2.55 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}, " 2.56 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}, " 2.57 + + "getDeclAnnoVal = \"@Foo(value=0)\", " 2.58 + + "getAnnosArgs = {\"@Foo(value=0)\"}, " 2.59 + + "getDeclAnnosArgs = {\"@Foo(value=0)\"}) ", 2.60 "@ExpectedContainer") { 2.61 2.62 @Override 2.63 @@ -202,11 +222,11 @@ 2.64 Sample package-info.java 2.65 @ExpectedBase 2.66 @ExpectedContainer 2.67 - @Foo 2.68 + @Foo(0) 2.69 package testpkg; 2.70 2.71 @Retention(RetentionPolicy.RUNTIME) 2.72 - @interface Foo {} 2.73 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.74 2.75 Sample testSrc: 2.76 package testpkg; 2.77 @@ -229,11 +249,11 @@ 2.78 /* 2.79 Sample testSrc for class 2.80 @Retention(RetentionPolicy.RUNTIME) 2.81 - @interface Foo {} 2.82 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.83 2.84 @ExpectedBase 2.85 @ExpectedContainer 2.86 - @Foo 2.87 + @Foo(0) 2.88 class A {} 2.89 */ 2.90 replaceVal = expectedVals + anno; 2.91 @@ -248,11 +268,11 @@ 2.92 }, 2.93 SingleAnnoInherited_Legacy( 2.94 "@ExpectedBase(value=Foo.class, " 2.95 - + "getAnnotationVal = \"Foo\", " 2.96 - + "getAnnotationsVals = {\"Foo\", \"ExpectedBase\", \"ExpectedContainer\"}, " 2.97 + + "getAnnotationVal = \"@Foo(value=0)\", " 2.98 + + "getAnnotationsVals = {\"@Foo(value=0)\", \"ExpectedBase\", \"ExpectedContainer\"}, " 2.99 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " 2.100 + "getDeclAnnoVal = \"NULL\", " 2.101 - + "getAnnosArgs = {\"Foo\"}, " 2.102 + + "getAnnosArgs = {\"@Foo(value=0)\"}, " 2.103 + "getDeclAnnosArgs = {})", 2.104 "@ExpectedContainer") { 2.105 2.106 @@ -273,9 +293,9 @@ 2.107 Sample testSrc: 2.108 @Retention(RetentionPolicy.RUNTIME) 2.109 @Inherited 2.110 - @interface Foo {} 2.111 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.112 2.113 - @Foo 2.114 + @Foo(0) 2.115 class SuperClass { } 2.116 2.117 @ExpectedBase 2.118 @@ -337,9 +357,9 @@ 2.119 Sample test src: 2.120 @Retention(RetentionPolicy.RUNTIME) 2.121 @Inherited 2.122 - @interface Foo {} 2.123 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.124 2.125 - @Foo 2.126 + @Foo(0) 2.127 interface TestInterface { } 2.128 2.129 @ExpectedBase 2.130 @@ -375,18 +395,18 @@ 2.131 }, 2.132 AnnoOnSuperAndSubClass_Inherited_Legacy( 2.133 "@ExpectedBase(value=Foo.class, " 2.134 - + "getAnnotationVal = \"Foo\", " 2.135 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.136 + + "getAnnotationVal = \"@Foo(value=2)\", " 2.137 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, " 2.138 + // override every annotation on superClass 2.139 - "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.140 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, " 2.141 + // ignores inherited annotations 2.142 - "getDeclAnnoVal = \"Foo\", " // ignores inherited 2.143 - + "getAnnosArgs = {\"Foo\"}, " 2.144 - + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited 2.145 + "getDeclAnnoVal = \"@Foo(value=2)\", " // ignores inherited 2.146 + + "getAnnosArgs = {\"@Foo(value=2)\"}, " 2.147 + + "getDeclAnnosArgs = { \"@Foo(value=2)\" })", // ignores inherited 2.148 "@ExpectedContainer(value=FooContainer.class, " 2.149 + "getAnnotationVal = \"NULL\", " 2.150 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.151 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.152 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, " 2.153 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=2)\"}, " 2.154 + // ignores inherited annotations 2.155 "getDeclAnnoVal = \"NULL\", " + // ignores inherited 2.156 "getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") { // ignores inherited 2.157 @@ -408,19 +428,19 @@ 2.158 Sample test src 2.159 @Retention(RetentionPolicy.RUNTIME) 2.160 @Inherited 2.161 - @interface Foo {} 2.162 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.163 2.164 @Inherited 2.165 @interface FooContainer { 2.166 Foo[] value(); 2.167 } 2.168 2.169 - @Foo 2.170 + @Foo(1) 2.171 class SuperClass { } 2.172 2.173 @ExpectedBase 2.174 @ExpectedContainer 2.175 - @Foo 2.176 + @Foo(2) 2.177 class SubClass extends SuperClass {} 2.178 */ 2.179 // @Inherited only works for classes, no switch cases for 2.180 @@ -435,12 +455,13 @@ 2.181 2.182 if (srcType == SrcType.CLASS) { 2.183 // Contents for SuperClass 2.184 - anno = Helper.ContentVars.BASEANNO.getVal(); 2.185 + anno = "@Foo(1)"; 2.186 replaceVal = commonStmts + "\n" + anno; 2.187 String superClassContents = srcType.getTemplate() 2.188 .replace("#CN", SUPERCLASS).replace("#REPLACE", replaceVal); 2.189 2.190 // Contents for SubClass that extends SuperClass 2.191 + anno = "@Foo(2)"; 2.192 replaceVal = expectedVals + "\n" + anno; 2.193 String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.194 .replace("#CN", className).replace("#SN", SUPERCLASS) 2.195 @@ -456,17 +477,17 @@ 2.196 BasicContainer_Legacy( 2.197 "@ExpectedBase(value = Foo.class, " 2.198 + "getAnnotationVal = \"NULL\"," 2.199 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.200 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.201 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.202 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.203 + "getDeclAnnoVal = \"NULL\", " + "getAnnosArgs = {}, " 2.204 + "getDeclAnnosArgs = {} )", 2.205 "@ExpectedContainer(value=FooContainer.class, " 2.206 - + "getAnnotationVal = \"FooContainer\", " 2.207 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.208 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.209 - + "getDeclAnnoVal = \"FooContainer\", " 2.210 - + "getAnnosArgs = {\"FooContainer\"}, " 2.211 - + "getDeclAnnosArgs = {\"FooContainer\"} )") { 2.212 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.213 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.214 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.215 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.216 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.217 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { 2.218 2.219 @Override 2.220 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.221 @@ -498,11 +519,11 @@ 2.222 Sample package-info.java 2.223 @ExpectedBase 2.224 @ExpectedContainer 2.225 - @FooContainer(value = {@Foo, @Foo}) 2.226 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.227 package testpkg; 2.228 2.229 @Retention(RetentionPolicy.RUNTIME) 2.230 - @interface Foo {} 2.231 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.232 2.233 @Retention(RetentionPolicy.RUNTIME) 2.234 @interface FooContainer { 2.235 @@ -529,7 +550,7 @@ 2.236 Sample testSrc for class: 2.237 @Retention(RetentionPolicy.RUNTIME) 2.238 @Inherited 2.239 - @interface Foo {} 2.240 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.241 2.242 @Retention(RetentionPolicy.RUNTIME) 2.243 @Inherited 2.244 @@ -539,7 +560,7 @@ 2.245 2.246 @ExpectedBase 2.247 @ExpectedContainer 2.248 - @FooContainer(value = {@Foo, @Foo}) 2.249 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.250 class A {} 2.251 */ 2.252 replaceVal = expectedVals + anno; 2.253 @@ -554,23 +575,23 @@ 2.254 }, 2.255 SingleAndContainerOnSuper_Legacy( 2.256 "@ExpectedBase(value = Foo.class, " 2.257 - + "getAnnotationVal = \"Foo\"," 2.258 + + "getAnnotationVal = \"@Foo(value=0)\"," 2.259 + "getAnnotationsVals = {" 2.260 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.261 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.262 + "getDeclAnnosVals = {" 2.263 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.264 - + "getDeclAnnoVal = \"Foo\", " 2.265 - + "getAnnosArgs = {\"Foo\"}, " 2.266 - + "getDeclAnnosArgs = {\"Foo\"} )", 2.267 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.268 + + "getDeclAnnoVal = \"@Foo(value=0)\", " 2.269 + + "getAnnosArgs = {\"@Foo(value=0)\"}, " 2.270 + + "getDeclAnnosArgs = {\"@Foo(value=0)\"} )", 2.271 "@ExpectedContainer(value=FooContainer.class, " 2.272 - + "getAnnotationVal = \"FooContainer\", " 2.273 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.274 + "getAnnotationsVals = {" 2.275 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.276 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.277 + "getDeclAnnosVals = {" 2.278 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.279 - + "getDeclAnnoVal = \"FooContainer\", " 2.280 - + "getAnnosArgs = {\"FooContainer\"}, " 2.281 - + "getDeclAnnosArgs = {\"FooContainer\"} )") { 2.282 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.283 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.284 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.285 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { 2.286 2.287 @Override 2.288 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.289 @@ -589,8 +610,8 @@ 2.290 + getExpectedContainer() + "\n"; 2.291 StringBuilder commonStmts = new StringBuilder(); 2.292 2.293 - anno = Helper.ContentVars.LEGACYCONTAINER.getVal() 2.294 - + Helper.ContentVars.BASEANNO.getVal(); 2.295 + anno = Helper.ContentVars.BASEANNO.getVal() + 2.296 + Helper.ContentVars.LEGACYCONTAINER.getVal(); 2.297 commonStmts.append(Helper.ContentVars.IMPORTEXPECTED.getVal()) 2.298 .append(Helper.ContentVars.IMPORTSTMTS.getVal()) 2.299 .append(Helper.ContentVars.RETENTIONRUNTIME.getVal()) 2.300 @@ -603,12 +624,12 @@ 2.301 Sample package-info.java 2.302 @ExpectedBase 2.303 @ExpectedContainer 2.304 - @Foo 2.305 - @FooContainer(value = {@Foo, @Foo}) 2.306 + @Foo(0) 2.307 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.308 package testpkg; 2.309 2.310 @Retention(RetentionPolicy.RUNTIME) 2.311 - @interface Foo {} 2.312 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.313 2.314 @Retention(RetentionPolicy.RUNTIME) 2.315 @interface FooContainer { 2.316 @@ -636,7 +657,7 @@ 2.317 Sample testSrc for class: 2.318 @Retention(RetentionPolicy.RUNTIME) 2.319 @Inherited 2.320 - @interface Foo {} 2.321 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.322 2.323 @Retention(RetentionPolicy.RUNTIME) 2.324 @Inherited 2.325 @@ -646,8 +667,8 @@ 2.326 2.327 @ExpectedBase 2.328 @ExpectedContainer 2.329 - @Foo 2.330 - @FooContainer(value = {@Foo, @Foo}) 2.331 + @Foo(0) 2.332 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.333 class A {} 2.334 */ 2.335 replaceVal = expectedVals + anno; 2.336 @@ -664,17 +685,17 @@ 2.337 BasicContainer_Inherited_Legacy( 2.338 "@ExpectedBase(value = Foo.class, " 2.339 + "getAnnotationVal = \"NULL\"," 2.340 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.341 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.342 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " 2.343 + "getDeclAnnoVal = \"NULL\", " 2.344 + "getAnnosArgs = {}, " 2.345 + "getDeclAnnosArgs = {} )", 2.346 "@ExpectedContainer(value=FooContainer.class, " 2.347 - + "getAnnotationVal = \"FooContainer\", " 2.348 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.349 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.350 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.351 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " 2.352 + "getDeclAnnoVal = \"NULL\", " 2.353 - + "getAnnosArgs = {\"FooContainer\"}, " 2.354 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.355 + "getDeclAnnosArgs = {} )") { 2.356 2.357 @Override 2.358 @@ -694,7 +715,7 @@ 2.359 Sample testSrc: 2.360 @Retention(RetentionPolicy.RUNTIME) 2.361 @Inherited 2.362 - @interface Foo {} 2.363 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.364 2.365 @Retention(RetentionPolicy.RUNTIME) 2.366 @Inherited 2.367 @@ -702,7 +723,7 @@ 2.368 Foo[] value(); 2.369 } 2.370 2.371 - @FooContainer(value = {@Foo, @Foo}) 2.372 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.373 class SuperClass { } 2.374 2.375 @ExpectedBase 2.376 @@ -736,20 +757,20 @@ 2.377 }, 2.378 ContainerOnSuperSingleOnSub_Inherited_Legacy( 2.379 "@ExpectedBase(value=Foo.class, " 2.380 - + "getAnnotationVal = \"Foo\", " 2.381 + + "getAnnotationVal = \"@Foo(value=0)\", " 2.382 + "getAnnotationsVals = {" 2.383 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.384 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}," 2.385 - + "getDeclAnnoVal = \"Foo\"," 2.386 - + "getAnnosArgs = {\"Foo\"}," 2.387 - + "getDeclAnnosArgs = {\"Foo\"})", 2.388 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " 2.389 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," 2.390 + + "getDeclAnnoVal = \"@Foo(value=0)\"," 2.391 + + "getAnnosArgs = {\"@Foo(value=0)\"}," 2.392 + + "getDeclAnnosArgs = {\"@Foo(value=0)\"})", 2.393 "@ExpectedContainer(value=FooContainer.class, " 2.394 - + "getAnnotationVal = \"FooContainer\", " 2.395 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.396 + "getAnnotationsVals = {" 2.397 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.398 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}," 2.399 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " 2.400 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," 2.401 + "getDeclAnnoVal = \"NULL\"," 2.402 - + "getAnnosArgs = {\"FooContainer\"}," 2.403 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.404 + "getDeclAnnosArgs = {})") { 2.405 2.406 @Override 2.407 @@ -769,7 +790,7 @@ 2.408 Sample testSrc: 2.409 @Retention(RetentionPolicy.RUNTIME) 2.410 @Inherited 2.411 - @interface Foo {} 2.412 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.413 2.414 @Retention(RetentionPolicy.RUNTIME) 2.415 @Inherited 2.416 @@ -777,12 +798,12 @@ 2.417 Foo[] value(); 2.418 } 2.419 2.420 - @FooContainer(value = {@Foo, @Foo}) 2.421 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.422 class SuperClass { } 2.423 2.424 @ExpectedBase 2.425 @ExpectedContainer 2.426 - @Foo 2.427 + @Foo(0) 2.428 class SubClass extends SuperClass {} 2.429 */ 2.430 // @Inherited only works for classes, no switch cases for 2.431 @@ -811,22 +832,24 @@ 2.432 return files; 2.433 } 2.434 }, 2.435 + // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest 2.436 + // fail with ordering issues 2.437 ContainerAndSingleOnSuperSingleOnSub_Inherited_Legacy( 2.438 "@ExpectedBase(value=Foo.class, " 2.439 - + "getAnnotationVal = \"Foo\", " 2.440 + + "getAnnotationVal = \"@Foo(value=0)\", " 2.441 + "getAnnotationsVals = {" 2.442 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.443 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}," 2.444 - + "getDeclAnnoVal = \"Foo\"," 2.445 - + "getAnnosArgs = {\"Foo\"}," 2.446 - + "getDeclAnnosArgs = {\"Foo\"})", 2.447 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " 2.448 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," 2.449 + + "getDeclAnnoVal = \"@Foo(value=0)\"," 2.450 + + "getAnnosArgs = {\"@Foo(value=0)\"}," 2.451 + + "getDeclAnnosArgs = {\"@Foo(value=0)\"})", 2.452 "@ExpectedContainer(value=FooContainer.class, " 2.453 - + "getAnnotationVal = \"FooContainer\", " 2.454 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.455 + "getAnnotationsVals = {" 2.456 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.457 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}," 2.458 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=0)\"}, " 2.459 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\"}," 2.460 + "getDeclAnnoVal = \"NULL\"," 2.461 - + "getAnnosArgs = {\"FooContainer\"}," 2.462 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.463 + "getDeclAnnosArgs = {})") { 2.464 2.465 @Override 2.466 @@ -846,7 +869,7 @@ 2.467 Sample testSrc: 2.468 @Retention(RetentionPolicy.RUNTIME) 2.469 @Inherited 2.470 - @interface Foo {} 2.471 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.472 2.473 @Retention(RetentionPolicy.RUNTIME) 2.474 @Inherited 2.475 @@ -854,12 +877,12 @@ 2.476 Foo[] value(); 2.477 } 2.478 2.479 - @FooContainer(value = {@Foo, @Foo}) @Foo 2.480 + @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3) 2.481 class SuperClass { } 2.482 2.483 @ExpectedBase 2.484 @ExpectedContainer 2.485 - @Foo 2.486 + @Foo(0) 2.487 class SubClass extends SuperClass {} 2.488 */ 2.489 // @Inherited only works for classes, no switch cases for 2.490 @@ -868,7 +891,7 @@ 2.491 if (srcType == SrcType.CLASS) { 2.492 // Contents for SuperClass 2.493 anno = Helper.ContentVars.LEGACYCONTAINER.getVal() 2.494 - + Helper.ContentVars.BASEANNO.getVal(); 2.495 + + "@Foo(3)"; 2.496 replaceVal = commonStmts + "\n" + anno; 2.497 String superClassContents = srcType.getTemplate() 2.498 .replace("#CN", SUPERCLASS) 2.499 @@ -888,23 +911,25 @@ 2.500 return files; 2.501 } 2.502 }, 2.503 + // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest 2.504 + // fail with ordering issues 2.505 SingleOnSuperContainerOnSub_Inherited_Legacy( 2.506 "@ExpectedBase(value=Foo.class, " 2.507 - + "getAnnotationVal = \"Foo\", " 2.508 + + "getAnnotationVal = \"@Foo(value=0)\", " 2.509 + "getAnnotationsVals = {" 2.510 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.511 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}," 2.512 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.513 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.514 + "getDeclAnnoVal = \"NULL\"," 2.515 - + "getAnnosArgs = {\"Foo\"}," 2.516 + + "getAnnosArgs = {\"@Foo(value=0)\"}," 2.517 + "getDeclAnnosArgs = {})", 2.518 "@ExpectedContainer(value=FooContainer.class, " 2.519 - + "getAnnotationVal = \"FooContainer\", " 2.520 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.521 + "getAnnotationsVals = {" 2.522 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.523 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}," 2.524 - + "getDeclAnnoVal = \"FooContainer\"," 2.525 - + "getAnnosArgs = {\"FooContainer\"}," 2.526 - + "getDeclAnnosArgs = {\"FooContainer\"})") { 2.527 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.528 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.529 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.530 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.531 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { 2.532 2.533 @Override 2.534 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.535 @@ -924,7 +949,7 @@ 2.536 Sample testSrc: 2.537 @Retention(RetentionPolicy.RUNTIME) 2.538 @Inherited 2.539 - @interface Foo {} 2.540 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.541 2.542 @Retention(RetentionPolicy.RUNTIME) 2.543 @Inherited 2.544 @@ -932,12 +957,12 @@ 2.545 Foo[] value(); 2.546 } 2.547 2.548 - @Foo 2.549 + @Foo(0) 2.550 class SuperClass { } 2.551 2.552 @ExpectedBase 2.553 @ExpectedContainer 2.554 - @FooContainer(value = {@Foo, @Foo}) 2.555 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.556 class SubClass extends SuperClass {} 2.557 */ 2.558 2.559 @@ -963,25 +988,27 @@ 2.560 return files; 2.561 } 2.562 }, 2.563 + // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest 2.564 + // fail with ordering issues 2.565 SingleOnSuperContainerAndSingleOnSub_Inherited_Legacy( 2.566 "@ExpectedBase(value=Foo.class, " 2.567 - + "getAnnotationVal = \"Foo\", " 2.568 + + "getAnnotationVal = \"@Foo(value=3)\", " 2.569 + "getAnnotationsVals = {" 2.570 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.571 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " 2.572 + "getDeclAnnosVals = {" 2.573 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.574 - + "getDeclAnnoVal = \"Foo\"," 2.575 - + "getAnnosArgs = {\"Foo\"}," 2.576 - + "getDeclAnnosArgs = {\"Foo\"})", 2.577 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," 2.578 + + "getDeclAnnoVal = \"@Foo(value=3)\"," 2.579 + + "getAnnosArgs = {\"@Foo(value=3)\"}," 2.580 + + "getDeclAnnosArgs = {\"@Foo(value=3)\"})", 2.581 "@ExpectedContainer(value=FooContainer.class, " 2.582 - + "getAnnotationVal = \"FooContainer\", " 2.583 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.584 + "getAnnotationsVals = {" 2.585 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.586 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " 2.587 + "getDeclAnnosVals = {" 2.588 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.589 - + "getDeclAnnoVal = \"FooContainer\"," 2.590 - + "getAnnosArgs = {\"FooContainer\"}," 2.591 - + "getDeclAnnosArgs = {\"FooContainer\"})") { 2.592 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," 2.593 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.594 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.595 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { 2.596 2.597 @Override 2.598 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.599 @@ -1001,7 +1028,7 @@ 2.600 Sample testSrc: 2.601 @Retention(RetentionPolicy.RUNTIME) 2.602 @Inherited 2.603 - @interface Foo {} 2.604 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.605 2.606 @Retention(RetentionPolicy.RUNTIME) 2.607 @Inherited 2.608 @@ -1009,12 +1036,12 @@ 2.609 Foo[] value(); 2.610 } 2.611 2.612 - @Foo 2.613 + @Foo(0) 2.614 class SuperClass { } 2.615 2.616 @ExpectedBase 2.617 @ExpectedContainer 2.618 - @FooContainer(value = {@Foo, @Foo}) @Foo 2.619 + @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3) 2.620 class SubClass extends SuperClass {} 2.621 */ 2.622 2.623 @@ -1028,7 +1055,7 @@ 2.624 2.625 //Contents for SubClass that extends SuperClass 2.626 anno = Helper.ContentVars.LEGACYCONTAINER.getVal() 2.627 - + Helper.ContentVars.BASEANNO.getVal(); 2.628 + + "@Foo(3)"; 2.629 replaceVal = expectedVals + "\n" + anno; 2.630 String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.631 .replace("#CN", className).replace("#SN", SUPERCLASS) 2.632 @@ -1044,18 +1071,18 @@ 2.633 BasicRepeatable( 2.634 "@ExpectedBase(value=Foo.class, " 2.635 + "getAnnotationVal = \"NULL\", " 2.636 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\" }, " 2.637 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}," 2.638 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\" }, " 2.639 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.640 + "getDeclAnnoVal = \"NULL\"," 2.641 - + "getAnnosArgs = {\"Foo\", \"Foo\"}," 2.642 - + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})", 2.643 + + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}," 2.644 + + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})", 2.645 "@ExpectedContainer(value=FooContainer.class, " 2.646 - + "getAnnotationVal = \"FooContainer\"," 2.647 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}," 2.648 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.649 - + "getDeclAnnoVal = \"FooContainer\"," 2.650 - + "getAnnosArgs = {\"FooContainer\"}," 2.651 - + "getDeclAnnosArgs = {\"FooContainer\"} )") { 2.652 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.653 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.654 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.655 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.656 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.657 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { 2.658 2.659 @Override 2.660 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.661 @@ -1088,12 +1115,12 @@ 2.662 Sample package-info.java 2.663 @ExpectedBase 2.664 @ExpectedContainer 2.665 - @Foo() @Foo() 2.666 + @Foo(1) @Foo(2) 2.667 package testpkg; 2.668 2.669 @Retention(RetentionPolicy.RUNTIME) 2.670 @Repeatable(FooContainer.class) 2.671 - @interface Foo {} 2.672 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.673 2.674 @Retention(RetentionPolicy.RUNTIME) 2.675 @interface FooContainer { 2.676 @@ -1120,7 +1147,7 @@ 2.677 Sample testSrc for class: 2.678 @Retention(RetentionPolicy.RUNTIME) 2.679 @Repeatable(FooContainer.class) 2.680 - @interface Foo {} 2.681 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.682 2.683 @Retention(RetentionPolicy.RUNTIME) 2.684 @interface FooContainer { 2.685 @@ -1129,7 +1156,7 @@ 2.686 2.687 @ExpectedBase 2.688 @ExpectedContainer 2.689 - @Foo @Foo 2.690 + @Foo(1) @Foo(2) 2.691 class A { } 2.692 */ 2.693 replaceVal = expectedVals + anno; 2.694 @@ -1146,21 +1173,21 @@ 2.695 "@ExpectedBase(value=Foo.class, " 2.696 + "getAnnotationVal = \"NULL\", " 2.697 + "getAnnotationsVals = {" 2.698 - + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.699 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.700 + "getDeclAnnosVals = {" 2.701 - + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}," 2.702 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.703 + "getDeclAnnoVal = \"NULL\"," 2.704 - + "getAnnosArgs = {\"Foo\", \"Foo\"}," 2.705 - + "getDeclAnnosArgs = {\"Foo\", \"Foo\"})", 2.706 + + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}," 2.707 + + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"})", 2.708 "@ExpectedContainer(value=FooContainer.class, " 2.709 - + "getAnnotationVal = \"FooContainer\"," 2.710 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.711 + "getAnnotationsVals = {" 2.712 - + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}," 2.713 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.714 + "getDeclAnnosVals = {" 2.715 - + "\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.716 - + "getDeclAnnoVal = \"FooContainer\"," 2.717 - + "getAnnosArgs = {\"FooContainer\"}," 2.718 - + "getDeclAnnosArgs = {\"FooContainer\"} )") { 2.719 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.720 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.721 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.722 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"} )") { 2.723 2.724 @Override 2.725 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.726 @@ -1193,12 +1220,12 @@ 2.727 Sample package-info.java 2.728 @ExpectedBase 2.729 @ExpectedContainer 2.730 - @FooContainer(value = {@Foo, @Foo}) 2.731 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.732 package testpkg; 2.733 2.734 @Retention(RetentionPolicy.RUNTIME) 2.735 @Repeatable(FooContainer.class) 2.736 - @interface Foo {} 2.737 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.738 2.739 @Retention(RetentionPolicy.RUNTIME) 2.740 @interface FooContainer { 2.741 @@ -1225,7 +1252,7 @@ 2.742 Sample testSrc for class: 2.743 @Retention(RetentionPolicy.RUNTIME) 2.744 @Repeatable(FooContainer.class) 2.745 - @interface Foo {} 2.746 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.747 2.748 @Retention(RetentionPolicy.RUNTIME) 2.749 @interface FooContainer { 2.750 @@ -1234,7 +1261,7 @@ 2.751 2.752 @ExpectedBase 2.753 @ExpectedContainer 2.754 - @FooContainer(value = {@Foo, @Foo}) 2.755 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.756 class A { } 2.757 */ 2.758 replaceVal = expectedVals + anno; 2.759 @@ -1250,17 +1277,17 @@ 2.760 BasicContainerRepeatable_Inherited( 2.761 "@ExpectedBase(value=Foo.class, " 2.762 + "getAnnotationVal = \"NULL\", " 2.763 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.764 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.765 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " 2.766 + "getDeclAnnoVal = \"NULL\", " 2.767 - + "getAnnosArgs = {\"Foo\", \"Foo\"}, " 2.768 + + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, " 2.769 + "getDeclAnnosArgs = {})", 2.770 "@ExpectedContainer(value=FooContainer.class, " 2.771 - + "getAnnotationVal = \"FooContainer\", " 2.772 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.773 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.774 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.775 + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, " 2.776 + "getDeclAnnoVal = \"NULL\", " 2.777 - + "getAnnosArgs = {\"FooContainer\"}, " 2.778 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.779 + "getDeclAnnosArgs = {})") { 2.780 2.781 @Override 2.782 @@ -1280,7 +1307,7 @@ 2.783 @Retention(RetentionPolicy.RUNTIME) 2.784 @Inherited 2.785 @Repeatable(FooContainer.class) 2.786 - @interface Foo {} 2.787 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.788 2.789 @Retention(RetentionPolicy.RUNTIME) 2.790 @Inherited 2.791 @@ -1288,7 +1315,7 @@ 2.792 Foo[] value(); 2.793 } 2.794 2.795 - @FooContainer(value = {@Foo, @Foo}) 2.796 + @FooContainer(value = {@Foo(1), @Foo(2)}) 2.797 class SuperClass { } 2.798 2.799 @ExpectedBase 2.800 @@ -1323,21 +1350,21 @@ 2.801 RepeatableAnnoInherited( 2.802 "@ExpectedBase(value=Foo.class, " 2.803 + "getAnnotationVal = \"NULL\", " 2.804 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.805 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.806 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\"}, " 2.807 + // ignores inherited annotations 2.808 "getDeclAnnoVal = \"NULL\", " 2.809 + // ignores inherited 2.810 - "getAnnosArgs = {\"Foo\", \"Foo\"}, " 2.811 + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\"}, " 2.812 + "getDeclAnnosArgs = {})", // ignores inherited 2.813 "@ExpectedContainer(value=FooContainer.class, " 2.814 - + "getAnnotationVal = \"FooContainer\", " 2.815 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"FooContainer\"}, " 2.816 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.817 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.818 + "getDeclAnnosVals = { \"ExpectedBase\", \"ExpectedContainer\"}, " 2.819 + // ignores inherited annotations 2.820 "getDeclAnnoVal = \"NULL\", " 2.821 + // ignores inherited 2.822 - "getAnnosArgs = {\"FooContainer\"}, " 2.823 + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.824 + "getDeclAnnosArgs = {})") { // ignores inherited 2.825 2.826 @Override 2.827 @@ -1357,7 +1384,7 @@ 2.828 @Retention(RetentionPolicy.RUNTIME) 2.829 @Inherited 2.830 @Repeatable(FooContainer.class) 2.831 - @interface Foo {} 2.832 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.833 2.834 @Retention(RetentionPolicy.RUNTIME) 2.835 @Inherited 2.836 @@ -1365,7 +1392,7 @@ 2.837 Foo[] value(); 2.838 } 2.839 2.840 - @Foo() @Foo() 2.841 + @Foo(1) @Foo(2) 2.842 class SuperClass { } 2.843 2.844 @ExpectedBase 2.845 @@ -1397,25 +1424,27 @@ 2.846 return files; 2.847 } 2.848 }, 2.849 + // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest 2.850 + // fail with ordering issues 2.851 SingleAnnoWithContainer( 2.852 "@ExpectedBase(value=Foo.class, " 2.853 - + "getAnnotationVal = \"Foo\", " 2.854 + + "getAnnotationVal = \"@Foo(value=0)\", " 2.855 + "getAnnotationsVals = {" 2.856 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.857 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.858 + "getDeclAnnosVals = {" 2.859 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.860 - + "getDeclAnnoVal = \"Foo\"," 2.861 - + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"}," 2.862 - + "getDeclAnnosArgs = {\"Foo\", \"Foo\",\"Foo\"})", 2.863 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.864 + + "getDeclAnnoVal = \"@Foo(value=0)\"," 2.865 + + "getAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\", \"@Foo(value=2)\"}," 2.866 + + "getDeclAnnosArgs = {\"@Foo(value=0)\", \"@Foo(value=1)\",\"@Foo(value=2)\"})", 2.867 "@ExpectedContainer(value=FooContainer.class, " 2.868 - + "getAnnotationVal = \"FooContainer\", " 2.869 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.870 + "getAnnotationsVals = {" 2.871 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.872 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.873 + "getDeclAnnosVals = {" 2.874 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.875 - + "getDeclAnnoVal = \"FooContainer\"," 2.876 - + "getDeclAnnosArgs = {\"FooContainer\"}," 2.877 - + "getAnnosArgs = {\"FooContainer\"})") { 2.878 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=0)\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}, " 2.879 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.880 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.881 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { 2.882 2.883 @Override 2.884 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.885 @@ -1449,12 +1478,12 @@ 2.886 Sample package-info.java 2.887 @ExpectedBase 2.888 @ExpectedContainer 2.889 - @Foo @FooContainer(value = {@Foo, @Foo}) 2.890 + @Foo(0) @FooContainer(value = {@Foo(1), @Foo(2)}) 2.891 package testpkg; 2.892 2.893 @Retention(RetentionPolicy.RUNTIME) 2.894 @Repeatable(FooContainer.class) 2.895 - @interface Foo {} 2.896 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.897 2.898 @Retention(RetentionPolicy.RUNTIME) 2.899 @interface FooContainer { 2.900 @@ -1482,7 +1511,7 @@ 2.901 @Retention(RetentionPolicy.RUNTIME) 2.902 @Inherited 2.903 @Repeatable(FooContainer.class) 2.904 - @interface Foo {} 2.905 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.906 2.907 @Retention(RetentionPolicy.RUNTIME) 2.908 @Inherited 2.909 @@ -1492,7 +1521,7 @@ 2.910 2.911 @ExpectedBase 2.912 @ExpectedContainer 2.913 - @Foo @FooContainer(value = {@Foo, @Foo}) 2.914 + @Foo(0) @FooContainer(value = {@Foo(1), @Foo(2)}) 2.915 class A { } 2.916 */ 2.917 replaceVal = expectedVals + anno; 2.918 @@ -1508,18 +1537,18 @@ 2.919 }, 2.920 AnnoOnSuperAndSubClass_Inherited( 2.921 "@ExpectedBase(value=Foo.class, " 2.922 - + "getAnnotationVal = \"Foo\", " 2.923 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, " 2.924 + + "getAnnotationVal = \"@Foo(value=1)\", " 2.925 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\" }, " 2.926 + // override every annotation on superClass 2.927 - "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.928 + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\"}, " 2.929 + // ignores inherited annotations 2.930 - "getDeclAnnoVal = \"Foo\", " // ignores inherited 2.931 - + "getAnnosArgs = {\"Foo\"}, " 2.932 - + "getDeclAnnosArgs = { \"Foo\" })", // ignores inherited 2.933 + "getDeclAnnoVal = \"@Foo(value=1)\", " // ignores inherited 2.934 + + "getAnnosArgs = {\"@Foo(value=1)\"}, " 2.935 + + "getDeclAnnosArgs = { \"@Foo(value=1)\" })", // ignores inherited 2.936 "@ExpectedContainer(value=FooContainer.class, " 2.937 + "getAnnotationVal = \"NULL\", " 2.938 - + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\" }, " 2.939 - + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"Foo\"}, " 2.940 + + "getAnnotationsVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\" }, " 2.941 + + "getDeclAnnosVals = {\"ExpectedBase\", \"ExpectedContainer\", \"@Foo(value=1)\"}, " 2.942 + // ignores inherited annotations 2.943 "getDeclAnnoVal = \"NULL\", " + // ignores inherited 2.944 "getAnnosArgs = {}, " + "getDeclAnnosArgs = {})") { 2.945 @@ -1542,7 +1571,7 @@ 2.946 @Retention(RetentionPolicy.RUNTIME) 2.947 @Inherited 2.948 @Repeatable(FooContainer.class) 2.949 - @interface Foo {} 2.950 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.951 2.952 @Retention(RetentionPolicy.RUNTIME) 2.953 @Inherited 2.954 @@ -1550,12 +1579,12 @@ 2.955 Foo[] value(); 2.956 } 2.957 2.958 - @Foo() 2.959 + @Foo(0) 2.960 class SuperClass { } 2.961 2.962 @ExpectedBase 2.963 @ExpectedContainer 2.964 - @Foo 2.965 + @Foo(1) 2.966 class SubClass extends SuperClass { } 2.967 */ 2.968 // @Inherited only works for classes, no switch cases for 2.969 @@ -1570,7 +1599,7 @@ 2.970 .replace("#REPLACE", replaceVal); 2.971 2.972 // Contents for SubClass that extends SuperClass 2.973 - replaceVal = expectedVals + "\n" + anno; 2.974 + replaceVal = expectedVals + "\n" + "@Foo(1)"; 2.975 String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.976 .replace("#CN", className) 2.977 .replace("#SN", SUPERCLASS) 2.978 @@ -1623,7 +1652,7 @@ 2.979 // @Retention(RetentionPolicy.RUNTIME) 2.980 // @Inherited 2.981 // @Repeatable(FooContainer.class) 2.982 -// @interface Foo {} 2.983 +// @interface Foo {int value() default Integer.MAX_VALUE;} 2.984 2.985 // @Retention(RetentionPolicy.RUNTIME) 2.986 // @Inherited 2.987 @@ -1650,7 +1679,7 @@ 2.988 // .replace("#REPLACE", replaceVal); 2.989 2.990 // //Contents for SubClass that extends SuperClass 2.991 -// anno = Helper.ContentVars.BASEANNO.getVal(); 2.992 +// anno = "@Foo(0)"; 2.993 // replaceVal = expectedVals + "\n" + anno; 2.994 // String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.995 // .replace("#CN", className) 2.996 @@ -1703,7 +1732,7 @@ 2.997 // @Retention(RetentionPolicy.RUNTIME) 2.998 // @Inherited 2.999 // @Repeatable(FooContainer.class) 2.1000 -// @interface Foo {} 2.1001 +// @interface Foo {int value() default Integer.MAX_VALUE;} 2.1002 2.1003 // @Retention(RetentionPolicy.RUNTIME) 2.1004 // @Inherited 2.1005 @@ -1723,7 +1752,7 @@ 2.1006 // //@Inherited only works for classes, no switch cases for method, field, package 2.1007 // if (srcType == SrcType.CLASS) { 2.1008 // //Contents for SuperClass 2.1009 -// anno = Helper.ContentVars.BASEANNO.getVal(); 2.1010 +// anno = "@Foo(0)"; 2.1011 // replaceVal = commonStmts + "\n" + anno; 2.1012 // String superClassContents = srcType.getTemplate() 2.1013 // .replace("#CN", SUPERCLASS) 2.1014 @@ -1781,7 +1810,7 @@ 2.1015 // @Retention(RetentionPolicy.RUNTIME) 2.1016 // @Inherited 2.1017 // @Repeatable(FooContainer.class) 2.1018 -// @interface Foo {} 2.1019 +// @interface Foo {int value() default Integer.MAX_VALUE;} 2.1020 2.1021 // @Retention(RetentionPolicy.RUNTIME) 2.1022 // @Inherited 2.1023 @@ -1808,7 +1837,7 @@ 2.1024 // .replace("#REPLACE", replaceVal); 2.1025 2.1026 // //Contents for SubClass that extends SuperClass 2.1027 -// anno = Helper.ContentVars.BASEANNO.getVal(); 2.1028 +// anno = "@Foo(0)"; 2.1029 // replaceVal = expectedVals + "\n" + anno; 2.1030 // String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.1031 // .replace("#CN", className) 2.1032 @@ -1859,7 +1888,7 @@ 2.1033 // @Retention(RetentionPolicy.RUNTIME) 2.1034 // @Inherited 2.1035 // @Repeatable(FooContainer.class) 2.1036 -// @interface Foo {} 2.1037 +// @interface Foo {int value() default Integer.MAX_VALUE;} 2.1038 2.1039 // @Retention(RetentionPolicy.RUNTIME) 2.1040 // @Inherited 2.1041 @@ -1879,7 +1908,7 @@ 2.1042 // //@Inherited only works for classes, no switch cases for method, field, package 2.1043 // if (srcType == SrcType.CLASS) { 2.1044 // //Contents for SuperClass 2.1045 -// anno = Helper.ContentVars.BASEANNO.getVal(); 2.1046 +// anno = "@Foo(0)"; 2.1047 // replaceVal = commonStmts + "\n" + anno; 2.1048 // String superClassContents = srcType.getTemplate() 2.1049 // .replace("#CN", SUPERCLASS) 2.1050 @@ -1900,25 +1929,27 @@ 2.1051 // return files; 2.1052 // } 2.1053 // }, 2.1054 + // @ignore 8025924: Several test cases in repeatingAnnotations/combo/ReflectionTest 2.1055 + // fail with ordering issues 2.1056 SingleOnSuperContainerAndSingleOnSub_Inherited( 2.1057 "@ExpectedBase(value=Foo.class, " 2.1058 - + "getAnnotationVal = \"Foo\", " 2.1059 + + "getAnnotationVal = \"@Foo(value=3)\", " 2.1060 + "getAnnotationsVals = {" 2.1061 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.1062 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " 2.1063 + "getDeclAnnosVals = {" 2.1064 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.1065 - + "getDeclAnnoVal = \"Foo\"," 2.1066 - + "getAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"}," 2.1067 - + "getDeclAnnosArgs = {\"Foo\", \"Foo\", \"Foo\"})", 2.1068 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," 2.1069 + + "getDeclAnnoVal = \"@Foo(value=3)\"," 2.1070 + + "getAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"}," 2.1071 + + "getDeclAnnosArgs = {\"@Foo(value=1)\", \"@Foo(value=2)\", \"@Foo(value=3)\"})", 2.1072 "@ExpectedContainer(value=FooContainer.class, " 2.1073 - + "getAnnotationVal = \"FooContainer\", " 2.1074 + + "getAnnotationVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", " 2.1075 + "getAnnotationsVals = {" 2.1076 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}, " 2.1077 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}, " 2.1078 + "getDeclAnnosVals = {" 2.1079 - + "\"ExpectedBase\", \"ExpectedContainer\", \"Foo\", \"FooContainer\"}," 2.1080 - + "getDeclAnnoVal = \"FooContainer\"," 2.1081 - + "getAnnosArgs = {\"FooContainer\"}," 2.1082 - + "getDeclAnnosArgs = {\"FooContainer\"})") { 2.1083 + + "\"ExpectedBase\", \"ExpectedContainer\", \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\", \"@Foo(value=3)\"}," 2.1084 + + "getDeclAnnoVal = \"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"," 2.1085 + + "getAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"}," 2.1086 + + "getDeclAnnosArgs = {\"@FooContainer(value=[@Foo(value=1), @Foo(value=2)])\"})") { 2.1087 2.1088 @Override 2.1089 public Iterable<? extends JavaFileObject> getTestFiles(SrcType srcType, 2.1090 @@ -1936,7 +1967,7 @@ 2.1091 Sample testSrc: 2.1092 @Retention(RetentionPolicy.RUNTIME) 2.1093 @Inherited 2.1094 - @interface Foo {} 2.1095 + @interface Foo {int value() default Integer.MAX_VALUE;} 2.1096 2.1097 @Retention(RetentionPolicy.RUNTIME) 2.1098 @Inherited 2.1099 @@ -1945,12 +1976,12 @@ 2.1100 Foo[] value(); 2.1101 } 2.1102 2.1103 - @Foo 2.1104 + @Foo(0) 2.1105 class SuperClass { } 2.1106 2.1107 @ExpectedBase 2.1108 @ExpectedContainer 2.1109 - @FooContainer(value = {@Foo, @Foo}) @Foo 2.1110 + @FooContainer(value = {@Foo(1), @Foo(2)}) @Foo(3) 2.1111 class SubClass extends SuperClass {} 2.1112 */ 2.1113 2.1114 @@ -1964,7 +1995,7 @@ 2.1115 2.1116 //Contents for SubClass that extends SuperClass 2.1117 anno = Helper.ContentVars.LEGACYCONTAINER.getVal() 2.1118 - + Helper.ContentVars.BASEANNO.getVal(); 2.1119 + + "@Foo(3)"; 2.1120 replaceVal = expectedVals + "\n" + anno; 2.1121 String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.1122 .replace("#CN", className) 2.1123 @@ -2015,7 +2046,7 @@ 2.1124 // @Retention(RetentionPolicy.RUNTIME) 2.1125 // @Inherited 2.1126 // @Repeatable(FooContainer.class) 2.1127 -// @interface Foo {} 2.1128 +// @interface Foo {int value() default Integer.MAX_VALUE;} 2.1129 2.1130 // @Retention(RetentionPolicy.RUNTIME) 2.1131 // @Inherited 2.1132 @@ -2044,7 +2075,7 @@ 2.1133 // .replace("#REPLACE", replaceVal); 2.1134 2.1135 // //Contents for SubClass that extends SuperClass 2.1136 -// anno = Helper.ContentVars.BASEANNO.getVal(); 2.1137 +// anno = "@Foo(0)"; 2.1138 // replaceVal = expectedVals + "\n" + anno; 2.1139 // String subClassContents = SrcType.CLASSEXTENDS.getTemplate() 2.1140 // .replace("#CN", className) 2.1141 @@ -2800,6 +2831,8 @@ 2.1142 // should be present in actualAnno[]. 2.1143 private static boolean compareAnnotations(Annotation[] actualAnnos, 2.1144 String[] expectedAnnos) { 2.1145 + boolean compOrder = false; 2.1146 + 2.1147 // Length is different 2.1148 if (actualAnnos.length != expectedAnnos.length) { 2.1149 error("Length not same, Actual length = " + actualAnnos.length 2.1150 @@ -2830,12 +2863,16 @@ 2.1151 // Lengths are same, compare array contents 2.1152 String[] actualArr = new String[actualAnnos.length]; 2.1153 for (Annotation a : actualAnnos) { 2.1154 + if (a.annotationType().getSimpleName().contains("Expected")) 2.1155 actualArr[i++] = a.annotationType().getSimpleName(); 2.1156 + else if (a.annotationType().getName().contains(TESTPKG)) { 2.1157 + String replaced = a.toString().replaceAll(Pattern.quote("testpkg."),""); 2.1158 + actualArr[i++] = replaced; 2.1159 + } else 2.1160 + actualArr[i++] = a.toString(); 2.1161 } 2.1162 - 2.1163 - List<String> actualList = Arrays.asList(actualArr); 2.1164 - List<String> expectedList = Arrays.asList(expectedAnnos); 2.1165 - 2.1166 + List<String> actualList = new ArrayList<String>(Arrays.asList(actualArr)); 2.1167 + List<String> expectedList = new ArrayList<String>(Arrays.asList(expectedAnnos)); 2.1168 if (!actualList.containsAll(expectedList)) { 2.1169 error("Array values are not same"); 2.1170 printArrContents(actualAnnos); 2.1171 @@ -2843,10 +2880,63 @@ 2.1172 return false; 2.1173 } else { 2.1174 debugPrint("Arr values are same as expected"); 2.1175 + if (CHECKORDERING) { 2.1176 + debugPrint("Checking if annotation ordering is as expected.."); 2.1177 + compOrder = compareOrdering(actualList, expectedList); 2.1178 + if (compOrder) 2.1179 + debugPrint("Arr values ordering is as expected"); 2.1180 + else 2.1181 + error("Arr values ordering is not as expected! actual values: " 2.1182 + + actualList + " expected values: " + expectedList); 2.1183 + } else 2.1184 + compOrder = true; 2.1185 } 2.1186 } 2.1187 + return compOrder; 2.1188 + } 2.1189 + 2.1190 + // Annotation ordering comparison 2.1191 + private static boolean compareOrdering(List<String> actualList, List<String> expectedList) { 2.1192 + boolean order = true; 2.1193 + // Discarding Expected* annotations before comparison of ordering 2.1194 + actualList = iterateList(actualList); 2.1195 + expectedList = iterateList(expectedList); 2.1196 + // Length is different 2.1197 + if (actualList.size() != expectedList.size()) { 2.1198 + error("Length not same, Actual list length = " + actualList.size() 2.1199 + + " Expected list length = " + expectedList.size()); 2.1200 + return false; 2.1201 + } else { 2.1202 + if (actualList.isEmpty() && expectedList.isEmpty()) { 2.1203 return true; 2.1204 } 2.1205 + boolean tmp = true; 2.1206 + for (int i = 0; i < actualList.size(); i++) { 2.1207 + // Checking ordering 2.1208 + if (order) { 2.1209 + if (!actualList.get(i).equals(expectedList.get(i))) { 2.1210 + tmp = false; 2.1211 + debugPrint("Odering is false"); 2.1212 + debugPrint("actualList values: " + actualList 2.1213 + + " expectedList values: " + expectedList); 2.1214 + } 2.1215 + } 2.1216 + } 2.1217 + order = tmp; 2.1218 + } 2.1219 + return order; 2.1220 + } 2.1221 + 2.1222 + private static List<String> iterateList(List<String> list) { 2.1223 + Iterator<String> iter = list.iterator(); 2.1224 + while (iter.hasNext()) { 2.1225 + String anno = iter.next(); 2.1226 + if (anno.contains("Expected")) { 2.1227 + iter.remove(); 2.1228 + } 2.1229 + } 2.1230 + return list; 2.1231 + } 2.1232 2.1233 private static void printArrContents(Annotation[] actualAnnos) { 2.1234 System.out.print("Actual Arr Values: ");