aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs163
diff options
context:
space:
mode:
authoraclement <aclement>2008-12-08 20:42:54 +0000
committeraclement <aclement>2008-12-08 20:42:54 +0000
commit945c4cfec954d918142f5c799fbb45d343eeca63 (patch)
tree6cd0d6eef239d506a1cf8fb3373ee8d44012aeb9 /tests/bugs163
parentddbde46bddb183ac35dde309d09a33e482297154 (diff)
downloadaspectj-945c4cfec954d918142f5c799fbb45d343eeca63.tar.gz
aspectj-945c4cfec954d918142f5c799fbb45d343eeca63.zip
255856: test and fix: dont incorrectly process @target(Blah)+
Diffstat (limited to 'tests/bugs163')
-rw-r--r--tests/bugs163/pr255856/Bug.java61
1 files changed, 61 insertions, 0 deletions
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++;
+ }
+ }
+}
+