aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs170
diff options
context:
space:
mode:
authoraclement <aclement>2011-12-15 01:25:35 +0000
committeraclement <aclement>2011-12-15 01:25:35 +0000
commit13475b2ce5f6ebdfd9656ca7a5b40c2d28d5c4d7 (patch)
tree07584131d2d34c33e6c302b59a838014bc04d644 /tests/bugs170
parent3bffe3bda11e8cb06e4e32d5137825547b860ad7 (diff)
downloadaspectj-13475b2ce5f6ebdfd9656ca7a5b40c2d28d5c4d7.tar.gz
aspectj-13475b2ce5f6ebdfd9656ca7a5b40c2d28d5c4d7.zip
170 language tests
Diffstat (limited to 'tests/bugs170')
-rw-r--r--tests/bugs170/language/Diamond.java14
-rw-r--r--tests/bugs170/language/DiamondITD.java11
-rw-r--r--tests/bugs170/language/Literals.java13
-rw-r--r--tests/bugs170/language/LiteralsITD.java11
-rw-r--r--tests/bugs170/language/MultiCatch.java31
-rw-r--r--tests/bugs170/language/MultiCatchWithHandler.java37
-rw-r--r--tests/bugs170/language/MultiCatchWithHandler2.java37
-rw-r--r--tests/bugs170/language/StringSwitch.java33
-rw-r--r--tests/bugs170/language/TryResources.java15
9 files changed, 202 insertions, 0 deletions
diff --git a/tests/bugs170/language/Diamond.java b/tests/bugs170/language/Diamond.java
new file mode 100644
index 000000000..2987ccad3
--- /dev/null
+++ b/tests/bugs170/language/Diamond.java
@@ -0,0 +1,14 @@
+import java.util.*;
+
+public class Diamond {
+ public static void main(String []argv) {
+ }
+}
+
+aspect Foo {
+ before(): execution(* *(..)) {
+ // in advice
+ List<String> ls = new ArrayList<>();
+ }
+
+}
diff --git a/tests/bugs170/language/DiamondITD.java b/tests/bugs170/language/DiamondITD.java
new file mode 100644
index 000000000..a6acbe001
--- /dev/null
+++ b/tests/bugs170/language/DiamondITD.java
@@ -0,0 +1,11 @@
+import java.util.*;
+
+public class DiamondITD {
+ public static void main(String []argv) {
+ }
+}
+
+aspect Foo {
+
+ public List<String> DiamondITD.ls = new ArrayList<>();
+}
diff --git a/tests/bugs170/language/Literals.java b/tests/bugs170/language/Literals.java
new file mode 100644
index 000000000..60a39a7c5
--- /dev/null
+++ b/tests/bugs170/language/Literals.java
@@ -0,0 +1,13 @@
+public class Literals {
+ public static void main(String []argv) {
+ }
+}
+
+aspect Foo {
+ before(): execution(* *(..)) {
+ int onemill = 1_000_000;
+ int four =0b100;
+ }
+
+
+}
diff --git a/tests/bugs170/language/LiteralsITD.java b/tests/bugs170/language/LiteralsITD.java
new file mode 100644
index 000000000..ea25d9d8a
--- /dev/null
+++ b/tests/bugs170/language/LiteralsITD.java
@@ -0,0 +1,11 @@
+public class LiteralsITD {
+ public static void main(String []argv) {
+ }
+}
+
+aspect Foo {
+ before(): execution(* *(..)) {
+ }
+
+ public int LiteralsITD.id = 0b100_000;
+}
diff --git a/tests/bugs170/language/MultiCatch.java b/tests/bugs170/language/MultiCatch.java
new file mode 100644
index 000000000..8beede752
--- /dev/null
+++ b/tests/bugs170/language/MultiCatch.java
@@ -0,0 +1,31 @@
+public class MultiCatch {
+
+ public static void main(String[] args) {
+ 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/MultiCatchWithHandler.java b/tests/bugs170/language/MultiCatchWithHandler.java
new file mode 100644
index 000000000..bb0373f79
--- /dev/null
+++ b/tests/bugs170/language/MultiCatchWithHandler.java
@@ -0,0 +1,37 @@
+public class MultiCatchWithHandler {
+
+ public static void main(String[] args) {
+ 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 {
+}
+
+
+aspect X {
+ before(ExceptionA ea): handler(ExceptionA) && args(ea) {
+ System.out.println("in advice");
+ }
+}
diff --git a/tests/bugs170/language/MultiCatchWithHandler2.java b/tests/bugs170/language/MultiCatchWithHandler2.java
new file mode 100644
index 000000000..0a8f7a739
--- /dev/null
+++ b/tests/bugs170/language/MultiCatchWithHandler2.java
@@ -0,0 +1,37 @@
+public class MultiCatchWithHandler2 {
+
+ public static void main(String[] args) {
+ try {
+ foo("ta");
+ } 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 {
+}
+
+
+aspect X {
+ before(ExceptionA ea): handler(ExceptionA) && args(ea) {
+ System.out.println("advice");
+ }
+}
diff --git a/tests/bugs170/language/StringSwitch.java b/tests/bugs170/language/StringSwitch.java
new file mode 100644
index 000000000..140d3b198
--- /dev/null
+++ b/tests/bugs170/language/StringSwitch.java
@@ -0,0 +1,33 @@
+public class StringSwitch {
+ public static void main(String []argv) {
+ }
+}
+
+aspect Foo {
+ before(): execution(* *(..)) {
+String s = "abc";
+switch(s) {
+ case "quux":
+ foo();
+ // fall-through
+
+ case "foo":
+ case "bar":
+ foo();
+ break;
+
+ case "baz":
+ foo();
+ // fall-through
+
+ default:
+ foo();
+ break;
+}
+
+ }
+
+
+ public void foo() {}
+
+}
diff --git a/tests/bugs170/language/TryResources.java b/tests/bugs170/language/TryResources.java
new file mode 100644
index 000000000..308000445
--- /dev/null
+++ b/tests/bugs170/language/TryResources.java
@@ -0,0 +1,15 @@
+public class TryResources {
+}
+
+aspect Foo {
+ before(): execution(* *(..)) {
+try (
+ InputStream in = new FileInputStream(src);
+ OutputStream out = new FileOutputStream(dest))
+{
+ // code
+}
+
+
+ }
+}