diff options
Diffstat (limited to 'tests/features151/ataround/X10.java')
-rw-r--r-- | tests/features151/ataround/X10.java | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/features151/ataround/X10.java b/tests/features151/ataround/X10.java new file mode 100644 index 000000000..fc94f27c7 --- /dev/null +++ b/tests/features151/ataround/X10.java @@ -0,0 +1,35 @@ +// Bind the this and target on call and change it with proceed... + +aspect X10 { + M newM2 = new M("2"); + M newM3 = new M("3"); + + void around(M t,String p,M t2): call(void M.method(String)) && args(p) && this(t) && target(t2) { + System.err.println("advice from code aspect"); + proceed( newM2,"faked" , newM3); + } + + public static void main(String []argv) { + M.main(argv); + } +} + + + +class M { + + String prefix; + + public M(String prefix) { this.prefix = prefix; } + + public static void main( String[] args ) { + M m = new M("1"); + m.methodCaller("real"); + } + + public void methodCaller(String param) { + method(param); + } + + public void method(String s) { System.err.println(prefix+s); } +} |