diff options
Diffstat (limited to 'tests/design/reflect/Simple.java')
-rw-r--r-- | tests/design/reflect/Simple.java | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/design/reflect/Simple.java b/tests/design/reflect/Simple.java new file mode 100644 index 000000000..59a5b7ffe --- /dev/null +++ b/tests/design/reflect/Simple.java @@ -0,0 +1,28 @@ +import org.aspectj.lang.reflect.*; + +public class Simple { + public static void main(String[] args) { + new Simple().foo("hi"); + } + + void foo(String s) { + System.out.println("foo(" + s + ")"); + } + + char ch = 'a'; + int i = 0; +} + +aspect A { + before(): execution(* *.*(..)) { + System.out.println(thisJoinPoint+ ", " + thisEnclosingJoinPointStaticPart); + } + before(): call(* *.*(..)) && !within(A) { + System.out.println("call: " + thisJoinPoint.getThis()+ ", " + thisEnclosingJoinPointStaticPart); + } + + before(): set(* Simple.*) { + //Object old = ((FieldAccessJoinPoint)thisJoinPoint).getValue(); + System.out.println(thisJoinPoint +", " + thisJoinPoint.getArgs()); + } +} |