aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features152/synchronization/transformed/Three.java
blob: 6a99c2e117547ed9a40cfa951993f4358480c356 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public aspect Three {
  public static void main(String[] args) {
     new C().m3();
     try {new C().m32(); } catch (MyException me) {int i=1;}
     new C().m33();
     try {new C().m34(); } catch (MyException me) {int i=1;}
  }
  after() returning: execution(* m3(..)) { System.err.println("execution advice running1");}
  after() throwing: execution(* m32(..)) { System.err.println("execution advice running2");}
  after() returning: execution(* m33(..)) { System.err.println("execution advice running3");}
  after() throwing: execution(* m34(..)) { System.err.println("execution advice running4");}
}

class C {
  
  public synchronized void m3() {
    System.err.println("hello");
  }

  public synchronized void m32() {
    System.err.println("hello");
    throw new MyException();
  }

  public void m33() {
    synchronized (this) { 
      System.err.println("hello");
    }
  }

  public void m34() {
    synchronized (this) {
      System.err.println("hello");
      throw new MyException();
    }
  }
}
  class MyException extends RuntimeException { }

class ThreeX { pointcut p(): lock(); }