]> source.dussan.org Git - aspectj.git/commitdiff
fix for 138158
authoraclement <aclement>
Mon, 24 Apr 2006 10:18:27 +0000 (10:18 +0000)
committeraclement <aclement>
Mon, 24 Apr 2006 10:18:27 +0000 (10:18 +0000)
tests/bugs152/pr138158/Foo.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java

diff --git a/tests/bugs152/pr138158/Foo.java b/tests/bugs152/pr138158/Foo.java
new file mode 100644 (file)
index 0000000..fdda0b4
--- /dev/null
@@ -0,0 +1,27 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Goo {}
+
+
+public class Foo {
+  public static void main(String []argv) {
+    new Foo().m(); 
+  }
+
+  @Goo
+  public void m() {
+    System.err.println("");
+  }
+  
+  public void m2() {
+       System.err.println("");
+  }
+}
+
+aspect X {
+  before(): call(* println(..)) && !@withincode(Goo) {  }
+  
+
+  before(): call(* println(..)) && @withincode(Goo) {  }
+}
\ No newline at end of file
index 09d83eb2bd104663e1d216c3d1bb0d7d27396213..120cd10d243d07b5f02c8bd37af3029330f881fb 100644 (file)
@@ -17,8 +17,9 @@ import org.aspectj.testing.XMLBasedAjcTestCase;
 
 public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
-  //public void testNotAtWithincode_pr138158() { runTest("not at withincode");}
-  //public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");}
+  public void testNotAtWithincode_pr138158_1() { runTest("not at withincode - 1");}
+  public void testNotAtWithincode_pr138158_2() { runTest("not at withincode - 2");}
+//  public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");}
   public void testNpeOnDup_pr138143() { runTest("npe on duplicate method with ataj");}
   public void testPointcutsAndGenerics_pr137496_1() { runTest("pointcuts and generics - B");}
   public void testPointcutsAndGenerics_pr137496_2() { runTest("pointcuts and generics - D");}
index 024fe802dc77d37a3edd45d2125cc7e7de6d84a0..4147db02e031c49ac2c1350b07a1794f54990e90 100644 (file)
       <run class="StatisticsTypeImpl"/>
     </ajc-test>
     
-    <ajc-test dir="bugs152/pr138158" title="not at withincode">
+    <ajc-test dir="bugs152/pr138158" title="not at withincode - 1">
       <compile files="Boo.java" options="-1.5 -showWeaveInfo">
         <message kind="weave" text="Join point 'method-call(void Boo.m())' in Type 'Boo' (Boo.java:9) advised by before advice from 'X' (Boo.java:19)"/>
       </compile>
       <run class="Boo"/>
     </ajc-test>
     
+    <ajc-test dir="bugs152/pr138158" title="not at withincode - 2">
+      <compile files="Foo.java" options="-1.5 -showWeaveInfo">
+        <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Foo' (Foo.java:14) advised by before advice from 'X' (Foo.java:26)"/>
+               <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Foo' (Foo.java:18) advised by before advice from 'X' (Foo.java:23)"/>
+      </compile>
+      <run class="Foo"/>
+    </ajc-test>
+    
     <ajc-test dir="bugs152/pr137568" title="complicated generics declaration">
       <compile files="C.java" options="-emacssym -1.5"/>
       <run class="C"/>
index bb0b3bb6578aa81ad355dca9ebe3b95a58308df6..f4bf40132e7b9235ceec25435d8b36179acd7d01 100644 (file)
@@ -154,11 +154,8 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
                                
                        state.set(btp.getFormalIndex(),var);
                } 
-               return Literal.TRUE;
-//             if (matchInternal(shadow).alwaysTrue()) 
-//                     return Literal.TRUE;
-//             else 
-//                     return Literal.FALSE;
+               if (matchInternal(shadow).alwaysTrue()) return Literal.TRUE;
+               else                                                              return Literal.FALSE;
        }