aboutsummaryrefslogtreecommitdiffstats
path: root/tests/ltw/inclExcl/pkg/Main.aj
blob: 6cf8ae986e4be177f80da818e7c3f3c228c0cf57 (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
45
46
package pkg;

import java.io.File;

public class Main {
    public static void main(String argz[]) {
        foo();
    }

    public static void foo() {
        (new pkg.sub.Foo()).foo();
        
        File dumpDir = new File("_ajdump"); 
        lsLR(dumpDir);
        
        // the LTW harness should clean up _ajdump files!
        cleanup(dumpDir);
    }
    
    public static void lsLR(File dir) {
        String[] files = dir.list();
        if (files == null) return;
        for (int i=0; i<files.length; i++) {
        	File f = new File(dir, files[i]);
        	if (f.isFile()) {
        		System.err.println(files[i]);
        	} else {
        		lsLR(f);
        	}
        }    	
    }
    
    public static void cleanup(File dir) {
        String[] files = dir.list();
        if (files == null) return;
        for (int i=0; i<files.length; i++) {
        	File f = new File(dir, files[i]);
        	if (f.isFile()) {
        		f.delete();
        	} else {
        		cleanup(f);
        	}
        }    	
		dir.delete();
    }
}