From 06ce7bea9ee83d72d1d55cc81f0a2f0cd87a4618 Mon Sep 17 00:00:00 2001 From: aclement Date: Sat, 27 Nov 2010 18:10:01 +0000 Subject: [PATCH] bit more testing --- .../declareMinus/Unsupported.java | 14 ++++++++++ .../features1611/declareMinus/WithValues.java | 26 ++++++++++++++++--- .../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 @@ - + + + - - - + + + -- 2.39.5