< prev index next >

test/jdk/java/lang/Class/IsAnnotationType.java

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


  32 
  33 public class IsAnnotationType {
  34     interface AnnotationPoseur extends Annotation {
  35     }
  36 
  37     static int test(Class clazz, boolean expected) {
  38         int status = (clazz.isAnnotation() == expected)?0:1;
  39 
  40         if (status == 1) {
  41             System.err.println("Unexpected annotation status for " + clazz);
  42         }
  43         return status;
  44     }
  45 
  46     public static void main(String argv[]) {
  47         int failures = 0;
  48 
  49         failures += test(String.class, false);
  50         failures += test(Enum.class, false);
  51         failures += test(java.math.RoundingMode.class, false);
  52         // Classes in java.lang.annoation
  53         failures += test(Annotation.class, false);
  54         failures += test(Retention.class, true);
  55         failures += test(RetentionPolicy.class, false);
  56         failures += test(Target.class, true);
  57         failures += test(AnnotationPoseur.class, false);
  58 
  59         if (failures > 0) {
  60             throw new RuntimeException("Unexepcted annotation " +
  61                                        "status detected.");
  62         }
  63     }
  64 }


  32 
  33 public class IsAnnotationType {
  34     interface AnnotationPoseur extends Annotation {
  35     }
  36 
  37     static int test(Class clazz, boolean expected) {
  38         int status = (clazz.isAnnotation() == expected)?0:1;
  39 
  40         if (status == 1) {
  41             System.err.println("Unexpected annotation status for " + clazz);
  42         }
  43         return status;
  44     }
  45 
  46     public static void main(String argv[]) {
  47         int failures = 0;
  48 
  49         failures += test(String.class, false);
  50         failures += test(Enum.class, false);
  51         failures += test(java.math.RoundingMode.class, false);
  52         // Classes in java.lang.annotation
  53         failures += test(Annotation.class, false);
  54         failures += test(Retention.class, true);
  55         failures += test(RetentionPolicy.class, false);
  56         failures += test(Target.class, true);
  57         failures += test(AnnotationPoseur.class, false);
  58 
  59         if (failures > 0) {
  60             throw new RuntimeException("Unexpected annotation " +
  61                                        "status detected.");
  62         }
  63     }
  64 }
< prev index next >