diff options
Diffstat (limited to 'weaver5/java5-testsrc')
-rw-r--r-- | weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java b/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java index 6127b2dd8..6e05580b9 100644 --- a/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java +++ b/weaver5/java5-testsrc/org/aspectj/weaver/tools/Java15PointcutExpressionTest.java @@ -283,6 +283,22 @@ public class Java15PointcutExpressionTest extends TestCase { assertTrue("should match",sm1.alwaysMatches()); } + public void testReferencePCsInSameType() throws Exception { + PointcutExpression ex = parser.parsePointcutExpression("org.aspectj.weaver.tools.Java15PointcutExpressionTest.NamedPointcutResolution.c()",NamedPointcutResolution.class,new PointcutParameter[0]); + ShadowMatch sm = ex.matchesMethodExecution(a); + assertTrue("should match",sm.alwaysMatches()); + sm = ex.matchesMethodExecution(b); + assertTrue("does not match",sm.neverMatches()); + } + + public void testReferencePCsInOtherType() throws Exception { + PointcutExpression ex = parser.parsePointcutExpression("org.aspectj.weaver.tools.Java15PointcutExpressionTest.ExternalReferrer.d()",ExternalReferrer.class,new PointcutParameter[0]); + ShadowMatch sm = ex.matchesMethodExecution(a); + assertTrue("should match",sm.alwaysMatches()); + sm = ex.matchesMethodExecution(b); + assertTrue("does not match",sm.neverMatches()); + } + protected void setUp() throws Exception { super.setUp(); parser = PointcutParser.getPointcutParserSupportingAllPrimitivesAndUsingSpecifiedClassloaderForResolution(this.getClass().getClassLoader()); @@ -334,6 +350,26 @@ public class Java15PointcutExpressionTest extends TestCase { static class GoldenOldie { public void foo() {} } + + private static class NamedPointcutResolution { + + @Pointcut("execution(* *(..))") + public void a() {} + + @Pointcut("this(org.aspectj.weaver.tools.Java15PointcutExpressionTest.A)") + public void b() {} + + @Pointcut("a() && b()") + public void c() {} + } + + private static class ExternalReferrer { + + @Pointcut("org.aspectj.weaver.tools.Java15PointcutExpressionTest.NamedPointcutResolution.a() && " + + "org.aspectj.weaver.tools.Java15PointcutExpressionTest.NamedPointcutResolution.b())") + public void d() {} + + } } |