]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 128744 (or at least the LTW problem Sian hit whilst debugging it...)
authoraclement <aclement>
Tue, 21 Feb 2006 15:52:36 +0000 (15:52 +0000)
committeraclement <aclement>
Tue, 21 Feb 2006 15:52:36 +0000 (15:52 +0000)
loadtime/src/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java
tests/bugs151/pr128744/Hello.java [new file with mode: 0644]
tests/bugs151/pr128744/World.java [new file with mode: 0644]
tests/bugs151/pr128744/aop.xml [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java
tests/src/org/aspectj/systemtest/ajc151/ajc151.xml

index ff1ea65cf7217c0b625b7071fd816f98c95a7f41..bb6af4aac29d477127ccaa8e6f8d1f63a6663039 100644 (file)
@@ -164,7 +164,14 @@ public class ConcreteAspectCodeGen {
             ResolvedMember method = (ResolvedMember) methods.next();
             if (method.isAbstract()) {
                 if ("()V".equals(method.getSignature())) {
-                    elligibleAbstractions.add(method.getName());
+                       String n = method.getName();
+                       if (n.startsWith("ajc$pointcut")) { // Allow for the abstract pointcut being from a code style aspect compiled with -1.5 (see test for 128744)
+                               n = n.substring(14);
+                               n = n.substring(0,n.indexOf("$"));
+                               elligibleAbstractions.add(n);
+                       } else {
+                               elligibleAbstractions.add(method.getName());
+                       }
                 } else {
                     reportError("Abstract method '" + method.getName() + "' cannot be concretized as a pointcut (illegal signature, must have no arguments, must return void): " + stringify());
                     return false;
diff --git a/tests/bugs151/pr128744/Hello.java b/tests/bugs151/pr128744/Hello.java
new file mode 100644 (file)
index 0000000..268239e
--- /dev/null
@@ -0,0 +1,17 @@
+
+public class Hello {
+
+       /**
+        * @param args
+        */
+       public static void main(String[] args) {
+               // TODO Auto-generated method stub
+               //System.out.println("main");
+               sayHello();
+       }
+       
+       public static void sayHello(){
+               System.out.println("Hello");    
+       }
+
+}
diff --git a/tests/bugs151/pr128744/World.java b/tests/bugs151/pr128744/World.java
new file mode 100644 (file)
index 0000000..542f1a6
--- /dev/null
@@ -0,0 +1,9 @@
+
+
+public abstract aspect World {
+       public abstract pointcut monitoredOperation();
+       
+       after() : monitoredOperation() {
+               System.out.println("World");
+       }
+}
diff --git a/tests/bugs151/pr128744/aop.xml b/tests/bugs151/pr128744/aop.xml
new file mode 100644 (file)
index 0000000..f93ebc4
--- /dev/null
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?> 
+<aspectj>
+  <aspects>
+    <aspect name="World" /> 
+    <concrete-aspect name="World1" extends="World">
+      <pointcut name="monitoredOperation" expression="execution(* sayHello())" /> 
+    </concrete-aspect>
+  </aspects>
+
+  <weaver options="-verbose -showWeaveInfo" /> 
+</aspectj>
\ No newline at end of file
index 11af510548af87b217da32f1ae486ceddb29b5d2..0832c4a47e564048a1d8d3f53fc926228c0a7404 100644 (file)
@@ -42,6 +42,7 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   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 testBrokenLTW_pr128744() { runTest("broken ltw"); }
   
   public void testMixingNumbersOfTypeParameters_pr125080()   { 
          runTest("mixing numbers of type parameters");    
index dfbcc1b737f9e7b9ff40424903a3d2d95c19efed..c76ccbac7fe47cffa676f3c1b6441dbdc94e8c21 100644 (file)
         <run class="Test" ltw="aop.xml"/>
     </ajc-test>
     
+    <ajc-test dir="bugs151/pr128744" title="broken ltw">
+        <compile files="Hello.java World.java" options="-1.5" />
+        <run class="Hello" ltw="aop.xml">
+               <stdout>
+                <line text="Hello"/>
+                <line text="World"/>
+            </stdout>
+        </run>
+    </ajc-test>
+    
     <ajc-test dir="bugs151/pr125480" title="aop.xml aspect inherits abstract method that has concrete implementation in parent">
         <compile files="HelloWorld.java"/>
         <compile files="AbstractMethods.aj, ConcreteMethods.aj"/>