]> source.dussan.org Git - aspectj.git/commitdiff
329925: declare @field remove annotation
authoraclement <aclement>
Wed, 24 Nov 2010 19:38:28 +0000 (19:38 +0000)
committeraclement <aclement>
Wed, 24 Nov 2010 19:38:28 +0000 (19:38 +0000)
tests/features1611/declareMinus/OnOffITD.java [new file with mode: 0644]

diff --git a/tests/features1611/declareMinus/OnOffITD.java b/tests/features1611/declareMinus/OnOffITD.java
new file mode 100644 (file)
index 0000000..438dd77
--- /dev/null
@@ -0,0 +1,32 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Anno {}
+
+aspect Foo {
+  // one way round
+  declare @field: * OnOffITD.field: -@Anno;
+  declare @field: * OnOffITD.field: @Anno;
+
+  // the other way round
+  declare @field: * OnOffITD.field2: @Anno;
+  declare @field: * OnOffITD.field2: -@Anno;
+}
+
+aspect B {
+  public static int OnOffITD.field;
+  public int OnOffITD.field2;
+}
+
+public class OnOffITD {
+
+
+  public static void main(String[]argv) throws Exception {
+    Object o = OnOffITD.class.getDeclaredField("field").getAnnotation(Anno.class);
+    System.out.println("field annotated? "+(o==null?"no":"yes"));
+
+    o = OnOffITD.class.getDeclaredField("field2").getAnnotation(Anno.class);
+    System.out.println("field2 annotated? "+(o==null?"no":"yes"));
+  }
+}
+