]> source.dussan.org Git - aspectj.git/commitdiff
tests and (slightly reworked) fix for 125699 from Helen. @AJ bug with inherited advic...
authoraclement <aclement>
Thu, 16 Feb 2006 09:04:45 +0000 (09:04 +0000)
committeraclement <aclement>
Thu, 16 Feb 2006 09:04:45 +0000 (09:04 +0000)
tests/bugs151/pr125699/AtTestTracing.java
tests/bugs151/pr125699/SubAbstractTracing.aj [new file with mode: 0644]
tests/bugs151/pr125699/SubAtAj.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml
weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java

index 32d380f8b9a40a118aa5b90915136321eebc8e1c..faa429cc27a88671c4f727119037c457b7932ca9 100644 (file)
@@ -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 (file)
index 0000000..526ca3b
--- /dev/null
@@ -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 (file)
index 0000000..aad7c24
--- /dev/null
@@ -0,0 +1,6 @@
+import org.aspectj.lang.annotation.Aspect;
+
+@Aspect
+public class SubAtAj extends SubAbstractTracing {
+
+}
index b15102fa2ae5091dffae52b459be35094549ac35..7a64444b9128bdb416a835f4246ee2b6c342eba6 100644 (file)
@@ -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");    
index 140d66e225bfb58308b6abae45c98d1fc39dd508..de0488dbd2b2eef31da7fcb84f1afbd73cbba345 100644 (file)
         <run class="HelloWorld" ltw="aop-tracing.xml"/>
     </ajc-test>
     
-    <ajc-test dir="bugs151/pr125699" title="inherit adivce with this() and thisJoinPoint">
-        <compile files="Tracing.aj, TestTracing.aj, AtTestTracing.java" options="-1.5"/>
+    <ajc-test dir="bugs151/pr125699" title="inherit advice with this() and thisJoinPoint">
+        <compile files="Tracing.aj, TestTracing.aj, AtTestTracing.java" options="-1.5">
+          <message kind="warning" line="13" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/>
+          <message kind="warning" line="8" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/>
+          <message kind="warning" line="3" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/>
+        </compile>
     </ajc-test>
-    
+
+    <ajc-test dir="bugs151/pr125699" title="inherit advice with this() and thisJoinPoint - 2">
+        <compile files="Tracing.aj, SubAbstractTracing.aj, SubAtAj.java" options="-1.5">
+          <message kind="warning" line="13" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/>
+          <message kind="warning" line="8" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/>
+          <message kind="warning" line="3" text="advice defined in Tracing has not been applied [Xlint:adviceDidNotMatch]"/>
+        </compile>
+    </ajc-test>
+
     <ajc-test dir="bugs151/pr125810" title="warning when inherited pointcut not made concrete">
         <compile files="SuperAspect.aj, SubAspect.aj, SubAtAspect.java" options="-1.5">
           <message kind="error" line="3" text="inherited abstract pointcut SuperAspect.scope() is not made concrete in SubAspect"/>
index db4caee5a153f7c238d78ea6dabec616b6c7e231..118e7bfee1dc75966b8d5271b665c35af1ebf739 100644 (file)
@@ -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) {