You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Code2.java 426B

1234567891011121314151617181920
  1. import java.lang.annotation.*;
  2. @Retention(RetentionPolicy.RUNTIME)
  3. @interface Anno {}
  4. aspect Foo {
  5. declare @field: * Code2.someField: -@Anno;
  6. @Anno
  7. public int Code2.someField;
  8. }
  9. public class Code2 {
  10. public static void main(String[]argv) throws Exception {
  11. Object o = Code2.class.getDeclaredField("someField").getAnnotation(Anno.class);
  12. System.out.println(o==null?"no annotation":"has annotation");
  13. }
  14. }