From 15930e7f92e2d4be1866509a8550373a4bcea978 Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 16 Feb 2006 09:04:45 +0000 Subject: [PATCH] tests and (slightly reworked) fix for 125699 from Helen. @AJ bug with inherited advice from code style aspects. --- tests/bugs151/pr125699/AtTestTracing.java | 1 - tests/bugs151/pr125699/SubAbstractTracing.aj | 3 +++ tests/bugs151/pr125699/SubAtAj.java | 6 ++++++ .../aspectj/systemtest/ajc151/Ajc151Tests.java | 2 ++ .../org/aspectj/systemtest/ajc151/ajc151.xml | 18 +++++++++++++++--- .../org/aspectj/weaver/bcel/BcelWeaver.java | 9 ++++++--- 6 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 tests/bugs151/pr125699/SubAbstractTracing.aj create mode 100644 tests/bugs151/pr125699/SubAtAj.java diff --git a/tests/bugs151/pr125699/AtTestTracing.java b/tests/bugs151/pr125699/AtTestTracing.java index 32d380f8b..faa429cc2 100644 --- a/tests/bugs151/pr125699/AtTestTracing.java +++ b/tests/bugs151/pr125699/AtTestTracing.java @@ -1,5 +1,4 @@ import org.aspectj.lang.annotation.Aspect; -import org.aspectj.lang.annotation.Pointcut; @Aspect public class AtTestTracing extends Tracing { diff --git a/tests/bugs151/pr125699/SubAbstractTracing.aj b/tests/bugs151/pr125699/SubAbstractTracing.aj new file mode 100644 index 000000000..526ca3b78 --- /dev/null +++ b/tests/bugs151/pr125699/SubAbstractTracing.aj @@ -0,0 +1,3 @@ +public abstract aspect SubAbstractTracing extends Tracing { + +} diff --git a/tests/bugs151/pr125699/SubAtAj.java b/tests/bugs151/pr125699/SubAtAj.java new file mode 100644 index 000000000..aad7c2462 --- /dev/null +++ b/tests/bugs151/pr125699/SubAtAj.java @@ -0,0 +1,6 @@ +import org.aspectj.lang.annotation.Aspect; + +@Aspect +public class SubAtAj extends SubAbstractTracing { + +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index b15102fa2..7a64444b9 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -39,6 +39,8 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { //public void testExposingWithintype_enh123423() { runTest("exposing withintype");} //public void testMissingImport_pr127299() { runTest("missing import gives funny message");} public void testUnusedInterfaceMessage_pr120527() { runTest("incorrect unused interface message");} + public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699 () { runTest("inherit advice with this() and thisJoinPoint"); } + public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699_2 () {runTest("inherit advice with this() and thisJoinPoint - 2"); } public void testMixingNumbersOfTypeParameters_pr125080() { runTest("mixing numbers of type parameters"); diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index 140d66e22..de0488dbd 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -133,10 +133,22 @@ - - + + + + + + - + + + + + + + + + diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index db4caee5a..118e7bfee 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -502,9 +502,12 @@ public class BcelWeaver implements IWeaver { if (advice.getSignature() != null) { final int numFormals; final String names[]; - //ATAJ for @AJ aspect, the formal have to be checked according to the argument number - // since xxxJoinPoint presence or not have side effects - if (advice.getConcreteAspect().isAnnotationStyleAspect()) { + // If the advice is being concretized in a @AJ aspect *and* the advice was declared in + // an @AJ aspect (it could have been inherited from a code style aspect) then + // evaluate the alternative set of formals. pr125699 + if (advice.getConcreteAspect().isAnnotationStyleAspect() + && advice.getDeclaringAspect()!=null + && advice.getDeclaringAspect().resolve(world).isAnnotationStyleAspect()) { numFormals = advice.getBaseParameterCount(); int numArgs = advice.getSignature().getParameterTypes().length; if (numFormals > 0) { -- 2.39.5