aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features190
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2018-02-28 11:53:14 -0800
committerAndy Clement <aclement@pivotal.io>2018-03-09 17:18:45 -0800
commit7d47cba01043c93bab95b59e66b727580351e85f (patch)
tree07a7fed0235f2d0e3b9221ebf097e5c24d16aaf0 /tests/features190
parent6b620ba3aa4b0c9d29560dfa42f8c67dcafb1229 (diff)
downloadaspectj-7d47cba01043c93bab95b59e66b727580351e85f.tar.gz
aspectj-7d47cba01043c93bab95b59e66b727580351e85f.zip
Bug#531694: generate more optional thisJoinPoint construction code
This commit introduces some new methods into the runtime Factory class and modifies code generation to use them (and to use the form of the LDC bytecode that loads class constants).
Diffstat (limited to 'tests/features190')
-rw-r--r--tests/features190/efficientTJP/Advice.java19
-rw-r--r--tests/features190/efficientTJP/Clinit.java16
-rw-r--r--tests/features190/efficientTJP/ClinitE.java16
-rw-r--r--tests/features190/efficientTJP/Fields.java46
-rw-r--r--tests/features190/efficientTJP/Fields2.java40
-rw-r--r--tests/features190/efficientTJP/FieldsE.java46
-rw-r--r--tests/features190/efficientTJP/Four.java21
-rw-r--r--tests/features190/efficientTJP/FourA.java21
-rw-r--r--tests/features190/efficientTJP/Init.java24
-rw-r--r--tests/features190/efficientTJP/One.java12
-rw-r--r--tests/features190/efficientTJP/Three.java19
-rw-r--r--tests/features190/efficientTJP/ThreeA.java19
-rw-r--r--tests/features190/efficientTJP/Two.java12
13 files changed, 311 insertions, 0 deletions
diff --git a/tests/features190/efficientTJP/Advice.java b/tests/features190/efficientTJP/Advice.java
new file mode 100644
index 000000000..a85a445c2
--- /dev/null
+++ b/tests/features190/efficientTJP/Advice.java
@@ -0,0 +1,19 @@
+public class Advice {
+ public static void main(String []argv) {
+ }
+}
+
+aspect X {
+ before(): execution(* main(..)) {}
+}
+
+aspect Y {
+ before(): adviceexecution() && within(X) {
+ System.out.println("tjp:"+thisJoinPointStaticPart.getSignature());
+ }
+
+ before(): adviceexecution() && within(X) {
+ System.out.println("tejp:"+thisEnclosingJoinPointStaticPart.getSignature());
+ }
+
+}
diff --git a/tests/features190/efficientTJP/Clinit.java b/tests/features190/efficientTJP/Clinit.java
new file mode 100644
index 000000000..e8acea835
--- /dev/null
+++ b/tests/features190/efficientTJP/Clinit.java
@@ -0,0 +1,16 @@
+public class Clinit {
+ public static void main(String []argv) {
+ new Inner();
+ }
+
+ static class Inner {}
+}
+
+aspect X {
+ before(): staticinitialization(Clinit.Inner) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+ before(): staticinitialization(Clinit) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/ClinitE.java b/tests/features190/efficientTJP/ClinitE.java
new file mode 100644
index 000000000..a007a2014
--- /dev/null
+++ b/tests/features190/efficientTJP/ClinitE.java
@@ -0,0 +1,16 @@
+public class ClinitE {
+ public static void main(String []argv) {
+ new Inner();
+ }
+
+ static class Inner {}
+}
+
+aspect X {
+ before(): staticinitialization(ClinitE.Inner) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ }
+ before(): staticinitialization(ClinitE) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/Fields.java b/tests/features190/efficientTJP/Fields.java
new file mode 100644
index 000000000..ad1246568
--- /dev/null
+++ b/tests/features190/efficientTJP/Fields.java
@@ -0,0 +1,46 @@
+public class Fields {
+ int a = 1;
+ String s = "hello";
+ double d = 1.0d;
+ boolean b = true;
+
+ short ps = (short)1;
+ float fs = 1.0f;
+ long ls = 1L;
+ byte bs = (byte)3;
+ char cs = 'a';
+
+
+ Inner obj = new Inner();
+ static int as = 1;
+ static String ss = "hello";
+ static double ds = 1.0d;
+ static Inner objs = new Inner();
+
+ public static void main(String []argv) {
+ Fields f = new Fields();
+ int a2 = f.a;
+ String s2 = f.s;
+ double d2 = f.d;
+ Inner obj2 = f.obj;
+
+ short ps2 = f.ps;
+ float fs2 = f.fs;
+ long ls2 = f.ls;
+ byte bs2 = f.bs;
+ char cs2 = f.cs;
+
+ int a3 = as;
+ String s3 = ss;
+ double d3 = ds;
+ Inner obj3 = objs;
+ }
+
+ static class Inner {}
+}
+
+aspect X {
+ before(): within(Fields) && get(* *) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/Fields2.java b/tests/features190/efficientTJP/Fields2.java
new file mode 100644
index 000000000..0a8aed75c
--- /dev/null
+++ b/tests/features190/efficientTJP/Fields2.java
@@ -0,0 +1,40 @@
+public class Fields2 {
+ int a = 1;
+ String s = "hello";
+ double d = 1.0d;
+ boolean b = true;
+
+ short ps = (short)1;
+ float fs = 1.0f;
+ long ls = 1L;
+ byte bs = (byte)3;
+ char cs = 'a';
+
+
+ Inner obj = new Inner();
+ static int as = 1;
+ static String ss = "hello";
+ static double ds = 1.0d;
+ static Inner objs = new Inner();
+
+ public static void main(String []argv) {
+ Fields2 f = new Fields2();
+ f.a = 2;
+ f.ps = (short)3;
+ f.d = 2.0d;
+ f.obj = new Inner();
+ f.s = "helo";
+ f.fs = 4f;
+ f.ls = 3L;
+ f.bs = (byte)23;
+ f.cs = 'a';
+ }
+
+ static class Inner {}
+}
+
+aspect X {
+ before(): within(Fields2) && set(* *) && withincode(* main(..)){
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/FieldsE.java b/tests/features190/efficientTJP/FieldsE.java
new file mode 100644
index 000000000..51bc923fa
--- /dev/null
+++ b/tests/features190/efficientTJP/FieldsE.java
@@ -0,0 +1,46 @@
+public class FieldsE {
+ int a = 1;
+ String s = "hello";
+ double d = 1.0d;
+ boolean b = true;
+
+ short ps = (short)1;
+ float fs = 1.0f;
+ long ls = 1L;
+ byte bs = (byte)3;
+ char cs = 'a';
+
+
+ Inner obj = new Inner();
+ static int as = 1;
+ static String ss = "hello";
+ static double ds = 1.0d;
+ static Inner objs = new Inner();
+
+ public static void main(String []argv) {
+ FieldsE f = new FieldsE();
+ int a2 = f.a;
+ String s2 = f.s;
+ double d2 = f.d;
+ Inner obj2 = f.obj;
+
+ short ps2 = f.ps;
+ float fs2 = f.fs;
+ long ls2 = f.ls;
+ byte bs2 = f.bs;
+ char cs2 = f.cs;
+
+ int a3 = as;
+ String s3 = ss;
+ double d3 = ds;
+ Inner obj3 = objs;
+ }
+
+ static class Inner {}
+}
+
+aspect X {
+ before(): within(FieldsE) && get(* *) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/Four.java b/tests/features190/efficientTJP/Four.java
new file mode 100644
index 000000000..9857c8c62
--- /dev/null
+++ b/tests/features190/efficientTJP/Four.java
@@ -0,0 +1,21 @@
+public class Four {
+ public static void main(String []argv) {
+ new Four().run();
+ }
+
+ public void run() {
+ try {
+ System.out.println("run() running");
+ throw new IllegalStateException();
+ } catch (Throwable t) {
+ System.out.println("caught something");
+ }
+ }
+
+}
+
+aspect X {
+ before(Throwable t): handler(Throwable) && args(t) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/FourA.java b/tests/features190/efficientTJP/FourA.java
new file mode 100644
index 000000000..47694dcbf
--- /dev/null
+++ b/tests/features190/efficientTJP/FourA.java
@@ -0,0 +1,21 @@
+public class FourA {
+ public static void main(String []argv) {
+ new FourA().run();
+ }
+
+ public void run() {
+ try {
+ System.out.println("run() running");
+ throw new IllegalStateException();
+ } catch (Throwable t) {
+ System.out.println("caught something");
+ }
+ }
+
+}
+
+aspect X {
+ before(Throwable t): handler(Throwable) && args(t) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/Init.java b/tests/features190/efficientTJP/Init.java
new file mode 100644
index 000000000..200ce18ce
--- /dev/null
+++ b/tests/features190/efficientTJP/Init.java
@@ -0,0 +1,24 @@
+public class Init {
+ public static void main(String []argv) {
+ new A();
+ new B();
+ }
+}
+
+class A {}
+class B {}
+
+aspect X {
+ before(): preinitialization(A.new(..)) && !within(X) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+ before(): preinitialization(A.new(..)) && !within(X) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ }
+ before(): initialization(B.new(..)) && !within(X) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ }
+ before(): initialization(B.new(..)) && !within(X) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ }
+}
diff --git a/tests/features190/efficientTJP/One.java b/tests/features190/efficientTJP/One.java
new file mode 100644
index 000000000..4fafcdaf7
--- /dev/null
+++ b/tests/features190/efficientTJP/One.java
@@ -0,0 +1,12 @@
+public class One {
+ public static void main(String []argv) {
+ System.out.println("One running");
+ }
+}
+
+aspect X {
+ void around(): execution(* main(..)) {
+ System.out.println(thisJoinPoint.getSignature());
+ proceed();
+ }
+}
diff --git a/tests/features190/efficientTJP/Three.java b/tests/features190/efficientTJP/Three.java
new file mode 100644
index 000000000..479c7f7d1
--- /dev/null
+++ b/tests/features190/efficientTJP/Three.java
@@ -0,0 +1,19 @@
+public class Three {
+ public static void main(String []argv) {
+ System.out.println("Three running");
+ new Three();
+ new Three("abc");
+ new Three(1,"abc");
+ }
+
+ Three() {}
+ Three(String s) {}
+ Three(int i, String s) {}
+}
+
+aspect X {
+ void around(): execution(new(..)) && !within(X) {
+ System.out.println(thisJoinPointStaticPart.getSignature());
+ proceed();
+ }
+}
diff --git a/tests/features190/efficientTJP/ThreeA.java b/tests/features190/efficientTJP/ThreeA.java
new file mode 100644
index 000000000..e3ffac941
--- /dev/null
+++ b/tests/features190/efficientTJP/ThreeA.java
@@ -0,0 +1,19 @@
+public class ThreeA {
+ public static void main(String []argv) {
+ System.out.println("ThreeA running");
+ new ThreeA();
+ new ThreeA("abc");
+ new ThreeA(1,"abc");
+ }
+
+ ThreeA() {}
+ ThreeA(String s) {}
+ ThreeA(int i, String s) {}
+}
+
+aspect X {
+ void around(): execution(new(..)) && !within(X) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ proceed();
+ }
+}
diff --git a/tests/features190/efficientTJP/Two.java b/tests/features190/efficientTJP/Two.java
new file mode 100644
index 000000000..2d5d1da69
--- /dev/null
+++ b/tests/features190/efficientTJP/Two.java
@@ -0,0 +1,12 @@
+public class Two {
+ public static void main(String []argv) {
+ System.out.println("Two running");
+ }
+}
+
+aspect X {
+ void around(): execution(* main(..)) {
+ System.out.println(thisEnclosingJoinPointStaticPart.getSignature());
+ proceed();
+ }
+}