You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DecoratedClass.java 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Use all the variants of annotations - to exercise the
  2. // eclipse transform code in EclipseSourceType
  3. import java.lang.annotation.*;
  4. @AnnotationStringElement(stringval="hello")
  5. @SimpleAnnotation(id=1)
  6. @AnnotationClassElement(clz=Integer.class)
  7. @CombinedAnnotation({@SimpleAnnotation(id=4)})
  8. @AnnotationEnumElement(enumval=SimpleEnum.Red)
  9. @ComplexAnnotation(ival=4,bval=2,cval='5',fval=3.0f,dval=33.4,zval=false,jval=56,sval=99)
  10. public class DecoratedClass {
  11. public void m() {}
  12. }
  13. @Target(value={ElementType.TYPE})
  14. @Retention(RetentionPolicy.RUNTIME)
  15. @interface SimpleAnnotation {
  16. int id();
  17. String fruit() default "bananas";
  18. }
  19. enum SimpleEnum { Red,Orange,Yellow,Green,Blue,Indigo,Violet };
  20. @Retention(RetentionPolicy.RUNTIME)
  21. @interface SimpleStringAnnotation {
  22. String fruit();
  23. }
  24. @Target({ElementType.TYPE,ElementType.FIELD})
  25. @Retention(RetentionPolicy.RUNTIME)
  26. @interface AnnotationClassElement {
  27. Class clz();
  28. }
  29. @Retention(RetentionPolicy.RUNTIME)
  30. @interface AnnotationEnumElement {
  31. SimpleEnum enumval();
  32. }
  33. @Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD})
  34. @Retention(RetentionPolicy.RUNTIME)
  35. @interface AnnotationStringElement {
  36. String stringval();
  37. }
  38. @Retention(RetentionPolicy.RUNTIME)
  39. @interface CombinedAnnotation {
  40. SimpleAnnotation[] value();
  41. }
  42. @Retention(RetentionPolicy.RUNTIME)
  43. @interface ComplexAnnotation {
  44. int ival();
  45. byte bval();
  46. char cval();
  47. long jval();
  48. double dval();
  49. boolean zval();
  50. short sval();
  51. float fval();
  52. }