diff options
Diffstat (limited to 'tests/java5/annotations/binding/BindingWithDeclaredAnnotationItds3.aj')
-rw-r--r-- | tests/java5/annotations/binding/BindingWithDeclaredAnnotationItds3.aj | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/java5/annotations/binding/BindingWithDeclaredAnnotationItds3.aj b/tests/java5/annotations/binding/BindingWithDeclaredAnnotationItds3.aj new file mode 100644 index 000000000..3dd5e0d10 --- /dev/null +++ b/tests/java5/annotations/binding/BindingWithDeclaredAnnotationItds3.aj @@ -0,0 +1,36 @@ +// 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()+")"); + } + + +} |