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.

Case12.aj 634B

1234567891011121314151617181920212223242526272829
  1. // "public abstract method with declare @method"
  2. import java.lang.annotation.*;
  3. import java.lang.reflect.Method;
  4. @Retention(RetentionPolicy.RUNTIME)
  5. @interface anInterface{}
  6. abstract class A12{
  7. public abstract void a();
  8. }
  9. aspect B12 {
  10. declare @method : abstract void A12.a(..) : @anInterface;
  11. public static void main(String [] args){
  12. Class c = A12.class;
  13. try {
  14. Method m = c.getDeclaredMethod("a", new Class [0]);
  15. Annotation [] anns = m.getDeclaredAnnotations();
  16. for (int i = 0;i < anns.length;i++){
  17. System.out.println(anns[i]);
  18. }
  19. } catch (Exception e){
  20. System.out.println("exceptional!");
  21. }
  22. }
  23. }