aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/interAbstract/InterfaceMethodDeclarationNone.java
blob: 97630395d53e5b769c852102869d76fce85db0d6 (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
/* *******************************************************************
 * Copyright (c) 2004 Contributors.
 * All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v 2.0
 * which accompanies this distribution and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
 *
 * Contributors:
 *     Wes Isberg     initial implementation
 * ******************************************************************/

import org.aspectj.testing.Tester;

/**
 * @testcase PR#49784 aspect declares interface method (no modifiers)
 */
public class InterfaceMethodDeclarationNone {

    public static void main(String[] args) {
        Tester.expectEvent("before-execution");
        Tester.expectEvent("before-call");
        I i = new C();
        Tester.check(1 == i.getInt(), "1 == i.getInt()");
        Tester.checkAllEvents();
    }
}

interface I {}

aspect A {
    int I.getInt();  // implicitly public abstract
    before() : execution(int getInt()) && target(I) {
        Tester.event("before-execution");
    }
    before() : call(int getInt()) && target(I) {
        Tester.event("before-call");
    }
}
class C implements I {
    public int getInt() { return 1; }
}