1 /* 2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 8004822 27 * @author mnunez 28 * @summary Language model api test basics for repeating annotations 29 * @library /tools/javac/lib 30 * @library supportingAnnotations 31 * @modules java.compiler 32 * jdk.compiler 33 * @build JavacTestingAbstractProcessor ElementRepAnnoTester 34 * @compile -processor ElementRepAnnoTester -proc:only 35 * MixRepeatableAndOfficialContainerBasicTest.java 36 */ 37 38 @ExpectedBase( 39 value = Bar.class, 40 getAnnotation = "@Bar(value=0)", 41 getAnnotationsByType = { 42 "@Bar(value=0)", 43 "@Bar(value=1)", 44 "@Bar(value=2)" 45 }, 46 getAllAnnotationMirrors = { 47 "@Bar(0)", 48 "@BarContainer({@Bar(1), @Bar(2)})", 49 "ExpectedBase", 50 "ExpectedContainer" 51 }, 52 getAnnotationMirrors = { 53 "@Bar(0)", 54 "@BarContainer({@Bar(1), @Bar(2)})", 55 "ExpectedBase", 56 "ExpectedContainer" 57 }) 58 @ExpectedContainer( 59 value = BarContainer.class, 60 getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 61 getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 62 @Bar(value = 0) 63 @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 64 class MixRepeatableAndOfficialContainerBasicTest { 65 66 @ExpectedBase( 67 value = Bar.class, 68 getAnnotation = "@Bar(value=0)", 69 getAnnotationsByType = { 70 "@Bar(value=0)", 71 "@Bar(value=1)", 72 "@Bar(value=2)" 73 }, 74 getAllAnnotationMirrors = { 75 "@Bar(0)", 76 "@BarContainer({@Bar(1), @Bar(2)})", 77 "ExpectedBase", 78 "ExpectedContainer" 79 }, 80 getAnnotationMirrors = { 81 "@Bar(0)", 82 "@BarContainer({@Bar(1), @Bar(2)})", 83 "ExpectedBase", 84 "ExpectedContainer" 85 }) 86 @ExpectedContainer( 87 value = BarContainer.class, 88 getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 89 getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 90 @Bar(value = 0) 91 @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 92 int testField = 0; 93 94 @ExpectedBase( 95 value = Bar.class, 96 getAnnotation = "@Bar(value=0)", 97 getAnnotationsByType = { 98 "@Bar(value=0)", 99 "@Bar(value=1)", 100 "@Bar(value=2)" 101 }, 102 getAllAnnotationMirrors = { 103 "@Bar(0)", 104 "@BarContainer({@Bar(1), @Bar(2)})", 105 "ExpectedBase", 106 "ExpectedContainer" 107 }, 108 getAnnotationMirrors = { 109 "@Bar(0)", 110 "@BarContainer({@Bar(1), @Bar(2)})", 111 "ExpectedBase", 112 "ExpectedContainer" 113 }) 114 @ExpectedContainer( 115 value = BarContainer.class, 116 getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])", 117 getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"}) 118 @Bar(value = 0) 119 @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)}) 120 void testMethod() {} 121 }