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
... U p be the type arguments inferred (§ 15.12.2.7 ) for this invocation of m , us-
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:
A i <: S i 4.10 ), or
A i is convertible to some type C i by unchecked conversion (§ 5.1.9 ), and C i <:
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 ).
Otherwise, the most specific method (§ 15.12.2.5 ) is chosen among the methods that are ap-
plicable by subtyping.
15.12.2.3. Phase 2: Identify Matching Arity Methods Applicable by Method Invocation Conversion
Let m be a potentially applicable method (§ 15.12.2.1 ), let e 1 , ..., e n be the actual argument
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:
Search WWH ::




Custom Search