]> source.dussan.org Git - aspectj.git/commitdiff
245307: test and fix: Aspected annotations cause ajdoc to generate ClassCastExceptions
authoraclement <aclement>
Thu, 28 Aug 2008 02:29:29 +0000 (02:29 +0000)
committeraclement <aclement>
Thu, 28 Aug 2008 02:29:29 +0000 (02:29 +0000)
tests/bugs153/Annotation/A.java [new file with mode: 0644]
tests/bugs153/Annotation/Anno.aj [new file with mode: 0644]
tests/bugs153/Annotation/C.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml

diff --git a/tests/bugs153/Annotation/A.java b/tests/bugs153/Annotation/A.java
new file mode 100644 (file)
index 0000000..b74335b
--- /dev/null
@@ -0,0 +1,7 @@
+package annotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Target;
+
+@Target(ElementType.TYPE)
+public @interface A { }
diff --git a/tests/bugs153/Annotation/Anno.aj b/tests/bugs153/Annotation/Anno.aj
new file mode 100644 (file)
index 0000000..acfdae4
--- /dev/null
@@ -0,0 +1,5 @@
+import annotation.A;
+
+public aspect Anno {
+   declare @type: C : @A;
+}
diff --git a/tests/bugs153/Annotation/C.java b/tests/bugs153/Annotation/C.java
new file mode 100644 (file)
index 0000000..7fe8ac4
--- /dev/null
@@ -0,0 +1,3 @@
+// import
+public class C {
+}
index 21119d00a33f9e888801903f1d4c7beefca853dd..63dd83ef5e6bed0536239c76398dbf7814b6d6b9 100644 (file)
@@ -235,6 +235,18 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
                                        " but found " + ipe.getSourceSignature(), 
                                        expected, ipe.getSourceSignature());
   }
+  public void testAspected_Annotation(){
+         runTest("ensure Annotations are added to import list");
+         IHierarchy top = AsmManager.getDefault().getHierarchy();
+               
+         IProgramElement ipe = top.findElementForLabel(top.getRoot(),          
+         IProgramElement.Kind.IMPORT_REFERENCE,"annotation.A");
+         String expected = "import annotation.A;";
+                       assertEquals("expected source signature to be " + expected + 
+                                       " but found " + ipe.getSourceSignature(), 
+                                       expected, ipe.getSourceSignature());
+                               
+  }
 
   public void testGetSourceSignature_GenericMethods(){
          runTest("ensure getSourceSignature correct with generic method");
index 6f50adc1476e1e7471071d3021e53ee7f6e96974..1b235854eba4d341f1181ca70b0ada54a109fc8c 100644 (file)
     <ajc-test dir="bugs153/GenericMethod" title="ensure getSourceSignature correct with generic method">
       <compile files="C.java" options="-1.5 -emacssym"/>
     </ajc-test> 
+    
+    <ajc-test dir="bugs153/Annotation" title="ensure Annotations are added to import list">
+      <compile files="C.java, Anno.aj, A.java" options="-1.5 -emacssym"/>
+    </ajc-test> 
 </suite>
\ No newline at end of file