blob: 0ee8a869f1650aff6bbee35daa02467d1814e2ad (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
package edu.ucsd.aosd;
import java.io.PrintStream;
public class MyApplication
{
// main
public static void main(String[] args) {
for (String arg : args) {
System.out.println("got: " + arg);
// System.out.printf("got: %s\n", arg);
}
}
}
aspect Printing {
pointcut printlnCalls(PrintStream ps, String out):
call(* PrintStream+.println(String)) && target(ps) && args(out);
Object around(PrintStream ps, String out):
printlnCalls(ps, out) && !adviceexecution() {
return proceed(ps, out);
}
// pointcut printfCalls(PrintStream ps, String fmt, Object[] objs):
// call(* PrintStream+.printf(String, Object...#####))
// && target(ps) && args(fmt, objs);
}
|