--- /dev/null
+// Annotated ITD (method) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+
+public aspect BindingWithAnnotatedItds1 {
+
+ @Fruit("apple") int A.m() { return 1; }
+
+ public static void main(String[]argv) {
+ A a = new A();
+ a.m();
+ }
+
+}
+
+class A { }
+
+aspect X {
+
+ before(Fruit f): execution(* *(..)) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+}
--- /dev/null
+// Annotated ITD (field) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+
+public aspect BindingWithAnnotatedItds2 {
+
+ @Fruit("banana") int A.i;
+
+ public @Fruit("apple") String A.j;
+
+ private @Fruit("orange") int[] A.k;
+
+ public static void main(String[]argv) {
+ A a = new A();
+ a.i = 5;
+ a.j = "hello";
+ a.k = new int[]{1,2,3};
+ }
+
+}
+
+class A { }
+
+aspect X {
+
+ before(Fruit f): set(* *) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+ //before(Fruit f): execution(* *(..)) && @annotation(f) {
+ // System.err.println("Execution of something fruity at this jp"+thisJoinPoint+
+ // " ("+thisJoinPoint.getSourceLocation()+")");
+ //}
+
+}
--- /dev/null
+// Annotated ITD (ctor) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+
+public aspect BindingWithAnnotatedItds3 {
+
+ @Fruit("pear") A.new(String s) { }
+
+ private @Fruit("orange") A.new(int i) { }
+
+ public @Fruit("tomato") A.new(boolean b) { }
+
+ public static void main(String[]argv) {
+ A instance1 = new A("a");
+ A instance2 = new A(3);
+ A instance3 = new A(true);
+ }
+
+}
+
+class A {
+
+}
+
+aspect X {
+
+ before(Fruit f): execution(new(..)) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+}
--- /dev/null
+// Annotated ITD (method) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+
+public aspect BindingWithDeclaredAnnotationItds1 {
+
+ int A.m() { return 1; }
+
+ public int A.n() { return 2; }
+
+ private int A.o() { return 3; }
+
+ public static void main(String[]argv) {
+ A a = new A();
+ a.m();
+ a.n();
+ a.o();
+ }
+
+}
+
+class A { }
+
+aspect X {
+
+ declare @method: int A.m(): @Fruit("orange");
+
+ declare @method: int A.n(): @Fruit("banana");
+
+ declare @method: int A.o(): @Fruit("tomato");
+
+ before(Fruit f): execution(* *(..)) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+ before(Fruit f): call(* *(..)) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+
+}
--- /dev/null
+// Annotated ITD (field) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+
+public aspect BindingWithDeclaredAnnotationItds2 {
+
+ int A.i;
+
+ private String A.j;
+
+ public boolean[] A.k;
+
+ public static void main(String[]argv) {
+ A a = new A();
+ a.i = 5;
+ a.j = "hello";
+ a.k = new boolean[]{true,false};
+ }
+
+}
+
+class A { }
+
+aspect X {
+
+ declare @field: int A.i: @Fruit("orange");
+
+ declare @field: String A.j: @Fruit("banana");
+
+ declare @field: boolean[] A.k: @Fruit("apple");
+
+ before(Fruit f): set(* *) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+
+}
--- /dev/null
+// Annotated ITD (field) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+@Retention(RetentionPolicy.RUNTIME) @interface Drink { String value();}
+
+public aspect BindingWithDeclaredAnnotationItds3 {
+
+ int A.i;
+
+ public static void main(String[]argv) {
+ A a = new A();
+ a.i = 5;
+ }
+
+}
+
+class A { }
+
+aspect X {
+
+ declare @field: int A.i: @Fruit("orange");
+ declare @field: int A.i: @Drink("margarita");
+
+ before(Fruit f): set(* *) && @annotation(f) {
+ System.err.println("Found fruit "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+ before(Drink d): set(* *) && @annotation(d) {
+ System.err.println("Found drink "+d.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+
+}
--- /dev/null
+// Annotated ITD (ctor) being matched upon and extracted
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME) @interface Fruit { String value();}
+
+public aspect BindingWithDeclaredAnnotationItds4 {
+
+ A.new(String s) { }
+
+ private A.new(int i) { }
+
+ public A.new(boolean b) { }
+
+ public static void main(String[]argv) {
+ A instance1 = new A("a");
+ A instance2 = new A(3);
+ A instance3 = new A(true);
+ }
+
+}
+
+class A {
+
+}
+
+aspect X {
+
+ declare @constructor: A.new(String): @Fruit("pear");
+ declare @constructor: A.new(int): @Fruit("orange");
+ declare @constructor: A.new(boolean): @Fruit("tomato");
+
+ before(Fruit f): execution(new(..)) && @annotation(f) {
+ System.err.println("Found "+f.value()+" at jp "+thisJoinPoint+
+ " ("+thisJoinPoint.getSourceLocation()+")");
+ }
+
+}