diff options
author | aclement <aclement> | 2006-05-30 09:30:01 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-30 09:30:01 +0000 |
commit | 7235e9d089fa2b12b835cbaab7c253cb1de0b563 (patch) | |
tree | 1f7de35ee9fd95e98d109c46239a891985acc0ee /tests/bugs152/pr122253/PerThis.java | |
parent | 91f54fd96f209fe138228040673a59f9cf210a92 (diff) | |
download | aspectj-7235e9d089fa2b12b835cbaab7c253cb1de0b563.tar.gz aspectj-7235e9d089fa2b12b835cbaab7c253cb1de0b563.zip |
tests for 122253
Diffstat (limited to 'tests/bugs152/pr122253/PerThis.java')
-rw-r--r-- | tests/bugs152/pr122253/PerThis.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/bugs152/pr122253/PerThis.java b/tests/bugs152/pr122253/PerThis.java new file mode 100644 index 000000000..2079c8185 --- /dev/null +++ b/tests/bugs152/pr122253/PerThis.java @@ -0,0 +1,37 @@ +import org.aspectj.lang.*; + +public aspect PerThis perthis(execution(* m(..))) { + + before(): execution(* Foo.*(..)) {} + + public static void main(String []argv) { + print("before"); + new Foo().m(); + print("after"); + } + + public static void print(String prefix) { + System.err.println(prefix); + boolean b1 = Aspects14.hasAspect(PerThis.class,null); + boolean b2 = PerThis.hasAspect(null); + Object o1 = (b1?Aspects14.aspectOf(PerThis.class,null):null); + Object o2 = (b2?PerThis.aspectOf(null):null); + System.err.println("hasAspect? "+b1+" : "+b2); + System.err.println("aspectOf? "+o1+" : "+o2); + } + + public String toString() { return "PerThisInstance"; } +} + +class Foo { + public void m() { print("during");} + public void print(String prefix) { + System.err.println(prefix); + boolean b1 = Aspects14.hasAspect(PerThis.class,this); + boolean b2 = PerThis.hasAspect(this); + Object o1 = (b1?Aspects14.aspectOf(PerThis.class,this):null); + Object o2 = (b2?PerThis.aspectOf(this):null); + System.err.println("hasAspect? "+b1+" : "+b2); + System.err.println("aspectOf? "+o1+" : "+o2); + } +} |