Java Reference
In-Depth Information
♦ 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 ).
♦ 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 method invocation conversion if and only if both of the fol-
lowing conditions hold:
• For 1 ≤ i n , the type of e i , A i , can be converted by method invocation conversion
5.3 ) to 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 method invocation conversion is found, the search for applic-
able methods continues with phase 3 (§ 15.12.2.4 ) .
Otherwise, the most specific method (§ 15.12.2.5 ) is chosen among the methods that are ap-
plicable by method invocation conversion.
15.12.2.4. Phase 3: Identify Applicable Variable Arity Methods
Let m be a potentially applicable method (§ 15.12.2.1 ) with variable arity, let e 1 , ..., e k be
the actual argument expressions of the method invocation, and let A i be the type of e i (1 ≤ i
k ). Then:
• If m is a generic method, then let F 1 ... F n (1 ≤ n k +1) be the types of the formal
parameters of m , where F n = T [] for some type T , 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 )
and the constraints A j << T ( n j k ).
♦ Otherwise let U 1 ... U p be the explicit type arguments given in the method in-
vocation.
Search WWH ::




Custom Search