aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/bugs170/language/MultiCatchAspect.java36
-rw-r--r--tests/bugs170/language/TryResourcesAspect.java25
-rw-r--r--tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java12
-rw-r--r--tests/src/org/aspectj/systemtest/ajc170/ajc170.xml15
4 files changed, 88 insertions, 0 deletions
diff --git a/tests/bugs170/language/MultiCatchAspect.java b/tests/bugs170/language/MultiCatchAspect.java
new file mode 100644
index 000000000..2ff882ab5
--- /dev/null
+++ b/tests/bugs170/language/MultiCatchAspect.java
@@ -0,0 +1,36 @@
+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 {
+}
diff --git a/tests/bugs170/language/TryResourcesAspect.java b/tests/bugs170/language/TryResourcesAspect.java
new file mode 100644
index 000000000..4fe59d73b
--- /dev/null
+++ b/tests/bugs170/language/TryResourcesAspect.java
@@ -0,0 +1,25 @@
+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 {
+ }
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java b/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java
index 813d8444b..a6102fd08 100644
--- a/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc170/Ajc170Tests.java
@@ -82,6 +82,10 @@ public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("multi catch with handler 1");
}
+ public void testMultiCatchAspect1() {
+ runTest("multi catch aspect 1");
+ }
+
// public void testMultiCatchWithHandler2() {
// runTest("multi catch with handler 2");
// }
@@ -102,6 +106,14 @@ public class Ajc170Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("stackoverflow");
}
+ // public void testTryResources1() {
+ // runTest("try resources 1");
+ // }
+ //
+ // public void testTryResources2() {
+ // runTest("try resources 2");
+ // }
+
// ---
public static Test suite() {
diff --git a/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml b/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml
index 816ea2fee..8a6c34c53 100644
--- a/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml
+++ b/tests/src/org/aspectj/systemtest/ajc170/ajc170.xml
@@ -81,6 +81,21 @@
</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>