aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/Finalizer.java
blob: f66643bc7d20f43eec7eb4d30735e44b66fa6c6c (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
// for Bug#:  30026
import org.aspectj.testing.Tester;


public class Finalizer {
    public static void main(String args[]) {
        Finalizer np = new Finalizer();
        np = null;
    }

    public void finalize() throws Throwable {
    }
}

aspect FinalizeContract {
    pointcut finalizeCall(Object o):
        this(Object+) &&
        this(o) &&
        execution(void finalize());

    void around(Object o) throws Throwable: finalizeCall(o) {
        o.finalize();               // error
        //((Finalizer) o).finalize();   // ok
        proceed(o);
    }
}