Java Reference
In-Depth Information
• If
m
is a generic method, then let
F
1
...
F
n
be the types of the formal parameters of
m
, and let
R
1
...
R
p
(
p
≥ 1) be the type parameters of
m
, and let
B
l
be the declared
bound of
R
l
(1 ≤
l
≤
p
). Then:
♦ If the method invocation does not provide explicit type arguments, then let
U
1
ing a set of initial constraints consisting of the constraints
A
i
<<
F
i
(1 ≤
i
≤
n
)
for each actual argument expression
e
i
whose type is a reference type.
♦ Otherwise, let
U
1
...
U
p
be the explicit type arguments given in the method in-
vocation.
Then let
S
i
=
F
i
[
R
1
=
U
1
,...,
R
p
=
U
p
]
(1 ≤
i
≤
n
) be the types inferred for the formal
parameters of
m
.
• Otherwise, let
S
1
...
S
n
be the types of the formal parameters of
m
.
The method
m
is
applicable by subtyping
if and only if both of the following conditions
hold:
• For 1 ≤
i
≤
n
, either:
S
i
.
• If
m
is a generic method as described above, then
U
l
<:
B
l
[
R
1
=
U
1
,...,
R
p
=
U
p
]
(1 ≤
l
≤
p
).
If no method applicable by subtyping is found, the search for applicable methods continues
with phase 2 (§
15.12.2.3
).
plicable by subtyping.
15.12.2.3. Phase 2: Identify Matching Arity Methods Applicable by Method Invocation Conversion
expressions of the method invocation, and let
A
i
be the type of
e
i
(1 ≤
i
≤
n
). Then:
• If
m
is a generic method, then let
F
1
...
F
n
be the types of the formal parameters of
m
, and let
R
1
...
R
p
(
p
≥ 1) be the type parameters of
m
, and let
B
l
be the declared
bound of
R
l
(1 ≤
l
≤
p
). Then: