You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

X42.java 568B

123456789101112131415161718192021222324252627282930
  1. // Bind the target and pass in the right order
  2. aspect X42 {
  3. M newM = new M("2");
  4. void around(M t,String p): call(void M.method(String)) && args(p) && target(t) {
  5. System.err.println("advice from code aspect");
  6. proceed( newM , "faked" );
  7. }
  8. public static void main(String []argv) {
  9. M.main(argv);
  10. }
  11. }
  12. class M {
  13. String prefix;
  14. public M(String prefix) { this.prefix = prefix; }
  15. public static void main( String[] args ) {
  16. M m = new M("1");
  17. m.method("real");
  18. }
  19. public void method(String s) { System.err.println(prefix+s); }
  20. }