選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

BindingWithAnnotatedItds3.aj 735B

123456789101112131415161718192021222324252627282930313233
  1. // Annotated ITD (ctor) being matched upon and extracted
  2. import java.lang.annotation.*;
  3. @Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
  4. public aspect BindingWithAnnotatedItds3 {
  5. @Fruit("pear") A.new(String s) { this(); }
  6. private @Fruit("orange") A.new(int i) { this(); }
  7. public @Fruit("tomato") A.new(boolean b) { this(); }
  8. public static void main(String[]argv) {
  9. A instance1 = new A("a");
  10. A instance2 = new A(3);
  11. A instance3 = new A(true);
  12. }
  13. }
  14. class A {
  15. }
  16. aspect X {
  17. before(Fruit f): execution(new(..)) && @annotation(f) {
  18. System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
  19. " ("+thisJoinPoint.getSourceLocation()+")");
  20. }
  21. }