--- /dev/null
+public class MultiCatchAspect {
+
+ public static void main(String[] args) {
+ }
+}
+
+aspect X {
+
+ before(): execution(* main(..)) {
+ try {
+ foo("abc");
+ } catch (ExceptionA | ExceptionB ex) {
+ bar(ex);
+ }
+ }
+
+ public static void bar(Exception ea) {
+
+ }
+
+ public static void foo(String s) throws ExceptionA, ExceptionB {
+ if (s.equals("ta")) {
+ throw new ExceptionA();
+ } else {
+ throw new ExceptionB();
+ }
+ }
+}
+
+@SuppressWarnings("serial")
+class ExceptionA extends Exception {
+}
+
+@SuppressWarnings("serial")
+class ExceptionB extends Exception {
+}
--- /dev/null
+import java.io.*;
+
+public class TryResourcesAspect {
+}
+
+aspect Foo {
+ before(): execution(* *(..)) {
+ String src = "foo.txt";
+ String dest = "foocopy.txt";
+ try (
+ // InputStream in = new FileInputStream(src);
+// OutputStream out = new FileOutputStream(dest))
+MyCustomInputStream is = new MyCustomInputStream(src))
+ {
+ // code
+ }
+ }
+
+
+ static class MyCustomInputStream implements Closeable {
+ MyCustomInputStream(String src) {}
+ public void close() throws IOException {
+ }
+ }
+}
runTest("multi catch with handler 1");
}
+ public void testMultiCatchAspect1() {
+ runTest("multi catch aspect 1");
+ }
+
// public void testMultiCatchWithHandler2() {
// runTest("multi catch with handler 2");
// }
runTest("stackoverflow");
}
+ // public void testTryResources1() {
+ // runTest("try resources 1");
+ // }
+ //
+ // public void testTryResources2() {
+ // runTest("try resources 2");
+ // }
+
// ---
public static Test suite() {
</compile>
</ajc-test>
+ <ajc-test dir="bugs170/language" title="multi catch aspect 1">
+ <compile files="MultiCatchAspect.java" options="-1.7">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs170/language" title="try resources 1">
+ <compile files="TryResources.java" options="-1.7">
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs170/language" title="try resources 2">
+ <compile files="TryResourcesAspect.java" options="-1.7">
+ </compile>
+ </ajc-test>
+
<ajc-test dir="bugs170/language" title="multi catch with handler 2">
<compile files="MultiCatchWithHandler2.java" options="-1.7">
</compile>