test/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java

changeset 0
959103a6100f
equal deleted inserted replaced
-1:000000000000 0:959103a6100f
1 /*
2 * Copyright (c) 2013, 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 * @build JavacTestingAbstractProcessor ElementRepAnnoTester
32 * @compile -processor ElementRepAnnoTester -proc:only RepeatableBasicTest.java
33 */
34
35 @ExpectedBase(
36 value = Bar.class,
37 getAnnotation = "null",
38 getAnnotationsByType = {
39 "@Bar(value=1)",
40 "@Bar(value=2)"
41 },
42 getAllAnnotationMirrors = {
43 "@BarContainer({@Bar(1), @Bar(2)})",
44 "ExpectedBase",
45 "ExpectedContainer"
46 },
47 getAnnotationMirrors = {
48 "@BarContainer({@Bar(1), @Bar(2)})",
49 "ExpectedBase",
50 "ExpectedContainer"
51 })
52 @ExpectedContainer(
53 value = BarContainer.class,
54 getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
55 getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
56 @Bar(value = 1)
57 @Bar(value = 2)
58 class RepeatableBasicTest {
59
60 @ExpectedBase(
61 value = Bar.class,
62 getAnnotation = "null",
63 getAnnotationsByType = {
64 "@Bar(value=1)",
65 "@Bar(value=2)"
66 },
67 getAllAnnotationMirrors = {
68 "@BarContainer({@Bar(1), @Bar(2)})",
69 "ExpectedBase",
70 "ExpectedContainer"
71 },
72 getAnnotationMirrors = {
73 "@BarContainer({@Bar(1), @Bar(2)})",
74 "ExpectedBase",
75 "ExpectedContainer"
76 })
77 @ExpectedContainer(
78 value = BarContainer.class,
79 getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
80 getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
81 @Bar(value = 1)
82 @Bar(value = 2)
83 int testField = 0;
84
85 @ExpectedBase(
86 value = Bar.class,
87 getAnnotation = "null",
88 getAnnotationsByType = {
89 "@Bar(value=1)",
90 "@Bar(value=2)"
91 },
92 getAllAnnotationMirrors = {
93 "@BarContainer({@Bar(1), @Bar(2)})",
94 "ExpectedBase",
95 "ExpectedContainer"
96 },
97 getAnnotationMirrors = {
98 "@BarContainer({@Bar(1), @Bar(2)})",
99 "ExpectedBase",
100 "ExpectedContainer"
101 })
102 @ExpectedContainer(
103 value = BarContainer.class,
104 getAnnotation = "@BarContainer(value=[@Bar(value=1), @Bar(value=2)])",
105 getAnnotationsByType = {"@BarContainer(value=[@Bar(value=1), @Bar(value=2)])"})
106 @Bar(value = 1)
107 @Bar(value = 2)
108 void testMethod() {}
109 }

mercurial