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.

Main.java 954B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. public class Main {
  2. private static class Foo {
  3. int x;
  4. Foo(int x) { this.x = x; }
  5. };
  6. private static int foo(int x) { return x+1; }
  7. public static void main (String args[])
  8. { Main.foo(1);
  9. new Foo(2);
  10. }
  11. }
  12. aspect Aspect {
  13. // calls to a private method
  14. before () : call(* foo(..))
  15. { System.out.println("Matches * foo(..)");
  16. }
  17. before () : call(int foo(int))
  18. { System.out.println("Matches int foo(int)");
  19. }
  20. before () : call(private * foo(..))
  21. { System.out.println("Matches private * foo(..)");
  22. }
  23. before () : call(* foo*(..))
  24. { System.out.println("Matches * foo*(..)");
  25. }
  26. // calls to a constructor that is in a private inner class
  27. before () : call(Main.Foo.new(..)) // <- warning from here
  28. { System.out.println("Matches Main.Foo.new(..)");
  29. }
  30. before () : call(Main.Foo*.new(..))
  31. { System.out.println("Matches Main.Foo*.new(..)");
  32. }
  33. }