summaryrefslogtreecommitdiffstats
path: root/tests/new/SupersAndInterfaces.java
blob: 8a329dc51aecea91ccf1994369b82c5ae97592e1 (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
import org.aspectj.testing.Tester;

import java.io.IOException;

public class SupersAndInterfaces {
    public static void main(String[] args) throws IOException {
	new C2().m();
	Tester.check("ran before");
	new C().toString();
	Tester.check("ran before toString");
    }
}

class C {
    public void m() throws IOException { 
	if (false) throw new IOException("testing");
    }
    public String toString() {
	return super.toString() + "C";
    }
}

interface I {
    public void m() throws IOException;
}

class C1 extends C implements I {
}

class C2 extends C1 {
    static boolean ranBody;
    public void m() throws IOException {
	ranBody = true;
	super.m();
    }
}

aspect A {
    before(): call(void m()) {
	Tester.note("ran before");
	Tester.check(!C2.ranBody, "first entry");
    }
    before(): call(String toString()) {
	Tester.note("ran before toString");
    }
}