aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs170/language
diff options
context:
space:
mode:
authoraclement <aclement>2011-12-16 16:54:20 +0000
committeraclement <aclement>2011-12-16 16:54:20 +0000
commite1de567f06bd4e2304113b69fba8cafc697d0517 (patch)
tree05c8616dc80248389d44321fde052f7d9bc1fb20 /tests/bugs170/language
parent5034251ef94927ce003fa1bfac0c9471c472eb1d (diff)
downloadaspectj-e1de567f06bd4e2304113b69fba8cafc697d0517.tar.gz
aspectj-e1de567f06bd4e2304113b69fba8cafc697d0517.zip
more language tests
Diffstat (limited to 'tests/bugs170/language')
-rw-r--r--tests/bugs170/language/MultiCatchAspect.java36
-rw-r--r--tests/bugs170/language/TryResourcesAspect.java25
2 files changed, 61 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 {
+ }
+ }
+}