Tue, 12 Feb 2013 11:28:45 +0100
8004822: RFE to write language model API tests for repeating annotations based on the spec updates
Reviewed-by: jjg, abuckley
Contributed-by: Matherey Nunez <matherey.nunez@oracle.com>
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/ElementRepAnnoTester.java Tue Feb 12 11:28:45 2013 +0100 1.3 @@ -0,0 +1,555 @@ 1.4 +/* 1.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + */ 1.26 + 1.27 +import java.lang.annotation.Annotation; 1.28 +import java.util.Arrays; 1.29 +import java.util.EnumSet; 1.30 +import java.util.List; 1.31 +import java.util.Set; 1.32 +import javax.annotation.processing.*; 1.33 +import javax.lang.model.element.*; 1.34 +import javax.lang.model.type.MirroredTypeException; 1.35 +import javax.lang.model.type.TypeMirror; 1.36 +import javax.lang.model.util.Elements; 1.37 + 1.38 +public class ElementRepAnnoTester extends JavacTestingAbstractProcessor { 1.39 + // All methods to test. 1.40 + final EnumSet<TestMethod> ALL_TEST_METHODS = EnumSet.allOf(TestMethod.class); 1.41 + int count = 0; 1.42 + int error = 0; 1.43 + 1.44 + public boolean process(Set<? extends TypeElement> annotations, 1.45 + RoundEnvironment roundEnv) { 1.46 + if (!roundEnv.processingOver()) { 1.47 + List<String> superClass = Arrays.asList("A", "B", "C", "D", "E", 1.48 + "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P"); 1.49 + // Go through all test classes 1.50 + for (Element element : roundEnv.getRootElements()) { 1.51 + // For now, no testing super classes (TODO) 1.52 + if (element.getKind() == ElementKind.CLASS 1.53 + && !superClass.contains(element.getSimpleName().toString())) { 1.54 + // Compare expected and actual values from methods. 1.55 + checkAnnoValues(element, ALL_TEST_METHODS); 1.56 + // Now, look for enclosed elements in test classes. 1.57 + for (Element elements : element.getEnclosedElements()) { 1.58 + // Look for Methods annotations. 1.59 + if (elements.getKind() == ElementKind.METHOD 1.60 + && elements.getSimpleName().toString().equals("testMethod")) { 1.61 + checkAnnoValues(elements, ALL_TEST_METHODS); 1.62 + } 1.63 + // Look for Field annotations. 1.64 + if (elements.getKind() == ElementKind.FIELD 1.65 + && elements.getSimpleName().toString().equals("testField")) { 1.66 + checkAnnoValues(elements, ALL_TEST_METHODS); 1.67 + } 1.68 + } 1.69 + } 1.70 + } 1.71 + 1.72 + if (error != 0) { 1.73 + System.out.println("Total tests : " + count); 1.74 + System.out.println("Total test failures : " + error); 1.75 + throw new RuntimeException(); 1.76 + } else { 1.77 + System.out.println("ALL TESTS PASSED. " + count); 1.78 + } 1.79 + } 1.80 + return true; 1.81 + } 1.82 + 1.83 + enum TestMethod { 1.84 + getAnnotation, 1.85 + getAnnotationsByType, 1.86 + getAllAnnotationMirrors, 1.87 + getAnnotationMirrors 1.88 + } 1.89 + 1.90 + protected void checkAnnoValues(Element element, EnumSet<TestMethod> testMethods) { 1.91 + boolean baseAnnoPresent = false; 1.92 + boolean conAnnoPresent = false; 1.93 + ExpectedBase eb = null; 1.94 + ExpectedContainer ec = null; 1.95 + // Getting the expected values to compare with. 1.96 + eb = element.getAnnotation(ExpectedBase.class); 1.97 + ec = element.getAnnotation(ExpectedContainer.class); 1.98 + 1.99 + if (eb == null) { 1.100 + System.out.println("Did not find ExpectedBase Annotation in " 1.101 + + element.getSimpleName().toString() + ", Test will exit"); 1.102 + throw new RuntimeException(); 1.103 + } 1.104 + if (ec == null) { 1.105 + System.out.println("Did not find ExpectedContainer Annotation in " 1.106 + + element.getSimpleName().toString() + " Test will exit"); 1.107 + throw new RuntimeException(); 1.108 + } 1.109 + // Look if all test cases have ExpectedBase and ExpectedContainer values(). 1.110 + TypeMirror valueBase = null; 1.111 + TypeMirror valueCon = null; 1.112 + 1.113 + try { 1.114 + eb.value(); 1.115 + } catch (MirroredTypeException mte) { 1.116 + valueBase = mte.getTypeMirror(); 1.117 + } 1.118 + 1.119 + try { 1.120 + ec.value(); 1.121 + } catch (MirroredTypeException mte1) { 1.122 + valueCon = mte1.getTypeMirror(); 1.123 + } 1.124 + 1.125 + String expectedBaseAnno = valueBase.toString(); 1.126 + String expectedConAnno = valueCon.toString(); 1.127 + 1.128 + if (!expectedBaseAnno.equals("java.lang.annotation.Annotation")) { 1.129 + baseAnnoPresent = true; 1.130 + } 1.131 + if (!expectedConAnno.equalsIgnoreCase("java.lang.annotation.Annotation")) { 1.132 + conAnnoPresent = true; 1.133 + } 1.134 + 1.135 + // Look into TestMethod and compare method's output with expected values. 1.136 + for (TestMethod testMethod : testMethods) { 1.137 + boolean isBasePass = true; 1.138 + boolean isConPass = true; 1.139 + 1.140 + switch (testMethod) { 1.141 + case getAnnotation: 1.142 + if (baseAnnoPresent) { 1.143 + count++; 1.144 + Annotation actualAnno = getAnnotationBase(element); 1.145 + String expectedAnno = eb.getAnnotation(); 1.146 + isBasePass = compareAnnotation(actualAnno, expectedAnno); 1.147 + } 1.148 + if (conAnnoPresent) { 1.149 + count++; 1.150 + Annotation actualAnno = getAnnotationContainer(element); 1.151 + String expectedAnno = ec.getAnnotation(); 1.152 + isConPass = compareAnnotation(actualAnno, expectedAnno); 1.153 + } 1.154 + if (!isBasePass || !isConPass) { 1.155 + System.out.println("FAIL in " + element.getSimpleName() 1.156 + + "-" + element.getKind() 1.157 + + " method: getAnnotation(class <T>)"); 1.158 + error++; 1.159 + } 1.160 + break; 1.161 + 1.162 + case getAnnotationMirrors: 1.163 + if (baseAnnoPresent) { 1.164 + count++; 1.165 + List<? extends AnnotationMirror> actualDeclAnnos = 1.166 + element.getAnnotationMirrors(); 1.167 + String[] expectedAnnos = eb.getAnnotationMirrors(); 1.168 + isBasePass = compareArrVals(actualDeclAnnos, expectedAnnos); 1.169 + } 1.170 + if (conAnnoPresent) { 1.171 + isConPass = true; 1.172 + } 1.173 + if (!isBasePass || !isConPass) { 1.174 + System.out.println("FAIL in " + element.getSimpleName() 1.175 + + "-" + element.getKind() 1.176 + + " method: getAnnotationMirrors()"); 1.177 + error++; 1.178 + } 1.179 + break; 1.180 + 1.181 + case getAnnotationsByType: 1.182 + if (baseAnnoPresent) { 1.183 + count++; 1.184 + Annotation[] actualAnnosArgs = getAnnotationsBase(element); 1.185 + String[] expectedAnnos = eb.getAnnotationsByType(); 1.186 + isBasePass = compareArrVals(actualAnnosArgs, expectedAnnos); 1.187 + } 1.188 + if (conAnnoPresent) { 1.189 + count++; 1.190 + Annotation[] actualAnnosArgs = getAnnotationsContainer(element); 1.191 + String[] expectedAnnos = ec.getAnnotationsByType(); 1.192 + isConPass = compareArrVals(actualAnnosArgs, expectedAnnos); 1.193 + } 1.194 + if (!isBasePass || !isConPass) { 1.195 + System.out.println("FAIL in " + element.getSimpleName() 1.196 + + "-" + element.getKind() 1.197 + + " method: getAnnotationsByType(class <T>)"); 1.198 + error++; 1.199 + } 1.200 + break; 1.201 + 1.202 + case getAllAnnotationMirrors: 1.203 + if (baseAnnoPresent) { 1.204 + count++; 1.205 + Elements elements = processingEnv.getElementUtils(); 1.206 + List<? extends AnnotationMirror> actualAnnosMirrors = 1.207 + elements.getAllAnnotationMirrors(element); 1.208 + String[] expectedAnnos = eb.getAllAnnotationMirrors(); 1.209 + isBasePass = compareArrVals(actualAnnosMirrors, expectedAnnos); 1.210 + } 1.211 + if (conAnnoPresent) { 1.212 + isConPass = true; 1.213 + } 1.214 + if (!isBasePass || !isConPass) { 1.215 + System.out.println("FAIL in " + element.getSimpleName() 1.216 + + "-" + element.getKind() 1.217 + + " method: getAllAnnotationMirrors(e)"); 1.218 + error++; 1.219 + } 1.220 + break; 1.221 + } 1.222 + } 1.223 + } 1.224 + // Sort tests to be run with different anno processors. 1.225 + final List<String> singularAnno = Arrays.asList( 1.226 + "SingularBasicTest" 1.227 + ); 1.228 + final List<String> singularInheritedAnno = Arrays.asList( 1.229 + "SingularInheritedATest" 1.230 + ); 1.231 + final List<String> repeatableAnno = Arrays.asList( 1.232 + "RepeatableBasicTest", 1.233 + "MixRepeatableAndOfficialContainerBasicTest", 1.234 + "OfficialContainerBasicTest", 1.235 + "RepeatableOfficialContainerBasicTest" 1.236 + ); 1.237 + final List<String> repeatableInheritedAnno = Arrays.asList( 1.238 + "RepeatableInheritedTest", 1.239 + "RepeatableOverrideATest", 1.240 + "RepeatableOverrideBTest", 1.241 + "OfficialContainerInheritedTest", 1.242 + "MixRepeatableAndOfficialContainerInheritedA1Test", 1.243 + "MixRepeatableAndOfficialContainerInheritedB1Test", 1.244 + "MixRepeatableAndOfficialContainerInheritedA2Test", 1.245 + "MixRepeatableAndOfficialContainerInheritedB2Test" 1.246 + ); 1.247 + final List<String> repeatableContainerInheritedAnno = Arrays.asList( 1.248 + "RepeatableOfficialContainerInheritedTest" 1.249 + ); 1.250 + final List<String> unofficialAnno = Arrays.asList( 1.251 + "UnofficialContainerBasicTest", 1.252 + "MixSingularAndUnofficialContainerBasicTest" 1.253 + ); 1.254 + final List<String> unofficialInheritedAnno = Arrays.asList( 1.255 + "UnofficialContainerInheritedTest", 1.256 + "SingularInheritedBTest", 1.257 + "MixSingularAndUnofficialContainerInheritedA1Test", 1.258 + "MixSingularAndUnofficialContainerInheritedB1Test", 1.259 + "MixSingularAndUnofficialContainerInheritedA2Test", 1.260 + "MixSingularAndUnofficialContainerInheritedB2Test" 1.261 + ); 1.262 + // Respective container annotation for the different test cases to test. 1.263 + final List<String> repeatableAnnoContainer = repeatableAnno; 1.264 + final List<String> repeatableInheritedAnnoContainer = repeatableInheritedAnno; 1.265 + final List<String> repeatableContainerInheritedAnnoContainer = 1.266 + repeatableContainerInheritedAnno; 1.267 + final List<String> unofficialAnnoContainer = unofficialAnno; 1.268 + final List<String> unofficialInheritedAnnoContainer = unofficialInheritedAnno; 1.269 + 1.270 + // Variables to verify if all test cases have been run. 1.271 + private Annotation specialAnno = new Annotation() { 1.272 + @Override 1.273 + public Class annotationType() { 1.274 + return null; 1.275 + } 1.276 + }; 1.277 + private Annotation[] specialAnnoArray = new Annotation[1]; 1.278 + private List<AnnotationMirror> specialAnnoMirrors = 1.279 + new java.util.ArrayList<AnnotationMirror>(2); 1.280 + 1.281 + private Annotation getAnnotationBase(Element e) { 1.282 + Annotation actualAnno = specialAnno; 1.283 + 1.284 + if (singularAnno.contains( 1.285 + e.getEnclosingElement().toString()) 1.286 + || singularAnno.contains( 1.287 + e.getSimpleName().toString()) 1.288 + || unofficialAnno.contains( 1.289 + e.getEnclosingElement().toString()) 1.290 + || unofficialAnno.contains( 1.291 + e.getSimpleName().toString())) { 1.292 + actualAnno = e.getAnnotation(Foo.class); 1.293 + } 1.294 + if (singularInheritedAnno.contains( 1.295 + e.getEnclosingElement().toString()) 1.296 + || singularInheritedAnno.contains( 1.297 + e.getSimpleName().toString()) 1.298 + || unofficialInheritedAnno.contains( 1.299 + e.getEnclosingElement().toString()) 1.300 + || unofficialInheritedAnno.contains( 1.301 + e.getSimpleName().toString())) { 1.302 + actualAnno = e.getAnnotation(FooInherited.class); 1.303 + } 1.304 + if (repeatableAnno.contains( 1.305 + e.getEnclosingElement().toString()) 1.306 + || repeatableAnno.contains( 1.307 + e.getSimpleName().toString())) { 1.308 + actualAnno = e.getAnnotation(Bar.class); 1.309 + } 1.310 + if (repeatableInheritedAnno.contains( 1.311 + e.getEnclosingElement().toString()) 1.312 + || repeatableInheritedAnno.contains( 1.313 + e.getSimpleName().toString())) { 1.314 + actualAnno = e.getAnnotation(BarInherited.class); 1.315 + } 1.316 + if (repeatableContainerInheritedAnno.contains( 1.317 + e.getEnclosingElement().toString()) 1.318 + || repeatableContainerInheritedAnno.contains( 1.319 + e.getSimpleName().toString())) { 1.320 + actualAnno = e.getAnnotation(BarInheritedContainer.class); 1.321 + } 1.322 + return actualAnno; 1.323 + } 1.324 + 1.325 + private Annotation getAnnotationContainer(Element e) { 1.326 + Annotation actualAnno = specialAnno; 1.327 + 1.328 + if (repeatableAnnoContainer.contains( 1.329 + e.getEnclosingElement().toString()) 1.330 + || repeatableAnnoContainer.contains( 1.331 + e.getSimpleName().toString())) { 1.332 + actualAnno = e.getAnnotation(BarContainer.class); 1.333 + } 1.334 + if (repeatableInheritedAnnoContainer.contains( 1.335 + e.getEnclosingElement().toString()) 1.336 + || repeatableInheritedAnnoContainer.contains( 1.337 + e.getSimpleName().toString())) { 1.338 + actualAnno = e.getAnnotation(BarInheritedContainer.class); 1.339 + } 1.340 + if (repeatableContainerInheritedAnnoContainer.contains( 1.341 + e.getEnclosingElement().toString()) 1.342 + || repeatableContainerInheritedAnnoContainer.contains( 1.343 + e.getSimpleName().toString())) { 1.344 + actualAnno = e.getAnnotation(BarInheritedContainerContainer.class); 1.345 + } 1.346 + if (unofficialAnnoContainer.contains( 1.347 + e.getEnclosingElement().toString()) 1.348 + || unofficialAnnoContainer.contains( 1.349 + e.getSimpleName().toString())) { 1.350 + actualAnno = e.getAnnotation(UnofficialContainer.class); 1.351 + } 1.352 + if (unofficialInheritedAnnoContainer.contains( 1.353 + e.getEnclosingElement().toString()) 1.354 + || unofficialInheritedAnnoContainer.contains( 1.355 + e.getSimpleName().toString())) { 1.356 + actualAnno = e.getAnnotation(UnofficialInheritedContainer.class); 1.357 + } 1.358 + return actualAnno; 1.359 + } 1.360 + 1.361 + private Annotation[] getAnnotationsBase(Element e) { 1.362 + Annotation[] actualAnnosArgs = specialAnnoArray; 1.363 + 1.364 + if (singularAnno.contains( 1.365 + e.getEnclosingElement().toString()) 1.366 + || singularAnno.contains( 1.367 + e.getSimpleName().toString()) 1.368 + || unofficialAnno.contains( 1.369 + e.getEnclosingElement().toString()) 1.370 + || unofficialAnno.contains( 1.371 + e.getSimpleName().toString())) { 1.372 + actualAnnosArgs = e.getAnnotations(Foo.class); 1.373 + } 1.374 + if (singularInheritedAnno.contains( 1.375 + e.getEnclosingElement().toString()) 1.376 + || singularInheritedAnno.contains( 1.377 + e.getSimpleName().toString()) 1.378 + || unofficialInheritedAnno.contains( 1.379 + e.getEnclosingElement().toString()) 1.380 + || unofficialInheritedAnno.contains( 1.381 + e.getSimpleName().toString())) { 1.382 + actualAnnosArgs = e.getAnnotations(FooInherited.class); 1.383 + } 1.384 + if (repeatableAnno.contains( 1.385 + e.getEnclosingElement().toString()) 1.386 + || repeatableAnno.contains( 1.387 + e.getSimpleName().toString())) { 1.388 + actualAnnosArgs = e.getAnnotations(Bar.class); 1.389 + } 1.390 + if (repeatableInheritedAnno.contains( 1.391 + e.getEnclosingElement().toString()) 1.392 + || repeatableInheritedAnno.contains( 1.393 + e.getSimpleName().toString())) { 1.394 + actualAnnosArgs = e.getAnnotations(BarInherited.class); 1.395 + } 1.396 + if (repeatableContainerInheritedAnno.contains( 1.397 + e.getEnclosingElement().toString()) 1.398 + || repeatableContainerInheritedAnno.contains( 1.399 + e.getSimpleName().toString())) { 1.400 + actualAnnosArgs = e.getAnnotations(BarInheritedContainer.class); 1.401 + } 1.402 + return actualAnnosArgs; 1.403 + } 1.404 + 1.405 + private Annotation[] getAnnotationsContainer(Element e) { 1.406 + Annotation[] actualAnnosArgs = specialAnnoArray; 1.407 + 1.408 + if (repeatableAnnoContainer.contains( 1.409 + e.getEnclosingElement().toString()) 1.410 + || repeatableAnnoContainer.contains( 1.411 + e.getSimpleName().toString())) { 1.412 + actualAnnosArgs = e.getAnnotations(BarContainer.class); 1.413 + } 1.414 + if (repeatableInheritedAnnoContainer.contains( 1.415 + e.getEnclosingElement().toString()) 1.416 + || repeatableInheritedAnnoContainer.contains( 1.417 + e.getSimpleName().toString())) { 1.418 + actualAnnosArgs = e.getAnnotations(BarInheritedContainer.class); 1.419 + } 1.420 + if (repeatableContainerInheritedAnnoContainer.contains( 1.421 + e.getEnclosingElement().toString()) 1.422 + || repeatableContainerInheritedAnnoContainer.contains( 1.423 + e.getSimpleName().toString())) { 1.424 + actualAnnosArgs = e.getAnnotations(BarInheritedContainerContainer.class); 1.425 + } 1.426 + if (unofficialAnnoContainer.contains( 1.427 + e.getEnclosingElement().toString()) 1.428 + || unofficialAnnoContainer.contains( 1.429 + e.getSimpleName().toString())) { 1.430 + actualAnnosArgs = e.getAnnotations(UnofficialContainer.class); 1.431 + } 1.432 + if (unofficialInheritedAnnoContainer.contains( 1.433 + e.getEnclosingElement().toString()) 1.434 + || unofficialInheritedAnnoContainer.contains( 1.435 + e.getSimpleName().toString())) { 1.436 + actualAnnosArgs = e.getAnnotations(UnofficialInheritedContainer.class); 1.437 + } 1.438 + return actualAnnosArgs; 1.439 + } 1.440 + 1.441 + // Array comparison: Length should be same and all expected values 1.442 + // should be present in actualAnnos[]. 1.443 + private boolean compareArrVals(Annotation[] actualAnnos, String[] expectedAnnos) { 1.444 + // Look if test case was run. 1.445 + if (actualAnnos == specialAnnoArray) { 1.446 + return false; // no testcase matches 1.447 + } 1.448 + if (actualAnnos.length != expectedAnnos.length) { 1.449 + System.out.println("Length not same. " 1.450 + + " actualAnnos length = " + actualAnnos.length 1.451 + + " expectedAnnos length = " + expectedAnnos.length); 1.452 + printArrContents(actualAnnos); 1.453 + printArrContents(expectedAnnos); 1.454 + return false; 1.455 + } else { 1.456 + int i = 0; 1.457 + String[] actualArr = new String[actualAnnos.length]; 1.458 + for (Annotation a : actualAnnos) { 1.459 + actualArr[i++] = a.toString(); 1.460 + } 1.461 + List<String> actualList = Arrays.asList(actualArr); 1.462 + List<String> expectedList = Arrays.asList(expectedAnnos); 1.463 + 1.464 + if (!actualList.containsAll(expectedList)) { 1.465 + System.out.println("Array values are not same"); 1.466 + printArrContents(actualAnnos); 1.467 + printArrContents(expectedAnnos); 1.468 + return false; 1.469 + } 1.470 + } 1.471 + return true; 1.472 + } 1.473 + 1.474 + // Array comparison: Length should be same and all expected values 1.475 + // should be present in actualAnnos List<?>. 1.476 + private boolean compareArrVals(List<? extends AnnotationMirror> actualAnnos, 1.477 + String[] expectedAnnos) { 1.478 + // Look if test case was run. 1.479 + if (actualAnnos == specialAnnoMirrors) { 1.480 + return false; //no testcase run 1.481 + } 1.482 + if (actualAnnos.size() != expectedAnnos.length) { 1.483 + System.out.println("Length not same. " 1.484 + + " actualAnnos length = " + actualAnnos.size() 1.485 + + " expectedAnnos length = " + expectedAnnos.length); 1.486 + printArrContents(actualAnnos); 1.487 + printArrContents(expectedAnnos); 1.488 + return false; 1.489 + } else { 1.490 + int i = 0; 1.491 + String[] actualArr = new String[actualAnnos.size()]; 1.492 + String annoTypeName = ""; 1.493 + for (AnnotationMirror annotationMirror : actualAnnos) { 1.494 + if (annotationMirror.getAnnotationType().toString().contains("Expected")) { 1.495 + annoTypeName = annotationMirror.getAnnotationType().toString(); 1.496 + } else { 1.497 + annoTypeName = annotationMirror.toString(); 1.498 + } 1.499 + actualArr[i++] = annoTypeName; 1.500 + } 1.501 + List<String> actualList = Arrays.asList(actualArr); 1.502 + List<String> expectedList = Arrays.asList(expectedAnnos); 1.503 + 1.504 + if (!actualList.containsAll(expectedList)) { 1.505 + System.out.println("Array values are not same"); 1.506 + printArrContents(actualAnnos); 1.507 + printArrContents(expectedAnnos); 1.508 + return false; 1.509 + } 1.510 + } 1.511 + return true; 1.512 + } 1.513 + 1.514 + private void printArrContents(Annotation[] actualAnnos) { 1.515 + for (Annotation a : actualAnnos) { 1.516 + System.out.println("actualAnnos values = " + a); 1.517 + } 1.518 + } 1.519 + 1.520 + private void printArrContents(String[] expectedAnnos) { 1.521 + for (String s : expectedAnnos) { 1.522 + System.out.println("expectedAnnos values = " + s); 1.523 + } 1.524 + } 1.525 + 1.526 + private void printArrContents(List<? extends AnnotationMirror> actualAnnos) { 1.527 + for (AnnotationMirror annotationMirror : actualAnnos) { 1.528 + System.out.println("actualAnnos values = " + annotationMirror); 1.529 + } 1.530 + } 1.531 + 1.532 + private boolean compareAnnotation(Annotation actualAnno, String expectedAnno) { 1.533 + //String actualAnnoName = ""; 1.534 + boolean isSame = true; 1.535 + // Look if test case was run. 1.536 + if (actualAnno == specialAnno) { 1.537 + return false; //no testcase run 1.538 + } 1.539 + if (actualAnno != null) { 1.540 + if (!actualAnno.toString().equalsIgnoreCase(expectedAnno)) { 1.541 + System.out.println("Anno did not match. " 1.542 + + " expectedAnno = " + expectedAnno 1.543 + + " actualAnno = " + actualAnno); 1.544 + isSame = false; 1.545 + } else { 1.546 + isSame = true; 1.547 + } 1.548 + } else { 1.549 + if (expectedAnno.compareToIgnoreCase("null") == 0) { 1.550 + isSame = true; 1.551 + } else { 1.552 + System.out.println("Actual anno is null"); 1.553 + isSame = false; 1.554 + } 1.555 + } 1.556 + return isSame; 1.557 + } 1.558 +}
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java Tue Feb 12 11:28:45 2013 +0100 2.3 @@ -0,0 +1,119 @@ 2.4 +/* 2.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 + * 2.8 + * This code is free software; you can redistribute it and/or modify it 2.9 + * under the terms of the GNU General Public License version 2 only, as 2.10 + * published by the Free Software Foundation. 2.11 + * 2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 + * version 2 for more details (a copy is included in the LICENSE file that 2.16 + * accompanied this code). 2.17 + * 2.18 + * You should have received a copy of the GNU General Public License version 2.19 + * 2 along with this work; if not, write to the Free Software Foundation, 2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 + * 2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 + * or visit www.oracle.com if you need additional information or have any 2.24 + * questions. 2.25 + */ 2.26 + 2.27 +/* 2.28 + * @test 2.29 + * @bug 8004822 2.30 + * @author mnunez 2.31 + * @summary Language model api test basics for repeating annotations 2.32 + * @library /tools/javac/lib 2.33 + * @library supportingAnnotations 2.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 2.35 + * @compile -processor ElementRepAnnoTester -proc:only 2.36 + * MixRepeatableAndOfficialContainerBasicTest.java 2.37 + */ 2.38 + 2.39 +@ExpectedBase( 2.40 + value = Bar.class, 2.41 + getAnnotation = "@Bar(value=0)", 2.42 + getAnnotationsByType = { 2.43 + "@Bar(value=0)", 2.44 + "@Bar(value=1)", 2.45 + "@Bar(value=2)" 2.46 + }, 2.47 + getAllAnnotationMirrors = { 2.48 + "@Bar(0)", 2.49 + "@BarContainer({@Bar(1), @Bar(2)})", 2.50 + "ExpectedBase", 2.51 + "ExpectedContainer" 2.52 + }, 2.53 + getAnnotationMirrors = { 2.54 + "@Bar(0)", 2.55 + "@BarContainer({@Bar(1), @Bar(2)})", 2.56 + "ExpectedBase", 2.57 + "ExpectedContainer" 2.58 + }) 2.59 +@ExpectedContainer( 2.60 + value = BarContainer.class, 2.61 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 2.62 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 2.63 +@Bar(value = 0) 2.64 +@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 2.65 +class MixRepeatableAndOfficialContainerBasicTest { 2.66 + 2.67 + @ExpectedBase( 2.68 + value = Bar.class, 2.69 + getAnnotation = "@Bar(value=0)", 2.70 + getAnnotationsByType = { 2.71 + "@Bar(value=0)", 2.72 + "@Bar(value=1)", 2.73 + "@Bar(value=2)" 2.74 + }, 2.75 + getAllAnnotationMirrors = { 2.76 + "@Bar(0)", 2.77 + "@BarContainer({@Bar(1), @Bar(2)})", 2.78 + "ExpectedBase", 2.79 + "ExpectedContainer" 2.80 + }, 2.81 + getAnnotationMirrors = { 2.82 + "@Bar(0)", 2.83 + "@BarContainer({@Bar(1), @Bar(2)})", 2.84 + "ExpectedBase", 2.85 + "ExpectedContainer" 2.86 + }) 2.87 + @ExpectedContainer( 2.88 + value = BarContainer.class, 2.89 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 2.90 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 2.91 + @Bar(value = 0) 2.92 + @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 2.93 + int testField = 0; 2.94 + 2.95 + @ExpectedBase( 2.96 + value = Bar.class, 2.97 + getAnnotation = "@Bar(value=0)", 2.98 + getAnnotationsByType = { 2.99 + "@Bar(value=0)", 2.100 + "@Bar(value=1)", 2.101 + "@Bar(value=2)" 2.102 + }, 2.103 + getAllAnnotationMirrors = { 2.104 + "@Bar(0)", 2.105 + "@BarContainer({@Bar(1), @Bar(2)})", 2.106 + "ExpectedBase", 2.107 + "ExpectedContainer" 2.108 + }, 2.109 + getAnnotationMirrors = { 2.110 + "@Bar(0)", 2.111 + "@BarContainer({@Bar(1), @Bar(2)})", 2.112 + "ExpectedBase", 2.113 + "ExpectedContainer" 2.114 + }) 2.115 + @ExpectedContainer( 2.116 + value = BarContainer.class, 2.117 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 2.118 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 2.119 + @Bar(value = 0) 2.120 + @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 2.121 + void testMethod() {} 2.122 + }
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA1Test.java Tue Feb 12 11:28:45 2013 +0100 3.3 @@ -0,0 +1,65 @@ 3.4 +/* 3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/* 3.28 + * @ignore 3.29 + * @test 3.30 + * @bug 8004822 3.31 + * @author mnunez 3.32 + * @summary Language model api test basics for repeating annotations 3.33 + * @library /tools/javac/lib 3.34 + * @library supportingAnnotations 3.35 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 3.36 + * @compile -processor ElementRepAnnoTester -proc:only 3.37 + * MixRepeatableAndOfficialContainerInheritedA1Test.java 3.38 + */ 3.39 + 3.40 +@BarInherited(value = 0) 3.41 +class E {} 3.42 + 3.43 +@ExpectedBase( 3.44 + value = BarInherited.class, 3.45 + getAnnotation = "@BarInherited(value=0)", 3.46 + getAnnotationsByType = { 3.47 + "@BarInherited(value=1)", 3.48 + "@BarInherited(value=2)" 3.49 + }, 3.50 + getAllAnnotationMirrors = { 3.51 + "@BarInherited(0)", 3.52 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 3.53 + "ExpectedBase", 3.54 + "ExpectedContainer" 3.55 + }, 3.56 + getAnnotationMirrors = { 3.57 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 3.58 + "ExpectedBase", 3.59 + "ExpectedContainer" 3.60 + }) 3.61 +@ExpectedContainer( 3.62 + value = BarInheritedContainer.class, 3.63 + getAnnotation = "@BarInheritedContainer(" 3.64 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 3.65 + getAnnotationsByType = {"@BarInheritedContainer(" 3.66 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 3.67 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) 3.68 +class MixRepeatableAndOfficialContainerInheritedA1Test extends E {}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedA2Test.java Tue Feb 12 11:28:45 2013 +0100 4.3 @@ -0,0 +1,67 @@ 4.4 +/* 4.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +/* 4.28 + * @test 4.29 + * @bug 8004822 4.30 + * @author mnunez 4.31 + * @summary Language model api test basics for repeating annotations 4.32 + * @library /tools/javac/lib 4.33 + * @library supportingAnnotations 4.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 4.35 + * @compile -processor ElementRepAnnoTester -proc:only 4.36 + * MixRepeatableAndOfficialContainerInheritedA2Test.java 4.37 + */ 4.38 + 4.39 +@BarInherited(value = 0) 4.40 +class N {} 4.41 + 4.42 +@ExpectedBase( 4.43 + value = BarInherited.class, 4.44 + getAnnotation = "@BarInherited(value=3)", 4.45 + getAnnotationsByType = { 4.46 + "@BarInherited(value=1)", 4.47 + "@BarInherited(value=2)", 4.48 + "@BarInherited(value=3)" 4.49 + }, 4.50 + getAllAnnotationMirrors = { 4.51 + "@BarInherited(3)", 4.52 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 4.53 + "ExpectedBase", 4.54 + "ExpectedContainer" 4.55 + }, 4.56 + getAnnotationMirrors = { 4.57 + "@BarInherited(3)", 4.58 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 4.59 + "ExpectedBase", 4.60 + "ExpectedContainer" 4.61 + }) 4.62 +@ExpectedContainer( 4.63 + value = BarInheritedContainer.class, 4.64 + getAnnotation = "@BarInheritedContainer(" 4.65 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 4.66 + getAnnotationsByType = {"@BarInheritedContainer(" 4.67 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 4.68 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) 4.69 +@BarInherited(value = 3) 4.70 +class MixRepeatableAndOfficialContainerInheritedA2Test extends N {}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB1Test.java Tue Feb 12 11:28:45 2013 +0100 5.3 @@ -0,0 +1,62 @@ 5.4 +/* 5.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 + * 5.8 + * This code is free software; you can redistribute it and/or modify it 5.9 + * under the terms of the GNU General Public License version 2 only, as 5.10 + * published by the Free Software Foundation. 5.11 + * 5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 + * version 2 for more details (a copy is included in the LICENSE file that 5.16 + * accompanied this code). 5.17 + * 5.18 + * You should have received a copy of the GNU General Public License version 5.19 + * 2 along with this work; if not, write to the Free Software Foundation, 5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 + * 5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 + * or visit www.oracle.com if you need additional information or have any 5.24 + * questions. 5.25 + */ 5.26 + 5.27 +/* 5.28 + * @ignore 5.29 + * @test 5.30 + * @bug 8004822 5.31 + * @author mnunez 5.32 + * @summary Language model api test basics for repeating annotations 5.33 + * @library /tools/javac/lib 5.34 + * @library supportingAnnotations 5.35 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 5.36 + * @compile -processor ElementRepAnnoTester -proc:only 5.37 + * MixRepeatableAndOfficialContainerInheritedB1Test.java 5.38 + */ 5.39 + 5.40 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) 5.41 +class M {} 5.42 + 5.43 +@ExpectedBase( 5.44 + value = BarInherited.class, 5.45 + getAnnotation = "@BarInherited(value=0)", 5.46 + getAnnotationsByType = {"@BarInherited(value=0)"}, 5.47 + getAllAnnotationMirrors = { 5.48 + "@BarInherited(0)", 5.49 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 5.50 + "ExpectedBase", 5.51 + "ExpectedContainer" 5.52 + }, 5.53 + getAnnotationMirrors = { 5.54 + "@BarInherited(0)", 5.55 + "ExpectedBase", 5.56 + "ExpectedContainer" 5.57 + }) 5.58 +@ExpectedContainer( 5.59 + value = BarInheritedContainer.class, 5.60 + getAnnotation = "@BarInheritedContainer(" 5.61 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 5.62 + getAnnotationsByType = {"@BarInheritedContainer(" 5.63 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 5.64 +@BarInherited(value = 0) 5.65 +class MixRepeatableAndOfficialContainerInheritedB1Test extends M {}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerInheritedB2Test.java Tue Feb 12 11:28:45 2013 +0100 6.3 @@ -0,0 +1,63 @@ 6.4 +/* 6.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 + * 6.8 + * This code is free software; you can redistribute it and/or modify it 6.9 + * under the terms of the GNU General Public License version 2 only, as 6.10 + * published by the Free Software Foundation. 6.11 + * 6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.15 + * version 2 for more details (a copy is included in the LICENSE file that 6.16 + * accompanied this code). 6.17 + * 6.18 + * You should have received a copy of the GNU General Public License version 6.19 + * 2 along with this work; if not, write to the Free Software Foundation, 6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.21 + * 6.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.23 + * or visit www.oracle.com if you need additional information or have any 6.24 + * questions. 6.25 + */ 6.26 + 6.27 +/* 6.28 + * @ignore 6.29 + * @test 6.30 + * @bug 8004822 6.31 + * @author mnunez 6.32 + * @summary Language model api test basics for repeating annotations 6.33 + * @library /tools/javac/lib 6.34 + * @library supportingAnnotations 6.35 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 6.36 + * @compile -processor ElementRepAnnoTester -proc:only 6.37 + * MixRepeatableAndOfficialContainerInheritedB2Test.java 6.38 + */ 6.39 + 6.40 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) 6.41 +@BarInherited(value = 3) 6.42 +class H {} 6.43 + 6.44 +@ExpectedBase( 6.45 + value = BarInherited.class, 6.46 + getAnnotation = "@BarInherited(value=0)", 6.47 + getAnnotationsByType = {"@BarInherited(value=0)"}, 6.48 + getAllAnnotationMirrors = { 6.49 + "@BarInherited(0)", 6.50 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 6.51 + "ExpectedBase", 6.52 + "ExpectedContainer" 6.53 + }, 6.54 + getAnnotationMirrors = { 6.55 + "@BarInherited(0)", 6.56 + "ExpectedBase", 6.57 + "ExpectedContainer" 6.58 + }) 6.59 +@ExpectedContainer( 6.60 + value = BarInheritedContainer.class, 6.61 + getAnnotation = "@BarInheritedContainer(" 6.62 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 6.63 + getAnnotationsByType = {"@BarInheritedContainer(" 6.64 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 6.65 +@BarInherited(value = 0) 6.66 +class MixRepeatableAndOfficialContainerInheritedB2Test extends H {}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerBasicTest.java Tue Feb 12 11:28:45 2013 +0100 7.3 @@ -0,0 +1,112 @@ 7.4 +/* 7.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 + * or visit www.oracle.com if you need additional information or have any 7.24 + * questions. 7.25 + */ 7.26 + 7.27 +/* 7.28 + * @test 7.29 + * @bug 8004822 7.30 + * @author mnunez 7.31 + * @summary Language model api test basics for repeating annotations 7.32 + * @library /tools/javac/lib 7.33 + * @library supportingAnnotations 7.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 7.35 + * @compile -processor ElementRepAnnoTester -proc:only MixSingularAndUnofficialContainerBasicTest.java 7.36 + */ 7.37 + 7.38 +@ExpectedBase( 7.39 + value = Foo.class, 7.40 + getAnnotation = "@Foo(value=0)", 7.41 + getAnnotationsByType = {"@Foo(value=0)"}, 7.42 + getAllAnnotationMirrors = { 7.43 + "@Foo(0)", 7.44 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 7.45 + "ExpectedBase", 7.46 + "ExpectedContainer" 7.47 + }, 7.48 + getAnnotationMirrors = { 7.49 + "@Foo(0)", 7.50 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 7.51 + "ExpectedBase", 7.52 + "ExpectedContainer" 7.53 + }) 7.54 +@ExpectedContainer( 7.55 + value = UnofficialContainer.class, 7.56 + getAnnotation = "@UnofficialContainer(" 7.57 + + "value=[@Foo(value=1), @Foo(value=2)])", 7.58 + getAnnotationsByType = {"@UnofficialContainer(" 7.59 + + "value=[@Foo(value=1), @Foo(value=2)])"}) 7.60 +@Foo(value = 0) 7.61 +@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 7.62 +class MixSingularAndUnofficialContainerBasicTest { 7.63 + 7.64 + @ExpectedBase( 7.65 + value = Foo.class, 7.66 + getAnnotation = "@Foo(value=0)", 7.67 + getAnnotationsByType = {"@Foo(value=0)"}, 7.68 + getAllAnnotationMirrors = { 7.69 + "@Foo(0)", 7.70 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 7.71 + "ExpectedBase", 7.72 + "ExpectedContainer" 7.73 + }, 7.74 + getAnnotationMirrors = { 7.75 + "@Foo(0)", 7.76 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 7.77 + "ExpectedBase", 7.78 + "ExpectedContainer" 7.79 + }) 7.80 + @ExpectedContainer( 7.81 + value = UnofficialContainer.class, 7.82 + getAnnotation = "@UnofficialContainer(" 7.83 + + "value=[@Foo(value=1), @Foo(value=2)])", 7.84 + getAnnotationsByType = {"@UnofficialContainer(" 7.85 + + "value=[@Foo(value=1), @Foo(value=2)])"}) 7.86 + @Foo(value = 0) 7.87 + @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 7.88 + int testField = 0; 7.89 + 7.90 + @ExpectedBase( 7.91 + value = Foo.class, 7.92 + getAnnotation = "@Foo(value=0)", 7.93 + getAnnotationsByType = {"@Foo(value=0)"}, 7.94 + getAllAnnotationMirrors = { 7.95 + "@Foo(0)", 7.96 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 7.97 + "ExpectedBase", 7.98 + "ExpectedContainer" 7.99 + }, 7.100 + getAnnotationMirrors = { 7.101 + "@Foo(0)", 7.102 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 7.103 + "ExpectedBase", 7.104 + "ExpectedContainer" 7.105 + }) 7.106 + @ExpectedContainer( 7.107 + value = UnofficialContainer.class, 7.108 + getAnnotation = "@UnofficialContainer(" 7.109 + + "value=[@Foo(value=1), @Foo(value=2)])", 7.110 + getAnnotationsByType = {"@UnofficialContainer(" 7.111 + + "value=[@Foo(value=1), @Foo(value=2)])"}) 7.112 + @Foo(value = 0) 7.113 + @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 7.114 + void testMethod() {} 7.115 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA1Test.java Tue Feb 12 11:28:45 2013 +0100 8.3 @@ -0,0 +1,61 @@ 8.4 +/* 8.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. 8.11 + * 8.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.15 + * version 2 for more details (a copy is included in the LICENSE file that 8.16 + * accompanied this code). 8.17 + * 8.18 + * You should have received a copy of the GNU General Public License version 8.19 + * 2 along with this work; if not, write to the Free Software Foundation, 8.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.21 + * 8.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.23 + * or visit www.oracle.com if you need additional information or have any 8.24 + * questions. 8.25 + */ 8.26 + 8.27 +/* 8.28 + * @test 8.29 + * @bug 8004822 8.30 + * @author mnunez 8.31 + * @summary Language model api test basics for repeating annotations 8.32 + * @library /tools/javac/lib 8.33 + * @library supportingAnnotations 8.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 8.35 + * @compile -processor ElementRepAnnoTester -proc:only 8.36 + * MixSingularAndUnofficialContainerInheritedA1Test.java 8.37 + */ 8.38 + 8.39 +@FooInherited(value = 0) 8.40 +class L {} 8.41 + 8.42 +@ExpectedBase( 8.43 + value = FooInherited.class, 8.44 + getAnnotation = "@FooInherited(value=0)", 8.45 + getAnnotationsByType = {"@FooInherited(value=0)"}, 8.46 + getAllAnnotationMirrors = { 8.47 + "@FooInherited(0)", 8.48 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 8.49 + "ExpectedBase", 8.50 + "ExpectedContainer" 8.51 + }, 8.52 + getAnnotationMirrors = { 8.53 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 8.54 + "ExpectedBase", 8.55 + "ExpectedContainer" 8.56 + }) 8.57 +@ExpectedContainer( 8.58 + value = UnofficialInheritedContainer.class, 8.59 + getAnnotation = "@UnofficialInheritedContainer(" 8.60 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])", 8.61 + getAnnotationsByType = {"@UnofficialInheritedContainer(" 8.62 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) 8.63 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)}) 8.64 +class MixSingularAndUnofficialContainerInheritedA1Test extends L {}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedA2Test.java Tue Feb 12 11:28:45 2013 +0100 9.3 @@ -0,0 +1,63 @@ 9.4 +/* 9.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. 9.11 + * 9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.15 + * version 2 for more details (a copy is included in the LICENSE file that 9.16 + * accompanied this code). 9.17 + * 9.18 + * You should have received a copy of the GNU General Public License version 9.19 + * 2 along with this work; if not, write to the Free Software Foundation, 9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.21 + * 9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.23 + * or visit www.oracle.com if you need additional information or have any 9.24 + * questions. 9.25 + */ 9.26 + 9.27 +/* 9.28 + * @test 9.29 + * @bug 8004822 9.30 + * @author mnunez 9.31 + * @summary Language model api test basics for repeating annotations 9.32 + * @library /tools/javac/lib 9.33 + * @library supportingAnnotations 9.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 9.35 + * @compile -processor ElementRepAnnoTester -proc:only 9.36 + * MixSingularAndUnofficialContainerInheritedA2Test.java 9.37 + */ 9.38 + 9.39 +@FooInherited(value = 0) 9.40 +class K {} 9.41 + 9.42 +@ExpectedBase( 9.43 + value = FooInherited.class, 9.44 + getAnnotation = "@FooInherited(value=3)", 9.45 + getAnnotationsByType = {"@FooInherited(value=3)"}, 9.46 + getAllAnnotationMirrors = { 9.47 + "@FooInherited(3)", 9.48 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 9.49 + "ExpectedBase", 9.50 + "ExpectedContainer" 9.51 + }, 9.52 + getAnnotationMirrors = { 9.53 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 9.54 + "@FooInherited(3)", 9.55 + "ExpectedBase", 9.56 + "ExpectedContainer" 9.57 + }) 9.58 +@ExpectedContainer( 9.59 + value = UnofficialInheritedContainer.class, 9.60 + getAnnotation = "@UnofficialInheritedContainer(" 9.61 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])", 9.62 + getAnnotationsByType = {"@UnofficialInheritedContainer(" 9.63 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) 9.64 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)}) 9.65 +@FooInherited(value = 3) 9.66 +class MixSingularAndUnofficialContainerInheritedA2Test extends K {}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB1Test.java Tue Feb 12 11:28:45 2013 +0100 10.3 @@ -0,0 +1,61 @@ 10.4 +/* 10.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 + * 10.8 + * This code is free software; you can redistribute it and/or modify it 10.9 + * under the terms of the GNU General Public License version 2 only, as 10.10 + * published by the Free Software Foundation. 10.11 + * 10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.15 + * version 2 for more details (a copy is included in the LICENSE file that 10.16 + * accompanied this code). 10.17 + * 10.18 + * You should have received a copy of the GNU General Public License version 10.19 + * 2 along with this work; if not, write to the Free Software Foundation, 10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.21 + * 10.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.23 + * or visit www.oracle.com if you need additional information or have any 10.24 + * questions. 10.25 + */ 10.26 + 10.27 +/* 10.28 + * @test 10.29 + * @bug 8004822 10.30 + * @author mnunez 10.31 + * @summary Language model api test basics for repeating annotations 10.32 + * @library /tools/javac/lib 10.33 + * @library supportingAnnotations 10.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 10.35 + * @compile -processor ElementRepAnnoTester -proc:only 10.36 + * MixSingularAndUnofficialContainerInheritedB1Test.java 10.37 + */ 10.38 + 10.39 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)}) 10.40 +class J {} 10.41 + 10.42 +@ExpectedBase( 10.43 + value = FooInherited.class, 10.44 + getAnnotation = "@FooInherited(value=0)", 10.45 + getAnnotationsByType = {"@FooInherited(value=0)"}, 10.46 + getAllAnnotationMirrors = { 10.47 + "@FooInherited(0)", 10.48 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 10.49 + "ExpectedBase", 10.50 + "ExpectedContainer" 10.51 + }, 10.52 + getAnnotationMirrors = { 10.53 + "@FooInherited(0)", 10.54 + "ExpectedBase", 10.55 + "ExpectedContainer" 10.56 + }) 10.57 +@ExpectedContainer( 10.58 + value = UnofficialInheritedContainer.class, 10.59 + getAnnotation = "@UnofficialInheritedContainer(" 10.60 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])", 10.61 + getAnnotationsByType = {"@UnofficialInheritedContainer(" 10.62 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) 10.63 +@FooInherited(value = 0) 10.64 +class MixSingularAndUnofficialContainerInheritedB1Test extends J {}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/MixSingularAndUnofficialContainerInheritedB2Test.java Tue Feb 12 11:28:45 2013 +0100 11.3 @@ -0,0 +1,62 @@ 11.4 +/* 11.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 11.7 + * 11.8 + * This code is free software; you can redistribute it and/or modify it 11.9 + * under the terms of the GNU General Public License version 2 only, as 11.10 + * published by the Free Software Foundation. 11.11 + * 11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 11.15 + * version 2 for more details (a copy is included in the LICENSE file that 11.16 + * accompanied this code). 11.17 + * 11.18 + * You should have received a copy of the GNU General Public License version 11.19 + * 2 along with this work; if not, write to the Free Software Foundation, 11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 11.21 + * 11.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 11.23 + * or visit www.oracle.com if you need additional information or have any 11.24 + * questions. 11.25 + */ 11.26 + 11.27 +/* 11.28 + * @test 11.29 + * @bug 8004822 11.30 + * @author mnunez 11.31 + * @summary Language model api test basics for repeating annotations 11.32 + * @library /tools/javac/lib 11.33 + * @library supportingAnnotations 11.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 11.35 + * @compile -processor ElementRepAnnoTester -proc:only 11.36 + * MixSingularAndUnofficialContainerInheritedB2Test.java 11.37 + */ 11.38 + 11.39 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1), @FooInherited(value = 2)}) 11.40 +@FooInherited(value = 3) 11.41 +class G {} 11.42 + 11.43 +@ExpectedBase( 11.44 + value = FooInherited.class, 11.45 + getAnnotation = "@FooInherited(value=0)", 11.46 + getAnnotationsByType = {"@FooInherited(value=0)"}, 11.47 + getAllAnnotationMirrors = { 11.48 + "@FooInherited(0)", 11.49 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 11.50 + "ExpectedBase", 11.51 + "ExpectedContainer" 11.52 + }, 11.53 + getAnnotationMirrors = { 11.54 + "@FooInherited(0)", 11.55 + "ExpectedBase", 11.56 + "ExpectedContainer" 11.57 + }) 11.58 +@ExpectedContainer( 11.59 + value = UnofficialInheritedContainer.class, 11.60 + getAnnotation = "@UnofficialInheritedContainer(" 11.61 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])", 11.62 + getAnnotationsByType = {"@UnofficialInheritedContainer(" 11.63 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) 11.64 +@FooInherited(value = 0) 11.65 +class MixSingularAndUnofficialContainerInheritedB2Test extends G{}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerBasicTest.java Tue Feb 12 11:28:45 2013 +0100 12.3 @@ -0,0 +1,106 @@ 12.4 +/* 12.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 12.7 + * 12.8 + * This code is free software; you can redistribute it and/or modify it 12.9 + * under the terms of the GNU General Public License version 2 only, as 12.10 + * published by the Free Software Foundation. 12.11 + * 12.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 12.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12.15 + * version 2 for more details (a copy is included in the LICENSE file that 12.16 + * accompanied this code). 12.17 + * 12.18 + * You should have received a copy of the GNU General Public License version 12.19 + * 2 along with this work; if not, write to the Free Software Foundation, 12.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 12.21 + * 12.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 12.23 + * or visit www.oracle.com if you need additional information or have any 12.24 + * questions. 12.25 + */ 12.26 + 12.27 +/* 12.28 + * @test 12.29 + * @bug 8004822 12.30 + * @author mnunez 12.31 + * @summary Language model api test basics for repeating annotations 12.32 + * @library /tools/javac/lib 12.33 + * @library supportingAnnotations 12.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 12.35 + * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerBasicTest.java 12.36 + */ 12.37 + 12.38 +@ExpectedBase( 12.39 + value = Bar.class, 12.40 + getAnnotation = "null", 12.41 + getAnnotationsByType = { 12.42 + "@Bar(value=1)", 12.43 + "@Bar(value=2)" 12.44 + }, 12.45 + getAllAnnotationMirrors = { 12.46 + "@BarContainer({@Bar(1), @Bar(2)})", 12.47 + "ExpectedBase", 12.48 + "ExpectedContainer" 12.49 + }, 12.50 + getAnnotationMirrors = { 12.51 + "@BarContainer({@Bar(1), @Bar(2)})", 12.52 + "ExpectedBase", 12.53 + "ExpectedContainer" 12.54 + }) 12.55 +@ExpectedContainer( 12.56 + value = BarContainer.class, 12.57 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 12.58 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 12.59 +@BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 12.60 +class OfficialContainerBasicTest { 12.61 + 12.62 + @ExpectedBase( 12.63 + value = Bar.class, 12.64 + getAnnotation = "null", 12.65 + getAnnotationsByType = { 12.66 + "@Bar(value=1)", 12.67 + "@Bar(value=2)" 12.68 + }, 12.69 + getAllAnnotationMirrors = { 12.70 + "@BarContainer({@Bar(1), @Bar(2)})", 12.71 + "ExpectedBase", 12.72 + "ExpectedContainer" 12.73 + }, 12.74 + getAnnotationMirrors = { 12.75 + "@BarContainer({@Bar(1), @Bar(2)})", 12.76 + "ExpectedBase", 12.77 + "ExpectedContainer" 12.78 + }) 12.79 + @ExpectedContainer( 12.80 + value = BarContainer.class, 12.81 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 12.82 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 12.83 + @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 12.84 + int testField = 0; 12.85 + 12.86 + @ExpectedBase( 12.87 + value = Bar.class, 12.88 + getAnnotation = "null", 12.89 + getAnnotationsByType = { 12.90 + "@Bar(value=1)", 12.91 + "@Bar(value=2)" 12.92 + }, 12.93 + getAllAnnotationMirrors = { 12.94 + "@BarContainer({@Bar(1), @Bar(2)})", 12.95 + "ExpectedBase", 12.96 + "ExpectedContainer" 12.97 + }, 12.98 + getAnnotationMirrors = { 12.99 + "@BarContainer({@Bar(1), @Bar(2)})", 12.100 + "ExpectedBase", 12.101 + "ExpectedContainer" 12.102 + }) 12.103 + @ExpectedContainer( 12.104 + value = BarContainer.class, 12.105 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 12.106 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 12.107 + @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 12.108 + void testMethod() {} 12.109 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/OfficialContainerInheritedTest.java Tue Feb 12 11:28:45 2013 +0100 13.3 @@ -0,0 +1,60 @@ 13.4 +/* 13.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 + * 13.8 + * This code is free software; you can redistribute it and/or modify it 13.9 + * under the terms of the GNU General Public License version 2 only, as 13.10 + * published by the Free Software Foundation. 13.11 + * 13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 + * version 2 for more details (a copy is included in the LICENSE file that 13.16 + * accompanied this code). 13.17 + * 13.18 + * You should have received a copy of the GNU General Public License version 13.19 + * 2 along with this work; if not, write to the Free Software Foundation, 13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 + * 13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 + * or visit www.oracle.com if you need additional information or have any 13.24 + * questions. 13.25 + */ 13.26 + 13.27 +/* 13.28 + * @test 13.29 + * @bug 8004822 13.30 + * @author mnunez 13.31 + * @summary Language model api test basics for repeating annotations 13.32 + * @library /tools/javac/lib 13.33 + * @library supportingAnnotations 13.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 13.35 + * @compile -processor ElementRepAnnoTester -proc:only OfficialContainerInheritedTest.java 13.36 + */ 13.37 + 13.38 +@BarInheritedContainer(value = {@BarInherited(value = 1), @BarInherited(value = 2)}) 13.39 +class D {} 13.40 + 13.41 +@ExpectedBase( 13.42 + value = BarInherited.class, 13.43 + getAnnotation = "null", 13.44 + getAnnotationsByType = { 13.45 + "@BarInherited(value=1)", 13.46 + "@BarInherited(value=2)" 13.47 + }, 13.48 + getAllAnnotationMirrors = { 13.49 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 13.50 + "ExpectedBase", 13.51 + "ExpectedContainer" 13.52 + }, 13.53 + getAnnotationMirrors = { 13.54 + "ExpectedBase", 13.55 + "ExpectedContainer" 13.56 + }) 13.57 +@ExpectedContainer( 13.58 + value = BarInheritedContainer.class, 13.59 + getAnnotation = "@BarInheritedContainer(" 13.60 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 13.61 + getAnnotationsByType = {"@BarInheritedContainer(" 13.62 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 13.63 +class OfficialContainerInheritedTest extends D {}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java Tue Feb 12 11:28:45 2013 +0100 14.3 @@ -0,0 +1,109 @@ 14.4 +/* 14.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 + * 14.8 + * This code is free software; you can redistribute it and/or modify it 14.9 + * under the terms of the GNU General Public License version 2 only, as 14.10 + * published by the Free Software Foundation. 14.11 + * 14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 + * version 2 for more details (a copy is included in the LICENSE file that 14.16 + * accompanied this code). 14.17 + * 14.18 + * You should have received a copy of the GNU General Public License version 14.19 + * 2 along with this work; if not, write to the Free Software Foundation, 14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 + * 14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 + * or visit www.oracle.com if you need additional information or have any 14.24 + * questions. 14.25 + */ 14.26 + 14.27 +/* 14.28 + * @test 14.29 + * @bug 8004822 14.30 + * @author mnunez 14.31 + * @summary Language model api test basics for repeating annotations 14.32 + * @library /tools/javac/lib 14.33 + * @library supportingAnnotations 14.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 14.35 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableBasicTest.java 14.36 + */ 14.37 + 14.38 +@ExpectedBase( 14.39 + value = Bar.class, 14.40 + getAnnotation = "null", 14.41 + getAnnotationsByType = { 14.42 + "@Bar(value=1)", 14.43 + "@Bar(value=2)" 14.44 + }, 14.45 + getAllAnnotationMirrors = { 14.46 + "@BarContainer({@Bar(1), @Bar(2)})", 14.47 + "ExpectedBase", 14.48 + "ExpectedContainer" 14.49 + }, 14.50 + getAnnotationMirrors = { 14.51 + "@BarContainer({@Bar(1), @Bar(2)})", 14.52 + "ExpectedBase", 14.53 + "ExpectedContainer" 14.54 + }) 14.55 +@ExpectedContainer( 14.56 + value = BarContainer.class, 14.57 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 14.58 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 14.59 +@Bar(value = 1) 14.60 +@Bar(value = 2) 14.61 +class RepeatableBasicTest { 14.62 + 14.63 + @ExpectedBase( 14.64 + value = Bar.class, 14.65 + getAnnotation = "null", 14.66 + getAnnotationsByType = { 14.67 + "@Bar(value=1)", 14.68 + "@Bar(value=2)" 14.69 + }, 14.70 + getAllAnnotationMirrors = { 14.71 + "@BarContainer({@Bar(1), @Bar(2)})", 14.72 + "ExpectedBase", 14.73 + "ExpectedContainer" 14.74 + }, 14.75 + getAnnotationMirrors = { 14.76 + "@BarContainer({@Bar(1), @Bar(2)})", 14.77 + "ExpectedBase", 14.78 + "ExpectedContainer" 14.79 + }) 14.80 + @ExpectedContainer( 14.81 + value = BarContainer.class, 14.82 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 14.83 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 14.84 + @Bar(value = 1) 14.85 + @Bar(value = 2) 14.86 + int testField = 0; 14.87 + 14.88 + @ExpectedBase( 14.89 + value = Bar.class, 14.90 + getAnnotation = "null", 14.91 + getAnnotationsByType = { 14.92 + "@Bar(value=1)", 14.93 + "@Bar(value=2)" 14.94 + }, 14.95 + getAllAnnotationMirrors = { 14.96 + "@BarContainer({@Bar(1), @Bar(2)})", 14.97 + "ExpectedBase", 14.98 + "ExpectedContainer" 14.99 + }, 14.100 + getAnnotationMirrors = { 14.101 + "@BarContainer({@Bar(1), @Bar(2)})", 14.102 + "ExpectedBase", 14.103 + "ExpectedContainer" 14.104 + }) 14.105 + @ExpectedContainer( 14.106 + value = BarContainer.class, 14.107 + getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 14.108 + getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 14.109 + @Bar(value = 1) 14.110 + @Bar(value = 2) 14.111 + void testMethod() {} 14.112 +}
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableInheritedTest.java Tue Feb 12 11:28:45 2013 +0100 15.3 @@ -0,0 +1,61 @@ 15.4 +/* 15.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 + * 15.8 + * This code is free software; you can redistribute it and/or modify it 15.9 + * under the terms of the GNU General Public License version 2 only, as 15.10 + * published by the Free Software Foundation. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.23 + * or visit www.oracle.com if you need additional information or have any 15.24 + * questions. 15.25 + */ 15.26 + 15.27 +/* 15.28 + * @test 15.29 + * @bug 8004822 15.30 + * @author mnunez 15.31 + * @summary Language model api test basics for repeating annotations 15.32 + * @library /tools/javac/lib 15.33 + * @library supportingAnnotations 15.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 15.35 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableInheritedTest.java 15.36 + */ 15.37 + 15.38 +@BarInherited(value = 1) 15.39 +@BarInherited(value = 2) 15.40 +class I {} 15.41 + 15.42 +@ExpectedBase( 15.43 + value = BarInherited.class, 15.44 + getAnnotation = "null", 15.45 + getAnnotationsByType = { 15.46 + "@BarInherited(value=1)", 15.47 + "@BarInherited(value=2)" 15.48 + }, 15.49 + getAllAnnotationMirrors = { 15.50 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 15.51 + "ExpectedBase", 15.52 + "ExpectedContainer" 15.53 + }, 15.54 + getAnnotationMirrors = { 15.55 + "ExpectedBase", 15.56 + "ExpectedContainer" 15.57 + }) 15.58 +@ExpectedContainer( 15.59 + value = BarInheritedContainer.class, 15.60 + getAnnotation = "@BarInheritedContainer(" 15.61 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 15.62 + getAnnotationsByType = {"@BarInheritedContainer(" 15.63 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 15.64 +class RepeatableInheritedTest extends I {}
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 16.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerBasicTest.java Tue Feb 12 11:28:45 2013 +0100 16.3 @@ -0,0 +1,106 @@ 16.4 +/* 16.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 + * 16.8 + * This code is free software; you can redistribute it and/or modify it 16.9 + * under the terms of the GNU General Public License version 2 only, as 16.10 + * published by the Free Software Foundation. 16.11 + * 16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 + * version 2 for more details (a copy is included in the LICENSE file that 16.16 + * accompanied this code). 16.17 + * 16.18 + * You should have received a copy of the GNU General Public License version 16.19 + * 2 along with this work; if not, write to the Free Software Foundation, 16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 + * 16.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.23 + * or visit www.oracle.com if you need additional information or have any 16.24 + * questions. 16.25 + */ 16.26 + 16.27 +/* 16.28 + * @test 16.29 + * @bug 8004822 16.30 + * @author mnunez 16.31 + * @summary Language model api test basics for repeating annotations 16.32 + * @library /tools/javac/lib 16.33 + * @library supportingAnnotations 16.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 16.35 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableOfficialContainerBasicTest.java 16.36 + */ 16.37 + 16.38 +@ExpectedBase( 16.39 + value = Bar.class, 16.40 + getAnnotation = "null", 16.41 + getAnnotationsByType = {}, 16.42 + getAllAnnotationMirrors = { 16.43 + "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})", 16.44 + "ExpectedBase", 16.45 + "ExpectedContainer" 16.46 + }, 16.47 + getAnnotationMirrors = { 16.48 + "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})", 16.49 + "ExpectedBase", 16.50 + "ExpectedContainer" 16.51 + }) 16.52 +@ExpectedContainer( 16.53 + value = BarContainer.class, 16.54 + getAnnotation = "null", 16.55 + getAnnotationsByType = { 16.56 + "@BarContainer(value=[@Bar(value=1)])", 16.57 + "@BarContainer(value=[@Bar(value=2)])"}) 16.58 +@BarContainer(value = {@Bar(value = 1)}) 16.59 +@BarContainer(value = {@Bar(value = 2)}) 16.60 +class RepeatableOfficialContainerBasicTest { 16.61 + 16.62 + @ExpectedBase( 16.63 + value = Bar.class, 16.64 + getAnnotation = "null", 16.65 + getAnnotationsByType = {}, 16.66 + getAllAnnotationMirrors = { 16.67 + "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})", 16.68 + "ExpectedBase", 16.69 + "ExpectedContainer" 16.70 + }, 16.71 + getAnnotationMirrors = { 16.72 + "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})", 16.73 + "ExpectedBase", 16.74 + "ExpectedContainer" 16.75 + }) 16.76 + @ExpectedContainer( 16.77 + value = BarContainer.class, 16.78 + getAnnotation = "null", 16.79 + getAnnotationsByType = { 16.80 + "@BarContainer(value=[@Bar(value=1)])", 16.81 + "@BarContainer(value=[@Bar(value=2)])"}) 16.82 + @BarContainer(value = {@Bar(value = 1)}) 16.83 + @BarContainer(value = {@Bar(value = 2)}) 16.84 + int testField = 0; 16.85 + 16.86 + @ExpectedBase( 16.87 + value = Bar.class, 16.88 + getAnnotation = "null", 16.89 + getAnnotationsByType = {}, 16.90 + getAllAnnotationMirrors = { 16.91 + "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})", 16.92 + "ExpectedBase", 16.93 + "ExpectedContainer" 16.94 + }, 16.95 + getAnnotationMirrors = { 16.96 + "@BarContainerContainer({@BarContainer({@Bar(1)}), @BarContainer({@Bar(2)})})", 16.97 + "ExpectedBase", 16.98 + "ExpectedContainer" 16.99 + }) 16.100 + @ExpectedContainer( 16.101 + value = BarContainer.class, 16.102 + getAnnotation = "null", 16.103 + getAnnotationsByType = { 16.104 + "@BarContainer(value=[@Bar(value=1)])", 16.105 + "@BarContainer(value=[@Bar(value=2)])"}) 16.106 + @BarContainer(value = {@Bar(value = 1)}) 16.107 + @BarContainer(value = {@Bar(value = 2)}) 16.108 + void testMethod() {} 16.109 +}
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 17.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOfficialContainerInheritedTest.java Tue Feb 12 11:28:45 2013 +0100 17.3 @@ -0,0 +1,66 @@ 17.4 +/* 17.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 + * 17.8 + * This code is free software; you can redistribute it and/or modify it 17.9 + * under the terms of the GNU General Public License version 2 only, as 17.10 + * published by the Free Software Foundation. 17.11 + * 17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 + * version 2 for more details (a copy is included in the LICENSE file that 17.16 + * accompanied this code). 17.17 + * 17.18 + * You should have received a copy of the GNU General Public License version 17.19 + * 2 along with this work; if not, write to the Free Software Foundation, 17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 + * 17.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 17.23 + * or visit www.oracle.com if you need additional information or have any 17.24 + * questions. 17.25 + */ 17.26 + 17.27 +/* 17.28 + * @test 17.29 + * @bug 8004822 17.30 + * @author mnunez 17.31 + * @summary Language model api test basics for repeating annotations 17.32 + * @library /tools/javac/lib 17.33 + * @library supportingAnnotations 17.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 17.35 + * @compile -processor ElementRepAnnoTester -proc:only 17.36 + * RepeatableOfficialContainerInheritedTest.java 17.37 + */ 17.38 + 17.39 +@BarInheritedContainer(value = {@BarInherited(value = 1)}) 17.40 +@BarInheritedContainer(value = {@BarInherited(value = 2)}) 17.41 +class O {} 17.42 + 17.43 +@ExpectedBase( 17.44 + value = BarInheritedContainer.class, 17.45 + getAnnotation = "null", 17.46 + getAnnotationsByType = { 17.47 + "@BarInheritedContainer(value=[@BarInherited(value=1)])", 17.48 + "@BarInheritedContainer(value=[@BarInherited(value=2)])" 17.49 + }, 17.50 + getAllAnnotationMirrors = { 17.51 + "@BarInheritedContainerContainer(" 17.52 + + "{@BarInheritedContainer({@BarInherited(1)})," 17.53 + + " @BarInheritedContainer({@BarInherited(2)})})", 17.54 + "ExpectedBase", 17.55 + "ExpectedContainer" 17.56 + }, 17.57 + getAnnotationMirrors = { 17.58 + "ExpectedBase", 17.59 + "ExpectedContainer" 17.60 + }) 17.61 +@ExpectedContainer( 17.62 + value = BarInheritedContainerContainer.class, 17.63 + getAnnotation = "@BarInheritedContainerContainer(" 17.64 + + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)])," 17.65 + + " @BarInheritedContainer(value=[@BarInherited(value=2)])])", 17.66 + getAnnotationsByType = {"@BarInheritedContainerContainer(" 17.67 + + "value=[@BarInheritedContainer(value=[@BarInherited(value=1)])," 17.68 + + " @BarInheritedContainer(value=[@BarInherited(value=2)])])"}) 17.69 +class RepeatableOfficialContainerInheritedTest extends O {}
18.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 18.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideATest.java Tue Feb 12 11:28:45 2013 +0100 18.3 @@ -0,0 +1,62 @@ 18.4 +/* 18.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 + * 18.8 + * This code is free software; you can redistribute it and/or modify it 18.9 + * under the terms of the GNU General Public License version 2 only, as 18.10 + * published by the Free Software Foundation. 18.11 + * 18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 + * version 2 for more details (a copy is included in the LICENSE file that 18.16 + * accompanied this code). 18.17 + * 18.18 + * You should have received a copy of the GNU General Public License version 18.19 + * 2 along with this work; if not, write to the Free Software Foundation, 18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 + * 18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 18.23 + * or visit www.oracle.com if you need additional information or have any 18.24 + * questions. 18.25 + */ 18.26 + 18.27 +/* 18.28 + * @ignore 18.29 + * @test 18.30 + * @bug 8004822 18.31 + * @author mnunez 18.32 + * @summary Language model api test basics for repeating annotations 18.33 + * @library /tools/javac/lib 18.34 + * @library supportingAnnotations 18.35 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 18.36 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideATest.java 18.37 + */ 18.38 + 18.39 +@BarInherited(value = 1) 18.40 +@BarInherited(value = 2) 18.41 +class B {} 18.42 + 18.43 +@ExpectedBase( 18.44 + value = BarInherited.class, 18.45 + getAnnotation = "@BarInherited(value=3)", 18.46 + getAnnotationsByType = {"@BarInherited(value=3)"}, 18.47 + getAllAnnotationMirrors = { 18.48 + "@BarInherited(3)", 18.49 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 18.50 + "ExpectedBase", 18.51 + "ExpectedContainer" 18.52 + }, 18.53 + getAnnotationMirrors = { 18.54 + "@BarInherited(3)", 18.55 + "ExpectedBase", 18.56 + "ExpectedContainer" 18.57 + }) 18.58 +@ExpectedContainer( 18.59 + value = BarInheritedContainer.class, 18.60 + getAnnotation = "@BarInheritedContainer(" 18.61 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 18.62 + getAnnotationsByType = {"@BarInheritedContainer(" 18.63 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 18.64 +@BarInherited(value = 3) 18.65 +class RepeatableOverrideATest extends B {}
19.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 19.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableOverrideBTest.java Tue Feb 12 11:28:45 2013 +0100 19.3 @@ -0,0 +1,65 @@ 19.4 +/* 19.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 + * 19.8 + * This code is free software; you can redistribute it and/or modify it 19.9 + * under the terms of the GNU General Public License version 2 only, as 19.10 + * published by the Free Software Foundation. 19.11 + * 19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 + * version 2 for more details (a copy is included in the LICENSE file that 19.16 + * accompanied this code). 19.17 + * 19.18 + * You should have received a copy of the GNU General Public License version 19.19 + * 2 along with this work; if not, write to the Free Software Foundation, 19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 + * 19.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 19.23 + * or visit www.oracle.com if you need additional information or have any 19.24 + * questions. 19.25 + */ 19.26 + 19.27 +/* 19.28 + * @ignore 19.29 + * @test 19.30 + * @bug 8004822 19.31 + * @author mnunez 19.32 + * @summary Language model api test basics for repeating annotations 19.33 + * @library /tools/javac/lib 19.34 + * @library supportingAnnotations 19.35 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 19.36 + * @compile -processor ElementRepAnnoTester -proc:only RepeatableOverrideBTest.java 19.37 + */ 19.38 + 19.39 +@BarInherited(value = 0) 19.40 +class C {} 19.41 + 19.42 +@ExpectedBase( 19.43 + value = BarInherited.class, 19.44 + getAnnotation = "@BarInherited(value=0)", 19.45 + getAnnotationsByType = { 19.46 + "@BarInherited(value=1)", 19.47 + "@BarInherited(value=2)" 19.48 + }, 19.49 + getAllAnnotationMirrors = { 19.50 + "@BarInherited(0)", 19.51 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 19.52 + "ExpectedBase", 19.53 + "ExpectedContainer" 19.54 + }, 19.55 + getAnnotationMirrors = { 19.56 + "@BarInheritedContainer({@BarInherited(1), @BarInherited(2)})", 19.57 + "ExpectedBase", 19.58 + "ExpectedContainer" 19.59 + }) 19.60 +@ExpectedContainer( 19.61 + value = BarInheritedContainer.class, 19.62 + getAnnotation = "@BarInheritedContainer(" 19.63 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])", 19.64 + getAnnotationsByType = {"@BarInheritedContainer(" 19.65 + + "value=[@BarInherited(value=1), @BarInherited(value=2)])"}) 19.66 +@BarInherited(value = 1) 19.67 +@BarInherited(value = 2) 19.68 +class RepeatableOverrideBTest extends C {}
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularBasicTest.java Tue Feb 12 11:28:45 2013 +0100 20.3 @@ -0,0 +1,89 @@ 20.4 +/* 20.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 20.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 20.7 + * 20.8 + * This code is free software; you can redistribute it and/or modify it 20.9 + * under the terms of the GNU General Public License version 2 only, as 20.10 + * published by the Free Software Foundation. 20.11 + * 20.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 20.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 20.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 20.15 + * version 2 for more details (a copy is included in the LICENSE file that 20.16 + * accompanied this code). 20.17 + * 20.18 + * You should have received a copy of the GNU General Public License version 20.19 + * 2 along with this work; if not, write to the Free Software Foundation, 20.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 20.21 + * 20.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20.23 + * or visit www.oracle.com if you need additional information or have any 20.24 + * questions. 20.25 + */ 20.26 + 20.27 +/* 20.28 + * @test 20.29 + * @bug 8004822 20.30 + * @author mnunez 20.31 + * @summary Language model api test basics for repeating annotations 20.32 + * @library /tools/javac/lib 20.33 + * @library supportingAnnotations 20.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 20.35 + * @compile -processor ElementRepAnnoTester -proc:only SingularBasicTest.java 20.36 + */ 20.37 + 20.38 +@ExpectedBase( 20.39 + value = Foo.class, 20.40 + getAnnotation = "@Foo(value=0)", 20.41 + getAnnotationsByType = {"@Foo(value=0)"}, 20.42 + getAllAnnotationMirrors = { 20.43 + "@Foo(0)", 20.44 + "ExpectedBase", 20.45 + "ExpectedContainer" 20.46 + }, 20.47 + getAnnotationMirrors = { 20.48 + "@Foo(0)", 20.49 + "ExpectedBase", 20.50 + "ExpectedContainer" 20.51 + }) 20.52 +@ExpectedContainer 20.53 +@Foo(value = 0) 20.54 +public class SingularBasicTest { 20.55 + 20.56 + @ExpectedBase( 20.57 + value = Foo.class, 20.58 + getAnnotation = "@Foo(value=0)", 20.59 + getAnnotationsByType = {"@Foo(value=0)"}, 20.60 + getAllAnnotationMirrors = { 20.61 + "@Foo(0)", 20.62 + "ExpectedBase", 20.63 + "ExpectedContainer" 20.64 + }, 20.65 + getAnnotationMirrors = { 20.66 + "@Foo(0)", 20.67 + "ExpectedBase", 20.68 + "ExpectedContainer" 20.69 + }) 20.70 + @ExpectedContainer 20.71 + @Foo(value = 0) 20.72 + int testField = 0; 20.73 + 20.74 + @ExpectedBase( 20.75 + value = Foo.class, 20.76 + getAnnotation = "@Foo(value=0)", 20.77 + getAnnotationsByType = {"@Foo(value=0)"}, 20.78 + getAllAnnotationMirrors = { 20.79 + "@Foo(0)", 20.80 + "ExpectedBase", 20.81 + "ExpectedContainer" 20.82 + }, 20.83 + getAnnotationMirrors = { 20.84 + "@Foo(0)", 20.85 + "ExpectedBase", 20.86 + "ExpectedContainer" 20.87 + }) 20.88 + @ExpectedContainer 20.89 + @Foo(value = 0) 20.90 + void testMethod() { 20.91 + } 20.92 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedATest.java Tue Feb 12 11:28:45 2013 +0100 21.3 @@ -0,0 +1,52 @@ 21.4 +/* 21.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 21.7 + * 21.8 + * This code is free software; you can redistribute it and/or modify it 21.9 + * under the terms of the GNU General Public License version 2 only, as 21.10 + * published by the Free Software Foundation. 21.11 + * 21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 21.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 21.15 + * version 2 for more details (a copy is included in the LICENSE file that 21.16 + * accompanied this code). 21.17 + * 21.18 + * You should have received a copy of the GNU General Public License version 21.19 + * 2 along with this work; if not, write to the Free Software Foundation, 21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 21.21 + * 21.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 21.23 + * or visit www.oracle.com if you need additional information or have any 21.24 + * questions. 21.25 + */ 21.26 + 21.27 +/* 21.28 + * @test 21.29 + * @bug 8004822 21.30 + * @author mnunez 21.31 + * @summary Language model api test basics for repeating annotations 21.32 + * @library /tools/javac/lib 21.33 + * @library supportingAnnotations 21.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 21.35 + * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedATest.java 21.36 + */ 21.37 + 21.38 +@FooInherited(value = 0) 21.39 +class A {} 21.40 + 21.41 +@ExpectedBase( 21.42 + value = FooInherited.class, 21.43 + getAnnotation = "@FooInherited(value=0)", 21.44 + getAnnotationsByType = {"@FooInherited(value=0)"}, 21.45 + getAllAnnotationMirrors = { 21.46 + "@FooInherited(0)", 21.47 + "ExpectedBase", 21.48 + "ExpectedContainer" 21.49 + }, 21.50 + getAnnotationMirrors = { 21.51 + "ExpectedBase", 21.52 + "ExpectedContainer" 21.53 + }) 21.54 +@ExpectedContainer 21.55 +class SingularInheritedATest extends A {}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/SingularInheritedBTest.java Tue Feb 12 11:28:45 2013 +0100 22.3 @@ -0,0 +1,57 @@ 22.4 +/* 22.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 22.7 + * 22.8 + * This code is free software; you can redistribute it and/or modify it 22.9 + * under the terms of the GNU General Public License version 2 only, as 22.10 + * published by the Free Software Foundation. 22.11 + * 22.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 22.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 22.15 + * version 2 for more details (a copy is included in the LICENSE file that 22.16 + * accompanied this code). 22.17 + * 22.18 + * You should have received a copy of the GNU General Public License version 22.19 + * 2 along with this work; if not, write to the Free Software Foundation, 22.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 22.21 + * 22.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22.23 + * or visit www.oracle.com if you need additional information or have any 22.24 + * questions. 22.25 + */ 22.26 + 22.27 +/* 22.28 + * @test 22.29 + * @bug 8004822 22.30 + * @author mnunez 22.31 + * @summary Language model api test basics for repeating annotations 22.32 + * @library /tools/javac/lib 22.33 + * @library supportingAnnotations 22.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 22.35 + * @compile -processor ElementRepAnnoTester -proc:only SingularInheritedBTest.java 22.36 + */ 22.37 + 22.38 +@FooInherited(value = 1) 22.39 +class P {} 22.40 + 22.41 +@ExpectedBase( 22.42 + value = FooInherited.class, 22.43 + getAnnotation = "@FooInherited(value=2)", 22.44 + getAnnotationsByType = {"@FooInherited(value=2)"}, 22.45 + getAllAnnotationMirrors = { 22.46 + "@FooInherited(2)", 22.47 + "ExpectedBase", 22.48 + "ExpectedContainer" 22.49 + }, 22.50 + getAnnotationMirrors = { 22.51 + "@FooInherited(2)", 22.52 + "ExpectedBase", 22.53 + "ExpectedContainer" 22.54 + }) 22.55 +@ExpectedContainer( 22.56 + value = UnofficialInheritedContainer.class, 22.57 + getAnnotation = "null", 22.58 + getAnnotationsByType = {}) 22.59 +@FooInherited(value = 2) 22.60 +class SingularInheritedBTest extends P {}
23.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 23.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerBasicTest.java Tue Feb 12 11:28:45 2013 +0100 23.3 @@ -0,0 +1,97 @@ 23.4 +/* 23.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 23.7 + * 23.8 + * This code is free software; you can redistribute it and/or modify it 23.9 + * under the terms of the GNU General Public License version 2 only, as 23.10 + * published by the Free Software Foundation. 23.11 + * 23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 23.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 23.15 + * version 2 for more details (a copy is included in the LICENSE file that 23.16 + * accompanied this code). 23.17 + * 23.18 + * You should have received a copy of the GNU General Public License version 23.19 + * 2 along with this work; if not, write to the Free Software Foundation, 23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 23.21 + * 23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 23.23 + * or visit www.oracle.com if you need additional information or have any 23.24 + * questions. 23.25 + */ 23.26 + 23.27 +/* 23.28 + * @test 23.29 + * @bug 8004822 23.30 + * @author mnunez 23.31 + * @summary Language model api test basics for repeating annotations 23.32 + * @library /tools/javac/lib 23.33 + * @library supportingAnnotations 23.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 23.35 + * @compile -processor ElementRepAnnoTester -proc:only UnofficialContainerBasicTest.java 23.36 + */ 23.37 + 23.38 +@ExpectedBase( 23.39 + value = Foo.class, 23.40 + getAnnotation = "null", 23.41 + getAnnotationsByType = {}, 23.42 + getAllAnnotationMirrors = { 23.43 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 23.44 + "ExpectedBase", 23.45 + "ExpectedContainer" 23.46 + }, 23.47 + getAnnotationMirrors = { 23.48 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 23.49 + "ExpectedBase", 23.50 + "ExpectedContainer" 23.51 + }) 23.52 +@ExpectedContainer( 23.53 + value = UnofficialContainer.class, 23.54 + getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])", 23.55 + getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"}) 23.56 +@UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 23.57 +class UnofficialContainerBasicTest { 23.58 + 23.59 + @ExpectedBase( 23.60 + value = Foo.class, 23.61 + getAnnotation = "null", 23.62 + getAnnotationsByType = {}, 23.63 + getAllAnnotationMirrors = { 23.64 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 23.65 + "ExpectedBase", 23.66 + "ExpectedContainer" 23.67 + }, 23.68 + getAnnotationMirrors = { 23.69 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 23.70 + "ExpectedBase", 23.71 + "ExpectedContainer" 23.72 + }) 23.73 + @ExpectedContainer( 23.74 + value = UnofficialContainer.class, 23.75 + getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])", 23.76 + getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"}) 23.77 + @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 23.78 + int testField = 0; 23.79 + 23.80 + @ExpectedBase( 23.81 + value = Foo.class, 23.82 + getAnnotation = "null", 23.83 + getAnnotationsByType = {}, 23.84 + getAllAnnotationMirrors = { 23.85 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 23.86 + "ExpectedBase", 23.87 + "ExpectedContainer" 23.88 + }, 23.89 + getAnnotationMirrors = { 23.90 + "@UnofficialContainer({@Foo(1), @Foo(2)})", 23.91 + "ExpectedBase", 23.92 + "ExpectedContainer" 23.93 + }) 23.94 + @ExpectedContainer( 23.95 + value = UnofficialContainer.class, 23.96 + getAnnotation = "@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])", 23.97 + getAnnotationsByType = {"@UnofficialContainer(value=[@Foo(value=1), @Foo(value=2)])"}) 23.98 + @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 23.99 + void testMethod() {} 23.100 +}
24.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 24.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/UnofficialContainerInheritedTest.java Tue Feb 12 11:28:45 2013 +0100 24.3 @@ -0,0 +1,58 @@ 24.4 +/* 24.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 24.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 24.7 + * 24.8 + * This code is free software; you can redistribute it and/or modify it 24.9 + * under the terms of the GNU General Public License version 2 only, as 24.10 + * published by the Free Software Foundation. 24.11 + * 24.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 24.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 24.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 24.15 + * version 2 for more details (a copy is included in the LICENSE file that 24.16 + * accompanied this code). 24.17 + * 24.18 + * You should have received a copy of the GNU General Public License version 24.19 + * 2 along with this work; if not, write to the Free Software Foundation, 24.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 24.21 + * 24.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 24.23 + * or visit www.oracle.com if you need additional information or have any 24.24 + * questions. 24.25 + */ 24.26 + 24.27 +/* 24.28 + * @test 24.29 + * @bug 8004822 24.30 + * @author mnunez 24.31 + * @summary Language model api test basics for repeating annotations 24.32 + * @library /tools/javac/lib 24.33 + * @library supportingAnnotations 24.34 + * @build JavacTestingAbstractProcessor ElementRepAnnoTester 24.35 + * @compile -processor ElementRepAnnoTester -proc:only 24.36 + * UnofficialContainerInheritedTest.java 24.37 + */ 24.38 + 24.39 +@UnofficialInheritedContainer(value = {@FooInherited(value = 1),@FooInherited(value = 2)}) 24.40 +class F {} 24.41 + 24.42 +@ExpectedBase( 24.43 + value = FooInherited.class, 24.44 + getAnnotation = "null", 24.45 + getAnnotationsByType = {}, 24.46 + getAllAnnotationMirrors = { 24.47 + "@UnofficialInheritedContainer({@FooInherited(1), @FooInherited(2)})", 24.48 + "ExpectedBase", 24.49 + "ExpectedContainer" 24.50 + }, 24.51 + getAnnotationMirrors = { 24.52 + "ExpectedBase", 24.53 + "ExpectedContainer" 24.54 + }) 24.55 +@ExpectedContainer( 24.56 + value = UnofficialInheritedContainer.class, 24.57 + getAnnotation = "@UnofficialInheritedContainer(" 24.58 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])", 24.59 + getAnnotationsByType = {"@UnofficialInheritedContainer(" 24.60 + + "value=[@FooInherited(value=1), @FooInherited(value=2)])"}) 24.61 +class UnofficialContainerInheritedTest extends F {}
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Bar.java Tue Feb 12 11:28:45 2013 +0100 25.3 @@ -0,0 +1,32 @@ 25.4 +/* 25.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 25.7 + * 25.8 + * This code is free software; you can redistribute it and/or modify it 25.9 + * under the terms of the GNU General Public License version 2 only, as 25.10 + * published by the Free Software Foundation. 25.11 + * 25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 25.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 25.15 + * version 2 for more details (a copy is included in the LICENSE file that 25.16 + * accompanied this code). 25.17 + * 25.18 + * You should have received a copy of the GNU General Public License version 25.19 + * 2 along with this work; if not, write to the Free Software Foundation, 25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 25.21 + * 25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 25.23 + * or visit www.oracle.com if you need additional information or have any 25.24 + * questions. 25.25 + */ 25.26 + 25.27 +import java.lang.annotation.*; 25.28 +import java.lang.annotation.Retention; 25.29 +import java.lang.annotation.RetentionPolicy; 25.30 + 25.31 +@Retention(RetentionPolicy.RUNTIME) 25.32 +@Repeatable(BarContainer.class) 25.33 +public @interface Bar { 25.34 + int value(); 25.35 +}
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainer.java Tue Feb 12 11:28:45 2013 +0100 26.3 @@ -0,0 +1,32 @@ 26.4 +/* 26.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 26.7 + * 26.8 + * This code is free software; you can redistribute it and/or modify it 26.9 + * under the terms of the GNU General Public License version 2 only, as 26.10 + * published by the Free Software Foundation. 26.11 + * 26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 26.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 26.15 + * version 2 for more details (a copy is included in the LICENSE file that 26.16 + * accompanied this code). 26.17 + * 26.18 + * You should have received a copy of the GNU General Public License version 26.19 + * 2 along with this work; if not, write to the Free Software Foundation, 26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 26.21 + * 26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 26.23 + * or visit www.oracle.com if you need additional information or have any 26.24 + * questions. 26.25 + */ 26.26 + 26.27 +import java.lang.annotation.*; 26.28 +import java.lang.annotation.Retention; 26.29 +import java.lang.annotation.RetentionPolicy; 26.30 + 26.31 +@Retention(RetentionPolicy.RUNTIME) 26.32 +@Repeatable(BarContainerContainer.class) 26.33 +public @interface BarContainer { 26.34 + Bar[] value(); 26.35 +}
27.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 27.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarContainerContainer.java Tue Feb 12 11:28:45 2013 +0100 27.3 @@ -0,0 +1,32 @@ 27.4 +/* 27.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 27.7 + * 27.8 + * This code is free software; you can redistribute it and/or modify it 27.9 + * under the terms of the GNU General Public License version 2 only, as 27.10 + * published by the Free Software Foundation. 27.11 + * 27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 27.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 27.15 + * version 2 for more details (a copy is included in the LICENSE file that 27.16 + * accompanied this code). 27.17 + * 27.18 + * You should have received a copy of the GNU General Public License version 27.19 + * 2 along with this work; if not, write to the Free Software Foundation, 27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 27.21 + * 27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 27.23 + * or visit www.oracle.com if you need additional information or have any 27.24 + * questions. 27.25 + */ 27.26 + 27.27 +import java.lang.annotation.*; 27.28 +import java.lang.annotation.Retention; 27.29 +import java.lang.annotation.RetentionPolicy; 27.30 + 27.31 +@Retention(RetentionPolicy.RUNTIME) 27.32 +@Inherited 27.33 +public @interface BarContainerContainer { 27.34 + BarContainer[] value(); 27.35 +}
28.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 28.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInherited.java Tue Feb 12 11:28:45 2013 +0100 28.3 @@ -0,0 +1,33 @@ 28.4 +/* 28.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 28.7 + * 28.8 + * This code is free software; you can redistribute it and/or modify it 28.9 + * under the terms of the GNU General Public License version 2 only, as 28.10 + * published by the Free Software Foundation. 28.11 + * 28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 28.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 28.15 + * version 2 for more details (a copy is included in the LICENSE file that 28.16 + * accompanied this code). 28.17 + * 28.18 + * You should have received a copy of the GNU General Public License version 28.19 + * 2 along with this work; if not, write to the Free Software Foundation, 28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 28.21 + * 28.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 28.23 + * or visit www.oracle.com if you need additional information or have any 28.24 + * questions. 28.25 + */ 28.26 + 28.27 +import java.lang.annotation.*; 28.28 +import java.lang.annotation.Retention; 28.29 +import java.lang.annotation.RetentionPolicy; 28.30 + 28.31 +@Retention(RetentionPolicy.RUNTIME) 28.32 +@Inherited 28.33 +@Repeatable(BarInheritedContainer.class) 28.34 +public @interface BarInherited { 28.35 + int value(); 28.36 +}
29.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 29.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainer.java Tue Feb 12 11:28:45 2013 +0100 29.3 @@ -0,0 +1,33 @@ 29.4 +/* 29.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 29.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 29.7 + * 29.8 + * This code is free software; you can redistribute it and/or modify it 29.9 + * under the terms of the GNU General Public License version 2 only, as 29.10 + * published by the Free Software Foundation. 29.11 + * 29.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 29.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 29.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 29.15 + * version 2 for more details (a copy is included in the LICENSE file that 29.16 + * accompanied this code). 29.17 + * 29.18 + * You should have received a copy of the GNU General Public License version 29.19 + * 2 along with this work; if not, write to the Free Software Foundation, 29.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 29.21 + * 29.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 29.23 + * or visit www.oracle.com if you need additional information or have any 29.24 + * questions. 29.25 + */ 29.26 + 29.27 +import java.lang.annotation.*; 29.28 +import java.lang.annotation.Retention; 29.29 +import java.lang.annotation.RetentionPolicy; 29.30 + 29.31 +@Retention(RetentionPolicy.RUNTIME) 29.32 +@Inherited 29.33 +@Repeatable(BarInheritedContainerContainer.class) 29.34 +public @interface BarInheritedContainer { 29.35 + BarInherited[] value(); 29.36 +}
30.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 30.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/BarInheritedContainerContainer.java Tue Feb 12 11:28:45 2013 +0100 30.3 @@ -0,0 +1,32 @@ 30.4 +/* 30.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 30.7 + * 30.8 + * This code is free software; you can redistribute it and/or modify it 30.9 + * under the terms of the GNU General Public License version 2 only, as 30.10 + * published by the Free Software Foundation. 30.11 + * 30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 30.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 30.15 + * version 2 for more details (a copy is included in the LICENSE file that 30.16 + * accompanied this code). 30.17 + * 30.18 + * You should have received a copy of the GNU General Public License version 30.19 + * 2 along with this work; if not, write to the Free Software Foundation, 30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 30.21 + * 30.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 30.23 + * or visit www.oracle.com if you need additional information or have any 30.24 + * questions. 30.25 + */ 30.26 + 30.27 +import java.lang.annotation.*; 30.28 +import java.lang.annotation.Retention; 30.29 +import java.lang.annotation.RetentionPolicy; 30.30 + 30.31 +@Retention(RetentionPolicy.RUNTIME) 30.32 +@Inherited 30.33 +public @interface BarInheritedContainerContainer { 30.34 + BarInheritedContainer[] value(); 30.35 +}
31.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 31.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedBase.java Tue Feb 12 11:28:45 2013 +0100 31.3 @@ -0,0 +1,36 @@ 31.4 +/* 31.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 31.7 + * 31.8 + * This code is free software; you can redistribute it and/or modify it 31.9 + * under the terms of the GNU General Public License version 2 only, as 31.10 + * published by the Free Software Foundation. 31.11 + * 31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 31.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 31.15 + * version 2 for more details (a copy is included in the LICENSE file that 31.16 + * accompanied this code). 31.17 + * 31.18 + * You should have received a copy of the GNU General Public License version 31.19 + * 2 along with this work; if not, write to the Free Software Foundation, 31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 31.21 + * 31.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 31.23 + * or visit www.oracle.com if you need additional information or have any 31.24 + * questions. 31.25 + */ 31.26 + 31.27 +import java.lang.annotation.Annotation; 31.28 +import java.lang.annotation.Retention; 31.29 +import java.lang.annotation.RetentionPolicy; 31.30 + 31.31 +@Retention(RetentionPolicy.RUNTIME) 31.32 +public @interface ExpectedBase { 31.33 + Class<? extends Annotation> value() default Annotation.class; 31.34 + String getAnnotation() default ""; 31.35 + String[] getAllAnnotationMirrors() default {}; 31.36 + String[] getAnnotationMirrors() default {}; 31.37 + // Java SE 8 methods. 31.38 + String[] getAnnotationsByType() default {}; 31.39 +}
32.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 32.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/ExpectedContainer.java Tue Feb 12 11:28:45 2013 +0100 32.3 @@ -0,0 +1,34 @@ 32.4 +/* 32.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 32.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 32.7 + * 32.8 + * This code is free software; you can redistribute it and/or modify it 32.9 + * under the terms of the GNU General Public License version 2 only, as 32.10 + * published by the Free Software Foundation. 32.11 + * 32.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 32.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 32.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 32.15 + * version 2 for more details (a copy is included in the LICENSE file that 32.16 + * accompanied this code). 32.17 + * 32.18 + * You should have received a copy of the GNU General Public License version 32.19 + * 2 along with this work; if not, write to the Free Software Foundation, 32.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 32.21 + * 32.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 32.23 + * or visit www.oracle.com if you need additional information or have any 32.24 + * questions. 32.25 + */ 32.26 + 32.27 +import java.lang.annotation.Annotation; 32.28 +import java.lang.annotation.Retention; 32.29 +import java.lang.annotation.RetentionPolicy; 32.30 + 32.31 +@Retention(RetentionPolicy.RUNTIME) 32.32 +public @interface ExpectedContainer { 32.33 + Class<? extends Annotation> value() default Annotation.class; 32.34 + String getAnnotation() default ""; 32.35 + // Java SE 8 methods. 32.36 + String[] getAnnotationsByType() default {}; 32.37 + }
33.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 33.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/Foo.java Tue Feb 12 11:28:45 2013 +0100 33.3 @@ -0,0 +1,30 @@ 33.4 +/* 33.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 33.7 + * 33.8 + * This code is free software; you can redistribute it and/or modify it 33.9 + * under the terms of the GNU General Public License version 2 only, as 33.10 + * published by the Free Software Foundation. 33.11 + * 33.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 33.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 33.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 33.15 + * version 2 for more details (a copy is included in the LICENSE file that 33.16 + * accompanied this code). 33.17 + * 33.18 + * You should have received a copy of the GNU General Public License version 33.19 + * 2 along with this work; if not, write to the Free Software Foundation, 33.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 33.21 + * 33.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 33.23 + * or visit www.oracle.com if you need additional information or have any 33.24 + * questions. 33.25 + */ 33.26 + 33.27 +import java.lang.annotation.Retention; 33.28 +import java.lang.annotation.RetentionPolicy; 33.29 + 33.30 +@Retention(RetentionPolicy.RUNTIME) 33.31 +public @interface Foo { 33.32 + int value(); 33.33 +}
34.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 34.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/FooInherited.java Tue Feb 12 11:28:45 2013 +0100 34.3 @@ -0,0 +1,32 @@ 34.4 +/* 34.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 34.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 34.7 + * 34.8 + * This code is free software; you can redistribute it and/or modify it 34.9 + * under the terms of the GNU General Public License version 2 only, as 34.10 + * published by the Free Software Foundation. 34.11 + * 34.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 34.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 34.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 34.15 + * version 2 for more details (a copy is included in the LICENSE file that 34.16 + * accompanied this code). 34.17 + * 34.18 + * You should have received a copy of the GNU General Public License version 34.19 + * 2 along with this work; if not, write to the Free Software Foundation, 34.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 34.21 + * 34.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 34.23 + * or visit www.oracle.com if you need additional information or have any 34.24 + * questions. 34.25 + */ 34.26 + 34.27 +import java.lang.annotation.*; 34.28 +import java.lang.annotation.Retention; 34.29 +import java.lang.annotation.RetentionPolicy; 34.30 + 34.31 +@Retention(RetentionPolicy.RUNTIME) 34.32 +@Inherited 34.33 +public @interface FooInherited { 34.34 + int value(); 34.35 +}
35.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 35.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialContainer.java Tue Feb 12 11:28:45 2013 +0100 35.3 @@ -0,0 +1,30 @@ 35.4 +/* 35.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 35.7 + * 35.8 + * This code is free software; you can redistribute it and/or modify it 35.9 + * under the terms of the GNU General Public License version 2 only, as 35.10 + * published by the Free Software Foundation. 35.11 + * 35.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 35.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 35.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 35.15 + * version 2 for more details (a copy is included in the LICENSE file that 35.16 + * accompanied this code). 35.17 + * 35.18 + * You should have received a copy of the GNU General Public License version 35.19 + * 2 along with this work; if not, write to the Free Software Foundation, 35.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 35.21 + * 35.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 35.23 + * or visit www.oracle.com if you need additional information or have any 35.24 + * questions. 35.25 + */ 35.26 + 35.27 +import java.lang.annotation.Retention; 35.28 +import java.lang.annotation.RetentionPolicy; 35.29 + 35.30 +@Retention(RetentionPolicy.RUNTIME) 35.31 +public @interface UnofficialContainer { 35.32 + Foo[] value(); 35.33 +}
36.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 36.2 +++ b/test/tools/javac/processing/model/element/repeatingAnnotations/supportingAnnotations/UnofficialInheritedContainer.java Tue Feb 12 11:28:45 2013 +0100 36.3 @@ -0,0 +1,32 @@ 36.4 +/* 36.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 36.7 + * 36.8 + * This code is free software; you can redistribute it and/or modify it 36.9 + * under the terms of the GNU General Public License version 2 only, as 36.10 + * published by the Free Software Foundation. 36.11 + * 36.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 36.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 36.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 36.15 + * version 2 for more details (a copy is included in the LICENSE file that 36.16 + * accompanied this code). 36.17 + * 36.18 + * You should have received a copy of the GNU General Public License version 36.19 + * 2 along with this work; if not, write to the Free Software Foundation, 36.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 36.21 + * 36.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 36.23 + * or visit www.oracle.com if you need additional information or have any 36.24 + * questions. 36.25 + */ 36.26 + 36.27 +import java.lang.annotation.*; 36.28 +import java.lang.annotation.Retention; 36.29 +import java.lang.annotation.RetentionPolicy; 36.30 + 36.31 +@Retention(RetentionPolicy.RUNTIME) 36.32 +@Inherited 36.33 +public @interface UnofficialInheritedContainer { 36.34 + FooInherited[] value(); 36.35 +}