diff options
author | jhugunin <jhugunin> | 2003-08-28 21:44:55 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-08-28 21:44:55 +0000 |
commit | 5a07dcee3a3f520e4b5cadc67000673e2d0ca0b7 (patch) | |
tree | 771065369cab0955da5791a8648ede9c52216da7 /tests | |
parent | d8b86743663c19fd545d8dea89290dccda7a5ed1 (diff) | |
download | aspectj-5a07dcee3a3f520e4b5cadc67000673e2d0ca0b7.tar.gz aspectj-5a07dcee3a3f520e4b5cadc67000673e2d0ca0b7.zip |
fix and test for Bugzilla Bug 41359
percflow aspects compiled from jars share one instance for all entry points
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ajcTests.xml | 15 | ||||
-rw-r--r-- | tests/bugs/perCflowAndJar/PerCFlowCompileFromJar.java | 20 | ||||
-rw-r--r-- | tests/bugs/perCflowAndJar/PerCFlowCompileFromJarTest.java | 23 | ||||
-rw-r--r-- | tests/bugs/perCflowAndJar/lib.jar | bin | 0 -> 900 bytes |
4 files changed, 58 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 1412ad04d..db51bfc2c 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -6705,4 +6705,19 @@ <message kind="error" line="3"/> </compile> </ajc-test> + + <ajc-test dir="bugs/perCflowAndJar" + pr="41359" + title="percflow aspects compiled from jars share one instance for all entry points"> + <compile files="PerCFlowCompileFromJar.java,PerCFlowCompileFromJarTest.java"/> + <run class="PerCFlowCompileFromJarTest"/> + </ajc-test> + + <ajc-test dir="bugs/perCflowAndJar" + pr="41359" + title="(using aspectpath) percflow aspects compiled from jars share one instance for all entry points"> + <compile files="PerCFlowCompileFromJarTest.java" + aspectpath="lib.jar"/> + <run class="PerCFlowCompileFromJarTest"/> + </ajc-test> </suite> diff --git a/tests/bugs/perCflowAndJar/PerCFlowCompileFromJar.java b/tests/bugs/perCflowAndJar/PerCFlowCompileFromJar.java new file mode 100644 index 000000000..cfb7c73e0 --- /dev/null +++ b/tests/bugs/perCflowAndJar/PerCFlowCompileFromJar.java @@ -0,0 +1,20 @@ +public abstract aspect PerCFlowCompileFromJar percflow( topOfFlow() ){ + + private boolean thisAspectInstanceIsDead = false; + + protected abstract pointcut entryPoint(); + protected pointcut topOfFlow(): entryPoint() && !cflowbelow( entryPoint() ); + + after() : topOfFlow() { + this.killThisAspectInstance(); + } + + protected void killThisAspectInstance(){ + if (thisAspectInstanceIsDead) + throw new IllegalStateException("This aspect instance has been used and can't be used again."); + else + thisAspectInstanceIsDead = true; + } +} + + diff --git a/tests/bugs/perCflowAndJar/PerCFlowCompileFromJarTest.java b/tests/bugs/perCflowAndJar/PerCFlowCompileFromJarTest.java new file mode 100644 index 000000000..cf30fcc78 --- /dev/null +++ b/tests/bugs/perCflowAndJar/PerCFlowCompileFromJarTest.java @@ -0,0 +1,23 @@ + +public class PerCFlowCompileFromJarTest { + + public static void main(String[] args) throws Exception { + PerCFlowTestHelper c1 = new PerCFlowTestHelper(); + PerCFlowTestHelper c2 = new PerCFlowTestHelper(); + PerCFlowTestHelper c3 = new PerCFlowTestHelper(); + c1.startNewPerCFlow(); + c2.startNewPerCFlow(); + c3.startNewPerCFlow(); + } +} + +class PerCFlowTestHelper { + public void startNewPerCFlow()throws Exception{ + //do nothing + } +} + +aspect MyTestPerCFlowEntryPoint extends PerCFlowCompileFromJar { + protected pointcut entryPoint(): + execution( public void PerCFlowTestHelper.startNewPerCFlow() ); +}
\ No newline at end of file diff --git a/tests/bugs/perCflowAndJar/lib.jar b/tests/bugs/perCflowAndJar/lib.jar Binary files differnew file mode 100644 index 000000000..6ca2c5007 --- /dev/null +++ b/tests/bugs/perCflowAndJar/lib.jar |