]> source.dussan.org Git - aspectj.git/commitdiff
Fix for failure when lock()/unlock() used in XML defined pointcut and would require...
authoraclement <aclement>
Wed, 2 Aug 2006 08:46:25 +0000 (08:46 +0000)
committeraclement <aclement>
Wed, 2 Aug 2006 08:46:25 +0000 (08:46 +0000)
tests/src/org/aspectj/systemtest/ajc152/SynchronizationTransformTests.java
tests/src/org/aspectj/systemtest/ajc152/synchronization.xml
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java

index 75f57c8fee1a1f6ed4fd06bc511337ac2339f6aa..ec4c1280a88ac80dd5a1300998a000cd99a1aba9 100644 (file)
@@ -174,6 +174,10 @@ public class SynchronizationTransformTests extends XMLBasedAjcTestCase {
     public void testJoinpointsEnabledButNoLock() {
        runTest("joinpoints enabled but no lock");
     }
+    
+    public void testTransformWithLTW() {
+       runTest("transform with LTW");
+    }
 
     // more complex code sequences...
     public void testOtherTargeters() {
index d0cf6e0b2a9a1fcb08e3cd6e28797d2f3dd318f0..8b4a7ed475224e96f291fdea12aa253de38e4a1f 100644 (file)
         </run>
     </ajc-test>
     
+    <ajc-test dir="features152/synchronization/transformed" title="transform with LTW">
+        <compile files="CaptureLock.aj" options="-1.5"/>
+        <compile files="Program.java" options="-1.5"/>
+        <run class="Program" ltw="aop1.xml">
+               <stdout>
+                 <line text="Before a lock or unlock"/>
+                 <line text="hello from b()"/>
+                 <line text="Before a lock or unlock"/>
+                 <line text="Before a lock or unlock"/>
+                 <line text="bang in c()"/>
+                 <line text="Before a lock or unlock"/>
+                 <line text="Before a lock or unlock"/>
+                 <line text="hello from d()"/>
+                 <line text="Before a lock or unlock"/>
+                 <line text="hello from block in d()"/>
+                 <line text="Before a lock or unlock"/>
+                 <line text="Before a lock or unlock"/>
+            </stdout>
+        </run>
+    </ajc-test>
+    
     <ajc-test dir="features152/synchronization" title="using lock with LTW">
         <compile files="LockAspect1.java" options="-1.5 -Xjoinpoints:synchronization"/>
         <compile files="BasicProgram1.java" options="-1.5 -Xjoinpoints:synchronization"/>
index 4e28a619ec5a4fc9d0538037b1d95028633380be..4621fb776a0eef1cca95408602a07b9281e3c039 100644 (file)
@@ -1726,6 +1726,7 @@ public class AtAjAttributes {
                PatternParser parser = new PatternParser(pointcutString, struct.context);
             Pointcut pointcut = parser.parsePointcut();
             parser.checkEof();
+            pointcut.check(null,struct.enclosingType.getWorld());
             if (!allowIf && pointcutString.indexOf("if()") >= 0 && hasIf(pointcut)) {
                 reportError("if() pointcut is not allowed at this pointcut location '" + pointcutString +"'", struct);
                 return null;