blob: e7cb02383b44927e1e35ee80d50d0b7102a3e7a0 (
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
|
public aspect AJDKExamples {
declare warning : call(* whoAreYou())
: "call(* whoAreYou())";
declare warning : call(* A.whoAreYou())
: "call(* A.whoAreYou())";
declare warning : call(A whoAreYou())
: "call(A whoAreYou())";
declare warning : call(A B.whoAreYou())
: "call(A B.whoAreYou())";
declare warning : call(A+ B.whoAreYou())
: "call(A+ B.whoAreYou())";
declare warning : call(B A.whoAreYou())
: "call(B A.whoAreYou())";
declare warning : call(B whoAreYou())
: "call(B whoAreYou())";
declare warning : call(B B.whoAreYou())
: "call(B B.whoAreYou())";
}
class A {
public A whoAreYou() { return this; }
}
class B extends A {
// override A.whoAreYou *and* narrow the return type.
public B whoAreYou() { return this; }
}
class C {
public C() {
A a = new A();
B b = new B();
a.whoAreYou();
b.whoAreYou();
}
}
|