diff options
author | aclement <aclement> | 2010-11-27 18:10:01 +0000 |
---|---|---|
committer | aclement <aclement> | 2010-11-27 18:10:01 +0000 |
commit | 06ce7bea9ee83d72d1d55cc81f0a2f0cd87a4618 (patch) | |
tree | cdf8592d761a76485f2e28832449fb2473e9c044 | |
parent | edfe7deb9e56272d31c8dadfa15c1907cad5e4da (diff) | |
download | aspectj-06ce7bea9ee83d72d1d55cc81f0a2f0cd87a4618.tar.gz aspectj-06ce7bea9ee83d72d1d55cc81f0a2f0cd87a4618.zip |
bit more testing
-rw-r--r-- | tests/features1611/declareMinus/Unsupported.java | 14 | ||||
-rw-r--r-- | tests/features1611/declareMinus/WithValues.java | 26 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml | 10 |
3 files changed, 42 insertions, 8 deletions
diff --git a/tests/features1611/declareMinus/Unsupported.java b/tests/features1611/declareMinus/Unsupported.java index 4275b5aec..54d2af101 100644 --- a/tests/features1611/declareMinus/Unsupported.java +++ b/tests/features1611/declareMinus/Unsupported.java @@ -6,6 +6,12 @@ import java.lang.annotation.RetentionPolicy; String foo(); } +@Retention(RetentionPolicy.RUNTIME) +@interface Banno { + String hoo() default "abcde"; +} + + @Anno(foo="anc") aspect X { @@ -13,6 +19,7 @@ aspect X { declare @method: int i(..): -@Anno; declare @type: X: -@Anno; declare @field: int i: -@Anno(foo="abc"); + public static void main(String[] args) throws Exception { if (X.class.getDeclaredField("i").getAnnotation(Anno.class)==null) { @@ -20,5 +27,12 @@ aspect X { } else { System.out.println("failed"); } + if (X.class.getDeclaredField("j").getAnnotation(Banno.class)==null) { + System.out.println("not on j"); + } else { + System.out.println("is on j"); + } } + + int j; }
\ No newline at end of file diff --git a/tests/features1611/declareMinus/WithValues.java b/tests/features1611/declareMinus/WithValues.java index a756c2e23..3084eb890 100644 --- a/tests/features1611/declareMinus/WithValues.java +++ b/tests/features1611/declareMinus/WithValues.java @@ -1,4 +1,4 @@ -import java.lang.annotation.Retention; +import java.lang.annotation.*; import java.lang.annotation.RetentionPolicy; @Retention(RetentionPolicy.RUNTIME) @@ -11,12 +11,30 @@ public aspect WithValues { int i; declare @field: int i: -@Anno; + declare @field: int j: @Banno(hoo="abc"); + int j; public static void main(String[] args) throws Exception { if (WithValues.class.getDeclaredField("i").getAnnotation(Anno.class)==null) { - System.out.println("not there"); + System.out.println("i does not have Anno"); } else { - System.out.println("failed"); + System.out.println("i has Anno"); + } + Annotation a = WithValues.class.getDeclaredField("j").getAnnotation(Banno.class); + if (a==null) { + System.out.println("j does not have Banno"); + } else { + System.out.println("j has Banno:"+a); + } + a = WithValues.class.getDeclaredField("j").getAnnotation(Anno.class); + if (a==null) { + System.out.println("j does not have Anno"); + } else { + System.out.println("j has Anno:"+a); } } -}
\ No newline at end of file +} +@Retention(RetentionPolicy.RUNTIME) +@interface Banno { + String hoo(); +} diff --git a/tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml b/tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml index ff56008a8..7ba5316b5 100644 --- a/tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml +++ b/tests/src/org/aspectj/systemtest/ajc1611/newfeatures-tests.xml @@ -108,15 +108,17 @@ <compile files="WithValues.java" options="-1.5"/> <run class="WithValues"> <stdout> - <line text="not there"/> + <line text="i does not have Anno"/> + <line text="j has Banno:@Banno(hoo=abc)"/> + <line text="j does not have Anno"/> </stdout></run> </ajc-test> <ajc-test dir="features1611/declareMinus" title="declare minus - unsupported"> <compile files="Unsupported.java" options="-1.5"> - <message kind="error" line="13" text="Annotation removal only supported for declare @field (compiler limitation)"/> - <message kind="error" line="14" text="Annotation removal only supported for declare @field (compiler limitation)"/> - <message kind="error" line="15" text="Annotation removal does not allow values to be specified for the annotation (compiler limitation)"/> + <message kind="error" line="19" text="Annotation removal only supported for declare @field (compiler limitation)"/> + <message kind="error" line="20" text="Annotation removal only supported for declare @field (compiler limitation)"/> + <message kind="error" line="21" text="Annotation removal does not allow values to be specified for the annotation (compiler limitation)"/> </compile> </ajc-test> |