blob: 1046a801413072cb8d6b7b6a65f4779da87db16c (
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
47
48
49
50
51
52
53
54
55
|
/*
* ajc fails to detect call join points using the
* declaring interface as the type when the method
* was declared in the aspect.
*/
public class DeclareWarningAndInterfaceMethodCW {
public static void main(String[] args) {
new C().doSomething();
}
}
interface ICanGetSomething {
Object getSomething();
}
class B implements ICanGetSomething {
public Object getSomething() { // CE conflict here?
return new Object();
}
}
class C {
C() {
new B().getSomething(); // 2 CW declared here
}
static void staticMethod() {
new B().getSomething(); // 2 CW declared here
B b = new B();
b.getSomething(); // 2 CW declared here
ICanGetSomething i = new B();
i.getSomething(); // 2 CW declared here
}
void doSomething() {
Object result = new B().getSomething(); // 2 CW here
if (null == result) {
throw new Error("no result");
}
}
}
/** @testcase PR#40805 interface call signatures when declaring method in aspect */
aspect A {
// comment this out to get correct warnings
public Object ICanGetSomething.getSomething() {
return null;
}
declare warning : call(Object ICanGetSomething.getSomething())
: "call ICanGetSomething.getSomething()";
declare warning : call(Object getSomething())
: "call getSomething()";
}
|