aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163/pr219419/Code2.java
blob: bda50ae12ed6bdb3951e6f1c0dbae3e18037105c (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 Code2 {
  public void emitGooeyMess(String argument) throws Exception {
    throw new RuntimeException("Gooey Mess");
  }

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

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

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