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.

Case24.aj 576B

1234567891011121314151617181920212223242526
  1. // "public field on the aspect that declares @field on it"
  2. import java.lang.annotation.*;
  3. import java.lang.reflect.Field;
  4. @Retention(RetentionPolicy.RUNTIME)
  5. @interface anInterface{}
  6. aspect B24 {
  7. public int a;
  8. declare @field : int B24.a : @anInterface;
  9. public static void main(String [] args){
  10. Class c = B24.class;
  11. try {
  12. Field m = c.getDeclaredField("a");
  13. Annotation [] anns = m.getDeclaredAnnotations();
  14. for (int i = 0;i < anns.length;i++){
  15. System.out.println(anns[i]);
  16. }
  17. } catch (Exception e){
  18. System.out.println("exceptional!");
  19. }
  20. }
  21. }