Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public aspect WHEEEE {
- pointcut hurr(int x, Object k, Object d) : call(* *.*(int)) && args(x) && target(k) && this(d);
- before(int x, Object k, Object d): hurr(x, k, d){
- System.out.println(d.toString() + " calls: "+new Integer(x).toString()+" being applied to "+k);
- }
- }
- public class Harness {
- public static Test1 t1;
- public static Test2 t2;
- static {
- t1 = new Test1();
- t2 = new Test2();
- }
- public static void main(String[] args) {
- t1.derp(10);
- t2.doop(1, 4);
- t2.floop(45);
- }
- }
- class Test2 {
- public Test1 t1 = new Test1();
- public void doop(int y, int x){
- t1.derp(y);
- t1.flerp(x);
- }
- public String floop(int j){
- return "" + j;
- }
- }
- class Test1 {
- public void flerp(int x){
- System.out.println("flerp "+x);
- }
- public void derp(int k){
- System.out.println("derp " +k);
- flerp(k);
- }
- }
- /************************* OUTPUT *************************
- Test1@558ee9d6 calls: 10 being applied to derp
- derp 10
- Test1@558ee9d6 calls: 10 being applied to Test1@558ee9d6
- Test1@558ee9d6 calls: 10 being applied to flerp
- flerp 10
- Test2@199a0c7c calls: 1 being applied to Test1@50a9ae05
- Test1@50a9ae05 calls: 1 being applied to derp
- derp 1
- Test1@50a9ae05 calls: 1 being applied to Test1@50a9ae05
- Test1@50a9ae05 calls: 1 being applied to flerp
- flerp 1
- Test2@199a0c7c calls: 4 being applied to Test1@50a9ae05
- Test1@50a9ae05 calls: 4 being applied to flerp
- flerp 4
- Test2@199a0c7c calls: 45 being applied to
- ************************** OUTPUT ************************/
Add Comment
Please, Sign In to add comment