diff options
author | aclement <aclement> | 2005-03-23 21:31:49 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-03-23 21:31:49 +0000 |
commit | 0d14ccfa4ce92c9adc2f849a4ee4f22c5b3a5ef7 (patch) | |
tree | 2c85206ea7b7989353eef7a9aaac59e9a0c88f32 /tests | |
parent | fb01cad1cc839b23cba31cd4dd5f44f68bad4411 (diff) | |
download | aspectj-0d14ccfa4ce92c9adc2f849a4ee4f22c5b3a5ef7.tar.gz aspectj-0d14ccfa4ce92c9adc2f849a4ee4f22c5b3a5ef7.zip |
Enhancement 88862: declare annotation hitting ITDs.
Diffstat (limited to 'tests')
3 files changed, 161 insertions, 21 deletions
diff --git a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java index fb013fbd7..b8055c706 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java +++ b/tests/src/org/aspectj/systemtest/ajc150/AnnotationBinding.java @@ -267,4 +267,36 @@ public class AnnotationBinding extends XMLBasedAjcTestCase { public void testCallsAndExecutionsOfStaticMethods() { runTest("binding with static methods"); } + + ///////////////////////////////////////////////////////////////////////////////// + // annotation binding with ITDs + + public void testAnnotationBindingAndITDs1() { + runTest("simple binding annotation values where itd method is annotated"); + } + + public void testAnnotationBindingAndITDs2() { + runTest("simple binding annotation values where itd field is annotated"); + } + + public void testAnnotationBindingAndITDs3() { + runTest("simple binding annotation values where itd ctor is annotated"); + } + + public void testAnnotationBindingAndITDs4() { + runTest("simple binding annotation values where itd method is annotated via declare"); + } + + public void testAnnotationBindingAndITDs5() { + runTest("simple binding annotation values where itd field is annotated via declare"); + } + + public void testAnnotationBindingAndITDs6() { + runTest("simple binding annotation values where itd field is annotated multiple times via declare"); + } + + public void testAnnotationBindingAndITDs7() { + runTest("simple binding annotation values where itd ctor is annotated via declare"); + } + }
\ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc150/Annotations.java b/tests/src/org/aspectj/systemtest/ajc150/Annotations.java index 3a099a2ab..b0efd8949 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Annotations.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Annotations.java @@ -76,7 +76,11 @@ public class Annotations extends XMLBasedAjcTestCase { // more implementation work needed before this test passes public void testAnnotatedITDs() { + try { runTest("annotated itds"); + } finally { + System.err.println(ajc.getLastCompilationResult().getStandardError()); + } } public void testAnnotatedITDsWithWrongAnnotationType() { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index c80d5f681..46d57ee6a 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -486,39 +486,57 @@ <ajc-test dir="java5/annotations/itds" vm="1.5" title="nasty annotation and itds test"> <compile files="AnnotationsAndITDs.aj" options="-1.5"> - <message kind="warning" line="25" text="execution(@SomeAnnotation ...)"/> - <message kind="warning" line="28" text="execution(@SomeAnnotation ...)"/> - <message kind="warning" line="52" text="execution(@SomeAnnotation ...)"/> - <message kind="warning" line="53" text="execution(@SomeAnnotation ...)"/> + <!-- first two are ITCs, second two are ITCs annotated via declare @ctor, third is default ctor --> <message kind="warning" line="17" text="execution(@SomeAnnotation ...new(..)"/> <message kind="warning" line="20" text="execution(@SomeAnnotation ...new(..)"/> <message kind="warning" line="45" text="execution(@SomeAnnotation ...new(..)"/> <message kind="warning" line="46" text="execution(@SomeAnnotation ...new(..)"/> + <message kind="warning" line="180" text="execution(@SomeAnnotation ...new(..)"/> + + <!-- first four are fields annotated via declare, last two are directly annotated ITDs --> + <message kind="warning" line="59" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="60" text="set(@SomeAnnotation...)"/> <message kind="warning" line="70" text="set(@SomeAnnotation...)"/> <message kind="warning" line="71" text="set(@SomeAnnotation...)"/> <message kind="warning" line="76" text="set(@SomeAnnotation...)"/> <message kind="warning" line="77" text="set(@SomeAnnotation...)"/> + + <!-- annotations added via declare --> <message kind="warning" line="175" text="si(@SomeAnnotation...)"/> <message kind="warning" line="180" text="si(@SomeAnnotation...)"/> + + <message kind="warning" line="25" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="28" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="52" text="execution(@SomeAnnotation ...)"/> + <message kind="warning" line="53" text="execution(@SomeAnnotation ...)"/> + <!--message kind="warning" line="70" text="set(@SomeAnnotation...)"/> + <message kind="warning" line="71" text="set(@SomeAnnotation...)"/--> </compile> <run class="AnnotationsAndITDs"> - <stdout> - <line text="@type System"/> - <line text="hello AnnotationsAndITDs"/> - <line text="goodbye String"/> - <line text="x Object"/> - <line text="y Integer"/> + <stderr> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="hello AnnotationsAndITDs (AnnotationsAndITDs.aj:17)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="goodbye java.lang.String (AnnotationsAndITDs.aj:20)"/> + <line text="y java.lang.Integer (AnnotationsAndITDs.aj:28)"/> + <line text="d java.lang.Double (AnnotationsAndITDs.aj:70)"/> + <line text="f java.lang.Double (AnnotationsAndITDs.aj:71)"/> + <line text="@type java.lang.System (AnnotationsAndITDs.aj:0)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:45)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:59)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:60)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@cons java.lang.String (AnnotationsAndITDs.aj:46)"/> + <line text="@method ITDMe2 (AnnotationsAndITDs.aj:53)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:76)"/> + <line text="@field ITDMe2 (AnnotationsAndITDs.aj:77)"/> + + <!-- <line text="method bar has 1 params, first param annotation is @ParamAnnotation"/> - <line text="d Double"/> - <line text="f Double"/> - <line text="@type System"/> - <line text="@cons String"/> - <line text="@cons String"/> - <line text="@method ITDMe2"/> - <line text="@method ITDMe2"/> - <line text="@field ITDMe2"/> - <line text="@field ITDMe2"/> - </stdout> + --> + </stderr> </run> </ajc-test> @@ -1066,6 +1084,7 @@ <message kind="warning" line="8" text="annotated field"/> <message kind="warning" line="10" text="annotated method"/> <message kind="warning" line="12" text="annotated constructor"/> + <message kind="warning" line="12" text="annotated field"/> </compile> </ajc-test> @@ -2022,9 +2041,94 @@ <compile files="DeathByAnnotations.aj" options="-1.5,-emacssym" xlintfile="ignoreTypeNotExposed.properties"/> <run class="p.q.DeathByAnnotations"/> </ajc-test> + + <!-- ======================================================================================= --> + <!-- annotation binding with ITDs --> + <!-- ======================================================================================= --> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated"> + <compile files="BindingWithAnnotatedItds1.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds1"> + <stderr> + <line text="Found apple at jp execution(int A.m()) (BindingWithAnnotatedItds1.aj:8)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated"> + <compile files="BindingWithAnnotatedItds2.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds2"> + <stderr> + <line text="Found banana at jp set(int A.i) (BindingWithAnnotatedItds2.aj:16)"/> + <line text="Found apple at jp set(String A.j) (BindingWithAnnotatedItds2.aj:17)"/> + <line text="Found orange at jp set(int[] A.k) (BindingWithAnnotatedItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated"> + <compile files="BindingWithAnnotatedItds3.aj" options="-1.5"/> + <run class="BindingWithAnnotatedItds3"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithAnnotatedItds3.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithAnnotatedItds3.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithAnnotatedItds3.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <!-- ======================================================================================= --> + <!-- declare annotation targetting ITDs --> + <!-- ======================================================================================= --> + + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd method is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds1.aj" options="-1.5"/> + <run class="BindingWithDeclaredAnnotationItds1"> + <stderr> + <line text="Found orange at jp call(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:16)"/> + <line text="Found orange at jp execution(int A.m()) (BindingWithDeclaredAnnotationItds1.aj:8)"/> + <line text="Found banana at jp call(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:17)"/> + <line text="Found banana at jp execution(int A.n()) (BindingWithDeclaredAnnotationItds1.aj:10)"/> + <line text="Found tomato at jp call(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:18)"/> + <line text="Found tomato at jp execution(int A.o()) (BindingWithDeclaredAnnotationItds1.aj:12)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds2.aj" options="-1.5"/> + <run class="BindingWithDeclaredAnnotationItds2"> + <stderr> + <line text="Found orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds2.aj:16)"/> + <line text="Found banana at jp set(String A.j) (BindingWithDeclaredAnnotationItds2.aj:17)"/> + <line text="Found apple at jp set(boolean[] A.k) (BindingWithDeclaredAnnotationItds2.aj:18)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd field is annotated multiple times via declare"> + <compile files="BindingWithDeclaredAnnotationItds3.aj" options="-1.5"/> + <run class="BindingWithDeclaredAnnotationItds3"> + <stderr> + <line text="Found fruit orange at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + <line text="Found drink margarita at jp set(int A.i) (BindingWithDeclaredAnnotationItds3.aj:13)"/> + </stderr> + </run> + </ajc-test> + + <ajc-test dir="java5/annotations/binding" title="simple binding annotation values where itd ctor is annotated via declare"> + <compile files="BindingWithDeclaredAnnotationItds4.aj" options="-1.5"/> + <run class="BindingWithDeclaredAnnotationItds4"> + <stderr> + <line text="Found pear at jp execution(A(String)) (BindingWithDeclaredAnnotationItds4.aj:8)"/> + <line text="Found orange at jp execution(A(int)) (BindingWithDeclaredAnnotationItds4.aj:10)"/> + <line text="Found tomato at jp execution(A(boolean)) (BindingWithDeclaredAnnotationItds4.aj:12)"/> + </stderr> + </run> + </ajc-test> - <!-- ============================================================== --> + <!-- ============================================================== --> <ajc-test dir="options/aspectpath" title="dirs on aspectpath"> <compile files="MyAspect.aj" options="-d out"/> |