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.

CombiningPCDs1.java 539B

123456789101112131415161718192021222324252627
  1. // lock/this
  2. public aspect CombiningPCDs1 {
  3. before(Foo f): lock() && this(f) {
  4. System.err.println("advice running at "+thisJoinPoint.getSourceLocation());
  5. }
  6. public static void main(String[] args) {
  7. Foo aFoo = new Foo();
  8. aFoo.staticM();
  9. aFoo.nonstaticM();
  10. }
  11. static class Foo {
  12. public void nonstaticM() {
  13. synchronized (this) {
  14. System.err.println("non-static method running");
  15. }
  16. }
  17. public static void staticM() {
  18. synchronized (String.class) {
  19. System.err.println("static method running");
  20. }
  21. }
  22. }
  23. }