< prev index next >

test/langtools/tools/javac/processing/model/element/repeatingAnnotations/MixRepeatableAndOfficialContainerBasicTest.java

Print this page




  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
  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    }


  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
  35  * MixRepeatableAndOfficialContainerBasicTest.java
  36  */
  37 
  38 @ExpectedBase(
  39         value = Bar.class,
  40         getAnnotation = "@Bar(0)",
  41         getAnnotationsByType = {
  42             "@Bar(0)",
  43             "@Bar(1)",
  44             "@Bar(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({@Bar(1), @Bar(2)})",
  61         getAnnotationsByType = {"@BarContainer({@Bar(1), @Bar(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(0)",
  69             getAnnotationsByType = {
  70                 "@Bar(0)",
  71                 "@Bar(1)",
  72                 "@Bar(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({@Bar(1), @Bar(2)})",
  89             getAnnotationsByType = {"@BarContainer({@Bar(1), @Bar(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(0)",
  97             getAnnotationsByType = {
  98                 "@Bar(0)",
  99                 "@Bar(1)",
 100                 "@Bar(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({@Bar(1), @Bar(2)})",
 117             getAnnotationsByType = {"@BarContainer({@Bar(1), @Bar(2)})"})
 118     @Bar(value = 0)
 119     @BarContainer(value = {@Bar(value = 1), @Bar(value = 2)})
 120     void testMethod() {}
 121    }
< prev index next >