test/langtools/tools/javac/processing/model/element/repeatingAnnotations/RepeatableBasicTest.java
author darcy
Thu, 13 Jun 2019 11:50:45 -0700
changeset 55387 761b86d5563d
parent 47216 71c04702a3d5
permissions -rw-r--r--
8164819: Make javac's toString() on annotation objects consistent with core reflection Reviewed-by: jjg, coleenp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     1
/*
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     4
 *
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     7
 * published by the Free Software Foundation.
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     8
 *
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    13
 * accompanied this code).
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    14
 *
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    18
 *
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    21
 * questions.
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    22
 */
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    23
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    24
/*
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    25
 * @test
40231
ba38ad2dd137 8163113: langtools repeating annotations tests depend rely on annotations toString output
darcy
parents: 30730
diff changeset
    26
 * @bug     8004822 8163113
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    27
 * @author  mnunez
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    28
 * @summary Language model api test basics for repeating annotations
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    29
 * @library /tools/javac/lib
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    30
 * @library supportingAnnotations
30730
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 15715
diff changeset
    31
 * @modules java.compiler
d3ce7619db2c 8076543: Add @modules as needed to the langtools tests
akulyakh
parents: 15715
diff changeset
    32
 *          jdk.compiler
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    33
 * @build   JavacTestingAbstractProcessor ElementRepAnnoTester
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    34
 * @compile -processor ElementRepAnnoTester -proc:only RepeatableBasicTest.java
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    35
 */
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    36
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    37
@ExpectedBase(
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    38
        value = Bar.class,
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    39
        getAnnotation = "null",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    40
        getAnnotationsByType = {
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    41
            "@Bar(1)",
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    42
            "@Bar(2)"
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    43
        },
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    44
        getAllAnnotationMirrors = {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    45
            "@BarContainer({@Bar(1), @Bar(2)})",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    46
            "ExpectedBase",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    47
            "ExpectedContainer"
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    48
        },
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    49
        getAnnotationMirrors = {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    50
            "@BarContainer({@Bar(1), @Bar(2)})",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    51
            "ExpectedBase",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    52
            "ExpectedContainer"
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    53
        })
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    54
@ExpectedContainer(
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    55
        value = BarContainer.class,
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    56
        getAnnotation = "@BarContainer({@Bar(1), @Bar(2)})",
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    57
        getAnnotationsByType = {"@BarContainer({@Bar(1), @Bar(2)})"})
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    58
@Bar(1)
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    59
@Bar(2)
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    60
class RepeatableBasicTest {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    61
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    62
    @ExpectedBase(
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    63
            value = Bar.class,
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    64
            getAnnotation = "null",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    65
            getAnnotationsByType = {
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    66
                "@Bar(1)",
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    67
                "@Bar(2)"
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    68
            },
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    69
            getAllAnnotationMirrors = {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    70
                "@BarContainer({@Bar(1), @Bar(2)})",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    71
                "ExpectedBase",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    72
                "ExpectedContainer"
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    73
            },
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    74
            getAnnotationMirrors = {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    75
                "@BarContainer({@Bar(1), @Bar(2)})",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    76
                "ExpectedBase",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    77
                "ExpectedContainer"
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    78
            })
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    79
    @ExpectedContainer(
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    80
            value = BarContainer.class,
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    81
            getAnnotation = "@BarContainer({@Bar(1), @Bar(2)})",
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    82
            getAnnotationsByType = {"@BarContainer({@Bar(1), @Bar(2)})"})
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    83
    @Bar(1)
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    84
    @Bar(2)
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    85
    int testField = 0;
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    86
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    87
    @ExpectedBase(
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    88
            value = Bar.class,
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    89
            getAnnotation = "null",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    90
            getAnnotationsByType = {
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    91
                "@Bar(1)",
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
    92
                "@Bar(2)"
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    93
            },
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    94
            getAllAnnotationMirrors = {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    95
                "@BarContainer({@Bar(1), @Bar(2)})",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    96
                "ExpectedBase",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    97
                "ExpectedContainer"
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    98
            },
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
    99
            getAnnotationMirrors = {
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   100
                "@BarContainer({@Bar(1), @Bar(2)})",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   101
                "ExpectedBase",
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   102
                "ExpectedContainer"
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   103
            })
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   104
    @ExpectedContainer(
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   105
            value = BarContainer.class,
55387
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
   106
            getAnnotation = "@BarContainer({@Bar(1), @Bar(2)})",
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
   107
            getAnnotationsByType = {"@BarContainer({@Bar(1), @Bar(2)})"})
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
   108
    @Bar(1)
761b86d5563d 8164819: Make javac's toString() on annotation objects consistent with core reflection
darcy
parents: 47216
diff changeset
   109
    @Bar(2)
15715
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   110
    void testMethod() {}
0633054b777a 8004822: RFE to write language model API tests for repeating annotations based on the spec updates
jfranck
parents:
diff changeset
   111
}