]> source.dussan.org Git - aspectj.git/commitdiff
255856: test and fix: dont incorrectly process @target(Blah)+
authoraclement <aclement>
Mon, 8 Dec 2008 20:42:54 +0000 (20:42 +0000)
committeraclement <aclement>
Mon, 8 Dec 2008 20:42:54 +0000 (20:42 +0000)
tests/bugs163/pr255856/Bug.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc163/Ajc163Tests.java
tests/src/org/aspectj/systemtest/ajc163/ajc163.xml

diff --git a/tests/bugs163/pr255856/Bug.java b/tests/bugs163/pr255856/Bug.java
new file mode 100644 (file)
index 0000000..65b8aea
--- /dev/null
@@ -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++;
+                }
+        }
+}
+
index ec6d91012de99a40ac8164c1ff51f7525cc3f163..66f7a14c422684ce55eb97386444b478606d3530 100644 (file)
@@ -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");
        }
index 9c65c6f953b8423ac3e2806f3fc505cdc14ef2e1..e3fcb32b26f5cb0c3c7cb7c4834b7084c48acf13 100644 (file)
       </compile>
     </ajc-test>
     
+    <ajc-test dir="bugs163/pr255856" title="attarget with plus">
+      <compile files="Bug.java" options="-1.5">
+      <message kind="error" text="unexpected pointcut element"/>
+      </compile>
+    </ajc-test>
+    
     <ajc-test dir="bugs163/pr253109" title="generic pointcuts - 5">
       <compile files="CodeFive.java" options="-1.5 -showWeaveInfo">
-        <message kind="weave" text="advised by around advice"/>
+        <message kind="weave" line="55" text="advised by around advice"/>
       </compile>
     </ajc-test>