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.

TwoAnonymous.java 999B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. public class TwoAnonymous {
  2. /**/
  3. Runnable i = new Runnable() {
  4. public void run() {
  5. System.out.println("i");
  6. }
  7. private Object foo() { return null; }
  8. };
  9. Runnable j = new Runnable() {
  10. public void run() {
  11. System.out.println(new Integer(0));
  12. }
  13. };
  14. /**/
  15. public static void main(String[] args) {
  16. Runnable k = new Runnable() {
  17. int x = 0;
  18. public void run() {
  19. System.out.println("k");
  20. x = 4;
  21. }
  22. private Object foo() { return null; }
  23. };
  24. Runnable k1 = new Runnable() { public void run() { } };
  25. k.run();
  26. }
  27. }
  28. aspect A {
  29. before(Runnable r): call(void Runnable.run()) && target(r) {
  30. System.out.println("calling run: " + r + ", " + thisJoinPoint.getArgs() +", " + thisJoinPoint.getTarget());
  31. }
  32. after() returning(Runnable r): call(Runnable+.new()) {
  33. System.out.println("new runnable: " + r);
  34. }
  35. before(): set(int x) {
  36. System.out.println("setting x");
  37. }
  38. }