1 /* 2 * Copyright (c) 2013, 2016, 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 8163113 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 UnofficialContainerBasicTest.java 35 */ 36 37 @ExpectedBase( 38 value = Foo.class, 39 getAnnotation = "null", 40 getAnnotationsByType = {}, 41 getAllAnnotationMirrors = { 42 "@UnofficialContainer({@Foo(1), @Foo(2)})", 43 "ExpectedBase", 44 "ExpectedContainer" 45 }, 46 getAnnotationMirrors = { 47 "@UnofficialContainer({@Foo(1), @Foo(2)})", 48 "ExpectedBase", 49 "ExpectedContainer" 50 }) 51 @ExpectedContainer( 52 value = UnofficialContainer.class, 53 getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})", 54 getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"}) 55 @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 56 class UnofficialContainerBasicTest { 57 58 @ExpectedBase( 59 value = Foo.class, 60 getAnnotation = "null", 61 getAnnotationsByType = {}, 62 getAllAnnotationMirrors = { 63 "@UnofficialContainer({@Foo(1), @Foo(2)})", 64 "ExpectedBase", 65 "ExpectedContainer" 66 }, 67 getAnnotationMirrors = { 68 "@UnofficialContainer({@Foo(1), @Foo(2)})", 69 "ExpectedBase", 70 "ExpectedContainer" 71 }) 72 @ExpectedContainer( 73 value = UnofficialContainer.class, 74 getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})", 75 getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"}) 76 @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 77 int testField = 0; 78 79 @ExpectedBase( 80 value = Foo.class, 81 getAnnotation = "null", 82 getAnnotationsByType = {}, 83 getAllAnnotationMirrors = { 84 "@UnofficialContainer({@Foo(1), @Foo(2)})", 85 "ExpectedBase", 86 "ExpectedContainer" 87 }, 88 getAnnotationMirrors = { 89 "@UnofficialContainer({@Foo(1), @Foo(2)})", 90 "ExpectedBase", 91 "ExpectedContainer" 92 }) 93 @ExpectedContainer( 94 value = UnofficialContainer.class, 95 getAnnotation = "@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})", 96 getAnnotationsByType = {"@UnofficialContainer(value={@Foo(value=1), @Foo(value=2)})"}) 97 @UnofficialContainer(value = {@Foo(value = 1), @Foo(value = 2)}) 98 void testMethod() {} 99 }