Browse Source

tests and fix for pr112756 - use of assert/enum as "identifier" in pointcut expression.

tags/V1_5_0RC1
acolyer 18 years ago
parent
commit
7a1002aba3

BIN
org.eclipse.jdt.core/jdtcore-for-aspectj-src.zip View File


BIN
org.eclipse.jdt.core/jdtcore-for-aspectj.jar View File


+ 47
- 0
tests/bugs150/Pr112756.aj View File

@@ -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; }
}

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java View 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) {

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc150/ajc150.xml View File

@@ -49,6 +49,10 @@
</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>

Loading…
Cancel
Save