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.

Foo.java 771B

1234567891011121314151617181920212223242526272829
  1. import java.lang.reflect.Field;
  2. import org.aspectj.lang.ProceedingJoinPoint;
  3. import org.aspectj.lang.annotation.Around;
  4. import org.aspectj.lang.annotation.Aspect;
  5. import org.aspectj.lang.annotation.Pointcut;
  6. @Aspect public class Foo {
  7. static class X {
  8. public void m() {
  9. new RuntimeException("hello");
  10. }
  11. }
  12. public static void main(String[] argv) {
  13. new X().m();
  14. }
  15. @Pointcut("call(Throwable+.new(String, ..)) && this(caller) && if()")
  16. public static boolean exceptionInitializer(Object caller) {
  17. System.out.println("In if(), is there a caller? "+(caller!=null?"yes":"no"));
  18. return true;
  19. }
  20. @Around("exceptionInitializer(caller)")
  21. public Object annotateException(ProceedingJoinPoint jp, Object caller) {
  22. return null;
  23. }
  24. }