From: acolyer Date: Wed, 9 Nov 2005 10:37:51 +0000 (+0000) Subject: tests and fix for pr112756 - use of assert/enum as "identifier" in pointcut expression. X-Git-Tag: V1_5_0RC1~216 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7a1002aba3960caddb4c50ef7e66cc9ac6fb1f58;p=aspectj.git tests and fix for pr112756 - use of assert/enum as "identifier" in pointcut expression. --- diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip index 84d619fac..b4b082b31 100644 Binary files a/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip and b/org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip differ diff --git a/org.eclipse.jdt.core/jdtcore-for-aspectj.jar b/org.eclipse.jdt.core/jdtcore-for-aspectj.jar index 8d41eb45d..608cdede5 100644 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 index 000000000..f1ce5c7ae --- /dev/null +++ b/tests/bugs150/Pr112756.aj @@ -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 diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index ce90c37a2..c2e2114f7 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -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) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 02ad64b6b..2047ebc4c 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -49,6 +49,10 @@ + + + +