aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authoraclement <aclement>2005-10-31 15:53:24 +0000
committeraclement <aclement>2005-10-31 15:53:24 +0000
commit260ff1798e0aaaba8cef2c848578f5817d072abe (patch)
treee8796a8d73a44494611823a2a880b8fa04fe0bd7 /tests/bugs
parent7d5000a3785da1d615b5c5ca9ce584f3509f5db4 (diff)
downloadaspectj-260ff1798e0aaaba8cef2c848578f5817d072abe.tar.gz
aspectj-260ff1798e0aaaba8cef2c848578f5817d072abe.zip
lazytjp default - test code
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/lazyTjpXLintWarning/LazyTjpTest1.java21
-rw-r--r--tests/bugs/lazyTjpXLintWarning/LazyTjpTest2.java30
-rw-r--r--tests/bugs/lazyTjpXLintWarning/LazyTjpTest3.java31
-rw-r--r--tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java18
-rw-r--r--tests/bugs/lazyTjpXLintWarning/Scenario1.aj19
-rw-r--r--tests/bugs/lazyTjpXLintWarning/Scenario2.aj23
-rw-r--r--tests/bugs/lazyTjpXLintWarning/Scenario3.aj24
-rw-r--r--tests/bugs/lazyTjpXLintWarning/Scenario4.aj19
-rw-r--r--tests/bugs/lazyTjpXLintWarning/Scenario5.aj24
9 files changed, 209 insertions, 0 deletions
diff --git a/tests/bugs/lazyTjpXLintWarning/LazyTjpTest1.java b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest1.java
new file mode 100644
index 000000000..8df2f5ace
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest1.java
@@ -0,0 +1,21 @@
+public class LazyTjpTest1 {
+
+ public void test1 () { }
+ public void test2 () { }
+
+ private static aspect Aspect2 {
+
+ // OK, no tjp used in the advice
+ void around () : execution(public void test1()) {
+ System.out.println("Aspect2.around() ");
+ proceed();
+ }
+
+ // Warning: tjp used in around advice so can't apply lazyTjp
+ void around () : execution(public void test2()) {
+ System.out.println("Aspect2.around() " + thisJoinPoint);
+ proceed();
+ }
+ }
+
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/LazyTjpTest2.java b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest2.java
new file mode 100644
index 000000000..422c8eed7
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest2.java
@@ -0,0 +1,30 @@
+public class LazyTjpTest2 {
+
+ public void test1 () { }
+ public void test2 () { }
+ public void test3 () { }
+
+ private static aspect Aspect1 {
+
+ private static boolean enabled = true;
+
+ // OK, has an if() but doesnt use tjp anyway!
+ before () : if(enabled) && execution(public void LazyTjpTest2.test1()) {
+ }
+
+ // Not ok, cant apply because no if() used
+ before () : execution(public void LazyTjpTest2.test2()) {
+ System.out.println(thisJoinPoint);
+ }
+
+ // OK, doesnt use tjp
+ before () : execution(public void LazyTjpTest2.test3()) {
+ }
+
+ // OK, uses tjp but also has if()
+ before () : if(enabled) && execution(public void LazyTjpTest2.test1()) {
+ System.err.println(thisJoinPoint);
+ }
+ }
+
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/LazyTjpTest3.java b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest3.java
new file mode 100644
index 000000000..146fe3c1d
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest3.java
@@ -0,0 +1,31 @@
+public class LazyTjpTest3 {
+
+ public void test1 () { }
+ public void test2 () { }
+ public void test3 () { }
+ public void test4 () { }
+
+ private static aspect Aspect1 {
+
+ private static boolean enabled = true;
+
+ // OK, has an if() but doesnt use tjp anyway!
+ after () : if(enabled) && execution(public void LazyTjpTest3.test1()) {
+ }
+
+ // Not ok, cant apply because no if() used
+ after () : execution(public void LazyTjpTest3.test2()) {
+ System.out.println(thisJoinPoint);
+ }
+
+ // OK, doesnt use tjp
+ after () : execution(public void LazyTjpTest3.test3()) {
+ }
+
+ // OK, uses tjp but also has if()
+ after () : if(enabled) && execution(public void LazyTjpTest3.test4()) {
+ System.err.println(thisJoinPoint);
+ }
+ }
+
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java
new file mode 100644
index 000000000..148a2f556
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java
@@ -0,0 +1,18 @@
+public class LazyTjpTest4 {
+
+ public void test1 () { }
+
+ private static aspect Aspect1 {
+
+ private static boolean enabled = true;
+
+ after () : if(enabled) && execution(public void LazyTjpTest4.test1()) {
+ System.out.println(thisJoinPoint);
+ }
+
+ before() : execution(public void LazyTjpTest4.test1()) {
+ System.out.println(thisJoinPoint);
+ }
+ }
+
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/Scenario1.aj b/tests/bugs/lazyTjpXLintWarning/Scenario1.aj
new file mode 100644
index 000000000..000d47a7a
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/Scenario1.aj
@@ -0,0 +1,19 @@
+// "no XLint warning: thisJoinPoint potentially lazy and nothing stopping it"
+
+public aspect Scenario1 {
+
+ public static boolean enabled = true;
+
+ pointcut toBeTraced() : execution(* main(..));
+
+ before () : toBeTraced() && if(enabled) {
+ Object[] args = thisJoinPoint.getArgs(); // tjp made lazily
+ System.out.println(thisJoinPoint + ", arg's: " + args.length);
+ }
+
+}
+
+class Test{
+ static void main(String [] args){
+ }
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/Scenario2.aj b/tests/bugs/lazyTjpXLintWarning/Scenario2.aj
new file mode 100644
index 000000000..fcc25a180
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/Scenario2.aj
@@ -0,0 +1,23 @@
+// "XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp"
+
+public aspect Scenario2 {
+
+ public static boolean enabled = true;
+
+ pointcut toBeTraced() : execution(* main(..));
+
+ before () : toBeTraced() && if(enabled) {
+ Object[] args = thisJoinPoint.getArgs(); // tjp not made lazily
+ System.out.println(thisJoinPoint + ", arg's: " + args.length);
+ }
+
+ Object around() : toBeTraced() && if(enabled) {
+ return proceed();
+ }
+
+}
+
+class Test{
+ static void main(String [] args){
+ }
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/Scenario3.aj b/tests/bugs/lazyTjpXLintWarning/Scenario3.aj
new file mode 100644
index 000000000..7cbb765fd
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/Scenario3.aj
@@ -0,0 +1,24 @@
+// "no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice"
+
+public aspect Scenario3 {
+
+ public static boolean enabled = true;
+
+ pointcut toBeTraced() : execution(* main(..));
+
+ Object around() : toBeTraced() {
+ // Object[] args = thisJoinPoint.getArgs();
+ return proceed();
+ }
+
+ before () : toBeTraced(){ // no if condition so tjp not made lazily
+ Object[] args = thisJoinPoint.getArgs(); // tjp not made lazily
+ System.out.println(thisJoinPoint + ", arg's: " + args.length);
+ }
+
+}
+
+class Test{
+ static void main(String [] args){
+ }
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/Scenario4.aj b/tests/bugs/lazyTjpXLintWarning/Scenario4.aj
new file mode 100644
index 000000000..0ce25af62
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/Scenario4.aj
@@ -0,0 +1,19 @@
+// "no XLint warning: thisJoinPoint cannot be built lazily"
+
+public aspect Scenario4 {
+
+ public static boolean enabled = true;
+
+ pointcut toBeTraced() : execution(* main(..));
+
+ before () : toBeTraced() { // no if condition
+ Object[] args = thisJoinPoint.getArgs(); // tjp not made lazily
+ System.out.println(thisJoinPoint + ", arg's: " + args.length);
+ }
+
+}
+
+class Test{
+ static void main(String [] args){
+ }
+}
diff --git a/tests/bugs/lazyTjpXLintWarning/Scenario5.aj b/tests/bugs/lazyTjpXLintWarning/Scenario5.aj
new file mode 100644
index 000000000..49627bda4
--- /dev/null
+++ b/tests/bugs/lazyTjpXLintWarning/Scenario5.aj
@@ -0,0 +1,24 @@
+//"XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp"
+
+public aspect Scenario5 {
+
+ public static boolean enabled = true;
+
+ pointcut toBeTraced() : execution(* main(..));
+
+ before () : toBeTraced() && if(enabled) {
+ Object[] args = thisJoinPoint.getArgs(); // tjp not made lazily
+ System.out.println(thisJoinPoint + ", arg's: " + args.length);
+ }
+
+ Object around() : toBeTraced() && if(enabled) {
+ Object[] args = thisJoinPoint.getArgs(); // tjp used in the around advice
+ return proceed();
+ }
+
+}
+
+class Test{
+ static void main(String [] args){
+ }
+}