diff options
Diffstat (limited to 'tests/bugs171')
-rw-r--r-- | tests/bugs171/pr387444/Code.java | 12 | ||||
-rw-r--r-- | tests/bugs171/pr387444/Code2.java | 33 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/bugs171/pr387444/Code.java b/tests/bugs171/pr387444/Code.java new file mode 100644 index 000000000..4407908f6 --- /dev/null +++ b/tests/bugs171/pr387444/Code.java @@ -0,0 +1,12 @@ +import java.io.*; + +public class Code { + public void m() { // throws IOException { + try (FileReader reader = new FileReader("test.txt")) { + System.out.println(""); + } + } +} +aspect X { + declare soft: IOException: within(*); +} diff --git a/tests/bugs171/pr387444/Code2.java b/tests/bugs171/pr387444/Code2.java new file mode 100644 index 000000000..6bc83d392 --- /dev/null +++ b/tests/bugs171/pr387444/Code2.java @@ -0,0 +1,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); + } +} |