Browse Source

245307: test and fix: Aspected annotations cause ajdoc to generate ClassCastExceptions

tags/V1_6_2
aclement 15 years ago
parent
commit
5077a5824f

+ 7
- 0
tests/bugs153/Annotation/A.java View File

@@ -0,0 +1,7 @@
package annotation;

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

@Target(ElementType.TYPE)
public @interface A { }

+ 5
- 0
tests/bugs153/Annotation/Anno.aj View File

@@ -0,0 +1,5 @@
import annotation.A;

public aspect Anno {
declare @type: C : @A;
}

+ 3
- 0
tests/bugs153/Annotation/C.java View File

@@ -0,0 +1,3 @@
// import
public class C {
}

+ 12
- 0
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java View 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");

+ 4
- 0
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml View File

@@ -849,4 +849,8 @@
<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>

Loading…
Cancel
Save