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.

Case13.aj 654B

12345678910111213141516171819202122232425262728
  1. // "public abstract method on the aspect that declares @method on it"
  2. import java.lang.annotation.*;
  3. import java.lang.reflect.Method;
  4. @Retention(RetentionPolicy.RUNTIME)
  5. @interface anInterface{}
  6. abstract aspect A13{
  7. public abstract void a();
  8. declare @method : abstract void A13.a(..) : @anInterface;
  9. }
  10. aspect B13 {
  11. public static void main(String [] args){
  12. Class c = A13.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. }