]> source.dussan.org Git - aspectj.git/commitdiff
test and fix for 169706: inherited annotations down a hierarchy greater than 2 deep
authoraclement <aclement>
Mon, 8 Jan 2007 15:45:41 +0000 (15:45 +0000)
committeraclement <aclement>
Mon, 8 Jan 2007 15:45:41 +0000 (15:45 +0000)
tests/bugs160/pr169706/A.java [new file with mode: 0644]
tests/bugs160/pr169706/B.java [new file with mode: 0644]
tests/bugs160/pr169706/C.java [new file with mode: 0644]
tests/bugs160/pr169706/MyAnnotation.java [new file with mode: 0644]
tests/bugs160/pr169706/MyAspect.java [new file with mode: 0644]
tests/bugs160/pr169706/Test.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java
tests/src/org/aspectj/systemtest/ajc160/ajc160.xml

diff --git a/tests/bugs160/pr169706/A.java b/tests/bugs160/pr169706/A.java
new file mode 100644 (file)
index 0000000..a40ef7b
--- /dev/null
@@ -0,0 +1,8 @@
+public class A {
+
+    @MyAnnotation
+    public void foo() {
+
+    }
+
+}
diff --git a/tests/bugs160/pr169706/B.java b/tests/bugs160/pr169706/B.java
new file mode 100644 (file)
index 0000000..120fb18
--- /dev/null
@@ -0,0 +1,3 @@
+public class B extends A {
+
+}
diff --git a/tests/bugs160/pr169706/C.java b/tests/bugs160/pr169706/C.java
new file mode 100644 (file)
index 0000000..8acb667
--- /dev/null
@@ -0,0 +1,3 @@
+public class C extends B {
+
+}
diff --git a/tests/bugs160/pr169706/MyAnnotation.java b/tests/bugs160/pr169706/MyAnnotation.java
new file mode 100644 (file)
index 0000000..7230843
--- /dev/null
@@ -0,0 +1,3 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface MyAnnotation {}
diff --git a/tests/bugs160/pr169706/MyAspect.java b/tests/bugs160/pr169706/MyAspect.java
new file mode 100644 (file)
index 0000000..e533064
--- /dev/null
@@ -0,0 +1,16 @@
+public aspect MyAspect {
+
+    // this throws an exception
+    before(MyAnnotation myAnnotation) : 
+        //call(* *..*.*(..)) &&
+        call(@MyAnnotation * *(..)) &&
+        @annotation(myAnnotation) {
+
+    }
+
+    // this, however, works fine
+//     before() : 
+ //        call(@MyAnnotation * *(..)) {
+  //   
+   //  }
+}
diff --git a/tests/bugs160/pr169706/Test.java b/tests/bugs160/pr169706/Test.java
new file mode 100644 (file)
index 0000000..b8af6a6
--- /dev/null
@@ -0,0 +1,8 @@
+public class Test {
+
+    public static void main(String args[]) {
+        C c = new C();
+        c.foo();
+    }
+
+}
index f819e3349cb03b9a6b3911dacf0d421b3ebe87a9..adc134330743f621f85a9c7681799792a127c348 100644 (file)
@@ -21,6 +21,7 @@ import junit.framework.Test;
  */
 public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
        
+  public void testInheritedAnnotations_pr169706() { runTest("inherited annotations");}
   public void testGenericFieldNPE_pr165885() { runTest("generic field npe");}
   public void testIncorrectOptimizationOfIstore_pr166084() { runTest("incorrect optimization of istore"); }
   public void testDualParameterizationsNotAllowed_pr165631() { runTest("dual parameterizations not allowed"); }
index d0c440e41e27e97b8bc539554d2a85b795be8f18..a8321545277b20e023303f9ef27b535c49212a8c 100644 (file)
@@ -4,6 +4,12 @@
 <suite>
 
  <!-- first section - dont need a 1.6 vm but fixed in the 1.6 branch of AspectJ -->
+    <ajc-test dir="bugs160/pr169706" title="inherited annotations">
+      <compile files="A.java,B.java,C.java,MyAspect.java,MyAnnotation.java,Test.java" options="-1.5 -showWeaveInfo">
+        <message kind="weave" text="Join point 'method-call(void C.foo())' in Type 'Test' (Test.java:5) advised by before advice from 'MyAspect' (MyAspect.java:4)"/>
+         </compile>
+    </ajc-test>
+    
     <ajc-test dir="bugs160/pr165885" title="generic field npe">
       <compile files="Concrete.java,Abstract.java,Aspect.java" options="-1.5">
         <message kind="warning" line="8" text="foo"/>