From 945c4cfec954d918142f5c799fbb45d343eeca63 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 8 Dec 2008 20:42:54 +0000 Subject: [PATCH] 255856: test and fix: dont incorrectly process @target(Blah)+ --- tests/bugs163/pr255856/Bug.java | 61 +++++++++++++++++++ .../systemtest/ajc163/Ajc163Tests.java | 4 ++ .../org/aspectj/systemtest/ajc163/ajc163.xml | 8 ++- 3 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 tests/bugs163/pr255856/Bug.java diff --git a/tests/bugs163/pr255856/Bug.java b/tests/bugs163/pr255856/Bug.java new file mode 100644 index 000000000..65b8aeab5 --- /dev/null +++ b/tests/bugs163/pr255856/Bug.java @@ -0,0 +1,61 @@ +package example; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import junit.framework.TestCase; + +import org.aspectj.lang.Aspects; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; + +public class Bug extends TestCase { + + public void testAdviceMatch() { + TestImpl impl = new TestImpl(); + impl.method(); + + assertEquals(0, Aspects.aspectOf(TestAtAspect.class).count); +// assertEquals(0, TestAspect.aspectOf().count); + } + + + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.TYPE) + @Inherited + static @interface TestAnnotation { + } + + @TestAnnotation + static interface TestInterface { + void method(); + } + + static class TestImpl implements TestInterface { +// @Override + public void method() { + } + } + +// static aspect TestAspect { +// int count = 0; +// +// before() : @target(example.Bug.TestAnnotation)+ && execution(* *(..)) { +// count++; +// } +// } + + @Aspect + static class TestAtAspect { + int count = 0; + + @Before("@target(example.Bug.TestAnnotation)+ && execution(* *(..))") + public void increment() { + count++; + } + } +} + diff --git a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java index ec6d91012..66f7a14c4 100644 --- a/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java @@ -28,6 +28,10 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc163Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testAtTargetPlus_pr255856() { + runTest("attarget with plus"); + } + public void testNonNullAtArgs_pr257833() { runTest("param annos and at args"); } diff --git a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml index 9c65c6f95..e3fcb32b2 100644 --- a/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml +++ b/tests/src/org/aspectj/systemtest/ajc163/ajc163.xml @@ -222,9 +222,15 @@ + + + + + + - + -- 2.39.5