aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163/pr219419/Code.java
blob: c0c523ff7fa7eb2aaa560ff077a288e6e74e8c4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import org.aspectj.lang.annotation.*;

public class Code {
  public void emitGooeyMess(String argument) throws Exception {
    throw new RuntimeException("Gooey Mess");
  }

  public static void main(String []argv) {
	  try {
	  new Code().emitGooeyMess("ewwww");
	  } catch (Exception e) {}
  }
}

@Aspect
class TestAspect {
  @Pointcut("execution(* Code.*(..)) && args(s)")
  public void squidStringMethods(String s) {}

  @AfterThrowing(pointcut="squidStringMethods(s)", throwing="e")
  public void catchGooeyMess(Exception e, String s) {
  //public void catchGooeyMess(String s, Exception e) {
    System.out.println("Catching mess. Argument was " + s);
  }
}