summaryrefslogtreecommitdiffstats
path: root/tests/new/cflowObjectCreations/Driver.java
blob: 15f1d883d34f3c0ad4a96175bf12f3c73e5c299e (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
import org.aspectj.testing.Tester;

import java.util.*;

// PR#307 cflow and object creations


public class Driver {

    public static String s = "";
    
    public static void main(String[] args){
        new FTPServer();
        
        Tester.checkEqual(s, "-connected-after", "");
    }  
}

/* PR306 */
class FTPServer {
    public FTPServer() {
        new FTPConnection().connect();
    }
}

class FTPConnection { 
    public void connect() {
        Driver.s += "-connected";    
    }
}

aspect FooBuilding percflow(serverIdentification(FTPServer)) {
    pointcut serverIdentification(FTPServer s) :
        target(s) && execution(new(..));

    after() returning (Object ret):
        target(FTPConnection) && call(* *(..))  {
            Driver.s += "-after";
    }
}