aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs171/pr387444/Code2.java
blob: 6bc83d39213696ac0853d0ee7426e09b5c242efd (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
27
28
29
30
31
32
33
import java.io.*;
import org.aspectj.lang.*;

public class Code2 {
  public static void main(String[]argv) {
    try {
      new Code2().m();
    } catch (SoftException se) {
      System.out.println(se.getWrappedThrowable().getMessage());
    }
  }
  
  public void m() { 
    try (MyReader reader = new MyReader()) {
      System.out.println("");
    }
  }
}
aspect X {
  declare soft: MyException: within(Code2);
}

class MyReader implements AutoCloseable {
  public void close() throws MyException {
    throw new MyException("foo");
  }
}

class MyException extends Exception {
  public MyException(String s) {
	super(s);
  }
}