aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AfterReturningInterfaceConstructorCE.java
blob: aec297d2cf8810f04e9043dfb091722d4b607472 (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
import org.aspectj.testing.Tester;

/** @testcase PR#889 after returning advice on interface constructor */
public class AfterReturningInterfaceConstructorCE {
    public static void main (String[] args) {
        Tester.expectEvent("constructor");
        Tester.expectEvent("advice");
        I i = new C();
        System.out.println("i.i: " + i.i);
        
        Tester.checkAllEvents();
    }     
}

interface I {}

class C implements I {
    C() {
        Tester.event("constructor");
    }
}

aspect A {
    int I.i;
    I.new() {
        i = 2;
        System.out.println("running I.new()");
    }
    after() returning: execution(I.new()) {    // ERR: can't define constructor on interface
        Tester.event("advice");
    }
}