< prev index next >

test/langtools/tools/javac/annotations/repeatingAnnotations/BasicRepeatingAnnotations.java

Print this page
8200128: Fix some "annoations" typos
Reviewed-by: alanb


  55 @Foo
  56 class BasicRepeatingAnnos {}
  57 
  58 @Foo
  59 class BasicNonRepeatingAnno {}
  60 
  61 public class BasicRepeatingAnnotations {
  62     public static void main(String[] args) throws Exception {
  63         Annotation a = BasicRepeatingAnnos.class.getAnnotation(Foos.class);
  64         if (a == null) {
  65             throw new RuntimeException("Container annotation missing");
  66         }
  67 
  68         // verify that container not present on nonrepeating
  69         a = BasicNonRepeatingAnno.class.getAnnotation(Foos.class);
  70         if (a != null) {
  71             throw new RuntimeException("Container annotation present");
  72         }
  73         a = BasicNonRepeatingAnno.class.getAnnotation(Foo.class);
  74         if (a == null) {
  75             throw new RuntimeException("Repeated annoation not directly present");
  76         }
  77     }
  78 }


  55 @Foo
  56 class BasicRepeatingAnnos {}
  57 
  58 @Foo
  59 class BasicNonRepeatingAnno {}
  60 
  61 public class BasicRepeatingAnnotations {
  62     public static void main(String[] args) throws Exception {
  63         Annotation a = BasicRepeatingAnnos.class.getAnnotation(Foos.class);
  64         if (a == null) {
  65             throw new RuntimeException("Container annotation missing");
  66         }
  67 
  68         // verify that container not present on nonrepeating
  69         a = BasicNonRepeatingAnno.class.getAnnotation(Foos.class);
  70         if (a != null) {
  71             throw new RuntimeException("Container annotation present");
  72         }
  73         a = BasicNonRepeatingAnno.class.getAnnotation(Foo.class);
  74         if (a == null) {
  75             throw new RuntimeException("Repeated annotation not directly present");
  76         }
  77     }
  78 }
< prev index next >