diff options
author | aclement <aclement> | 2005-11-01 21:55:21 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-11-01 21:55:21 +0000 |
commit | bb9d2de08e63266a93ac1167f87b07813561d559 (patch) | |
tree | 8fb9e6d17780dc6327443874ad06fbcad4da5ae7 /tests | |
parent | b83d91aafe4de6362cd4f9bc30e92e80d392bc20 (diff) | |
download | aspectj-bb9d2de08e63266a93ac1167f87b07813561d559.tar.gz aspectj-bb9d2de08e63266a93ac1167f87b07813561d559.zip |
pr93253: lazytjp the default
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java | 4 | ||||
-rw-r--r-- | tests/bugs/lazyTjpXLintWarning/LazyTjpTest5.java | 22 | ||||
-rw-r--r-- | tests/bugs/lazyTjpXLintWarning/Scenario3.aj | 2 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/xlint/XLintTests.java | 59 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml | 78 |
5 files changed, 163 insertions, 2 deletions
diff --git a/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java index 148a2f556..1025d1f31 100644 --- a/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java +++ b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest4.java @@ -13,6 +13,10 @@ public class LazyTjpTest4 { before() : 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/LazyTjpTest5.java b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest5.java new file mode 100644 index 000000000..caa86a83d --- /dev/null +++ b/tests/bugs/lazyTjpXLintWarning/LazyTjpTest5.java @@ -0,0 +1,22 @@ +public class LazyTjpTest5 { + + public void test1 () { } + + private static aspect Aspect1 { + + private static boolean enabled = true; + + after () : if(enabled) && execution(public void LazyTjpTest5.test1()) { + System.out.println(thisJoinPoint); + } + + before() : execution(public void LazyTjpTest5.test1()) { + System.out.println(thisJoinPoint); + } + + void around() : execution(public void LazyTjpTest5.test1()) { + System.out.println(thisJoinPoint); + } + } + +} diff --git a/tests/bugs/lazyTjpXLintWarning/Scenario3.aj b/tests/bugs/lazyTjpXLintWarning/Scenario3.aj index 7cbb765fd..cbee2ba7c 100644 --- a/tests/bugs/lazyTjpXLintWarning/Scenario3.aj +++ b/tests/bugs/lazyTjpXLintWarning/Scenario3.aj @@ -7,7 +7,7 @@ public aspect Scenario3 { pointcut toBeTraced() : execution(* main(..)); Object around() : toBeTraced() { - // Object[] args = thisJoinPoint.getArgs(); + //Object[] args = thisJoinPoint.getArgs(); return proceed(); } diff --git a/tests/src/org/aspectj/systemtest/xlint/XLintTests.java b/tests/src/org/aspectj/systemtest/xlint/XLintTests.java index 21e0fd1f9..defcab2e3 100644 --- a/tests/src/org/aspectj/systemtest/xlint/XLintTests.java +++ b/tests/src/org/aspectj/systemtest/xlint/XLintTests.java @@ -12,6 +12,7 @@ package org.aspectj.systemtest.xlint; import java.io.File; import junit.framework.Test; import org.aspectj.testing.XMLBasedAjcTestCase; +import org.aspectj.weaver.bcel.BcelShadow; public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase { @@ -100,8 +101,64 @@ public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("XLint warning for call PCD's using subtype of defining type (-1.3 -Xlint:ignore)"); } + + // the following five tests check various scenarios around the lazyTjp XLint message + public void test020(){ + runTest("no XLint warning: thisJoinPoint potentially lazy and nothing stopping it"); + assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization); + } + + public void test021(){ + runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp"); + assertFalse("lazytjp optimization should have failed to be applied because of around advice at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test022(){ + runTest("no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice"); + assertFalse("lazytjp optimization should have failed to be applied because of around advice *and* before advice has no if() at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test023(){ + runTest("no XLint warning: thisJoinPoint cannot be built lazily"); + assertFalse("lazytjp optimization should have failed to be applied because before advice has no if() at the jp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test024(){ + runTest("XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp"); + assertFalse("lazytjp optimization should have failed to be applied because around advice uses tjp", + BcelShadow.appliedLazyTjpOptimization); + } + + public void test025(){ + runTest("check for xlazytjp warning if actually supplied"); + assertTrue("Something prevented the lazytjp optimization from working??",BcelShadow.appliedLazyTjpOptimization); + } + + public void test026(){ + runTest("lazytjp: warning when around advice uses tjp"); + } + + public void test027() { + runTest("lazytjp: warning when if missing on before advice"); + } + + public void test028() { + runTest("lazytjp: warning when if missing on after advice"); + } + + public void test029() { + runTest("lazytjp: multiple clashing advice preventing lazytjp"); + } + + public void test030() { + runTest("lazytjp: interfering before and around"); + } + // FIXME asc put this back in ! -// public void test020() { +// public void test031() { // if (is15VMOrGreater) // runTest("7 lint warnings"); // } diff --git a/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml b/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml index 05052cce7..077c4a4bc 100644 --- a/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml +++ b/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml @@ -2,6 +2,84 @@ <!-- .................................... -Xlint tests --> <!-- ............... positive -Xlint tests --> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="no XLint warning: thisJoinPoint potentially lazy and nothing stopping it"> + <compile options="-Xlint:warning" files="Scenario1.aj"/> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="XLint warning: thisJoinPoint potentially lazy but stopped by around advice which doesn't use tjp"> + <compile options="-Xlint:warning" files="Scenario2.aj"> + <message kind="warning" line="21" text="can not implement lazyTjp on this joinpoint method-execution(void Test.main(java.lang.String[])) because around advice is used [Xlint:canNotImplementLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="no XLint warning: thisJoinPoint not lazy (no if PCD) but would have been stopped anyway by around advice"> + <compile options="-Xlint:warning" files="Scenario3.aj"> + <message kind="warning" line="14" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void Test.main(java.lang.String[])) [Xlint:noGuardForLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" title="no XLint warning: thisJoinPoint cannot be built lazily"> + <compile options="-Xlint:warning" files="Scenario4.aj"> + <message kind="warning" line="9" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void Test.main(java.lang.String[]))"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="XLint warning: thisJoinPoint potentially lazy but stopped by around advice which uses tjp"> + <compile options="-Xlint:warning" files="Scenario5.aj"> + <message kind="warning" line="22" text="can not implement lazyTjp on this joinpoint method-execution(void Test.main(java.lang.String[])) because around advice is used [Xlint:canNotImplementLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="check for xlazytjp warning if actually supplied"> + <compile options="-XlazyTjp -Xlint:warning" files="Scenario1.aj"> + <message kind="warning" text="-XlazyTjp should no longer be used, build tjps lazily is now the default"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: warning when around advice uses tjp"> + <compile options="-Xlint:warning" files="LazyTjpTest1.java"> + <message kind="warning" line="4" text="can not implement lazyTjp on this joinpoint method-execution(void LazyTjpTest1.test2()) because around advice is used [Xlint:canNotImplementLazyTjp]"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: warning when if missing on before advice"> + <compile options="-Xlint:warning" files="LazyTjpTest2.java"> + <message kind="warning" line="16" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void LazyTjpTest2.test2())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: warning when if missing on after advice"> + <compile options="-Xlint:warning" files="LazyTjpTest3.java"> + <message kind="warning" line="17" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void LazyTjpTest3.test2())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: multiple clashing advice preventing lazytjp"> + <compile options="-Xlint:warning" files="LazyTjpTest4.java"> + <message kind="warning" line="13" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void LazyTjpTest4.test1())"/> + <message kind="warning" line="3" text="can not implement lazyTjp at joinpoint method-execution(void LazyTjpTest4.test1()) because of advice conflicts, see secondary locations to find conflicting advice"/> + <message kind="warning" line="17" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void LazyTjpTest4.test1())"/> + </compile> + </ajc-test> + + <ajc-test dir="bugs/lazyTjpXLintWarning" + title="lazytjp: interfering before and around"> + <compile options="-Xlint:warning" files="LazyTjpTest5.java"> + <message kind="warning" line="3" text="can not implement lazyTjp at joinpoint method-execution(void LazyTjpTest5.test1()) because of advice conflicts, see secondary locations to find conflicting advice"/> + <message kind="warning" line="13" text="can not build thisJoinPoint lazily for this advice since it has no suitable guard. The advice applies at method-execution(void LazyTjpTest5.test1())"/> + </compile> + </ajc-test> + <ajc-test dir="options" title="options -Xlint args()" keywords="lint"> |