]> source.dussan.org Git - aspectj.git/commitdiff
tests and fix for pr112756 - use of assert/enum as "identifier" in pointcut expression.
authoracolyer <acolyer>
Wed, 9 Nov 2005 10:37:51 +0000 (10:37 +0000)
committeracolyer <acolyer>
Wed, 9 Nov 2005 10:37:51 +0000 (10:37 +0000)
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip
org.eclipse.jdt.core/jdtcore-for-aspectj.jar
tests/bugs150/Pr112756.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml

index 84d619fac2e260c2a8c4c9e459af1203f2922be6..b4b082b317c43d8d55cc55be68317c0bd9c7f9a1 100644 (file)
Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip and b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip differ
index 8d41eb45dae747df5e8c85d42bd46821c8129d67..608cdede50c8650c809757bb5b04de6a8eb791e6 100644 (file)
Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar and b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar differ
diff --git a/tests/bugs150/Pr112756.aj b/tests/bugs150/Pr112756.aj
new file mode 100644 (file)
index 0000000..f1ce5c7
--- /dev/null
@@ -0,0 +1,47 @@
+
+public aspect Pr112756 {
+  private ThreadLocal counts = new ThreadLocal();
+
+  public pointcut testMethodExecution() : 
+    execution(void Test+.test*());
+
+  public pointcut assertCall() : 
+    cflow(testMethodExecution()) && call(void Assert+.assert*(..));
+
+  void around() : testMethodExecution() {
+    counts.set( new Counter());
+  
+    proceed();
+  
+    if(((Counter) counts.get()).getCount()==0) {
+      throw new RuntimeException("No assertions had been called");
+    }
+  }
+
+  before() : assertCall() {
+    ((Counter) counts.get()).inc();
+  }
+  
+}
+
+class Assert {
+       
+       public static boolean assertEquals() { return true; }
+       public static boolean assertSame() { return true; }
+       
+}
+
+class Test {
+       
+       public void testFoo() {}
+       
+}
+
+class Counter {
+       
+       int count;
+       
+       public void inc() { count++; }
+       public int getCount() { return count; }
+       
+}
\ No newline at end of file
index ce90c37a26c92fbb35e9821ff23a74f60c7b75f8..c2e2114f7c44e5a08f6febd475bef382d86a62d6 100644 (file)
@@ -678,6 +678,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
          runTest("adviceexecution join point toString forms");
   }
   
+  public void testAssertWithinPointcutExpression() {
+         runTest("pointcut expression containing 'assert'");
+  }
+  
   // helper methods.....
   
   public SyntheticRepository createRepos(File cpentry) {
index 02ad64b6bc733641b3381d1ac126b0ec78dbfee9..2047ebc4c86c43911678ec6d9e20cb5ff1aaa9ad 100644 (file)
       </run>
     </ajc-test>
     
+    <ajc-test dir="bugs150" pr="112756" title="pointcut expression containing 'assert'">
+     <compile files="Pr112756.aj" options="-warn:assertIdentifier -Xdev:Pinpoint"/>
+    </ajc-test>
+    
     <ajc-test dir="bugs150/pr113066" title="possible static imports bug - 1">
         <compile files="Consts.java,TestNPE.java" options="-1.5"/>
     </ajc-test>