Let m be a potentially applicable method (§15.12.2.1) with arity n and formal parameter types F_1, ..., F_n, and let e_1, ..., e_n be the actual argument expressions of the method invocation. Then:
-
If
mis a generic method and the method invocation does not provide explicit type arguments, then the applicability of the method is inferred as specified in §18.5.1. -
If
mis a generic method and the method invocation provides explicit type arguments, then let R_1, ..., R_p (p ≥ 1) be the type parameters ofm, let B_l be the declared bound of R_l (1 ≤ l ≤ p), and let U_1, ..., U_p be the explicit type arguments given in the method invocation. Thenmis applicable by loose invocation if both of the following are true:- For 1 ≤ i ≤ n, if
e_iis pertinent to applicability (§15.12.2.2) thene_iis compatible in a loose invocation context with F_i[R_1:=U_1, ..., R_p:=U_p](§5.3). - For 1 ≤ l ≤ p, U_l
<:B_l[R_1:=U_1, ..., R_p:=U_p].
- For 1 ≤ i ≤ n, if
-
If
mis not a generic method, thenmis applicable by loose invocation if, for 1 ≤ i ≤ n, eithere_iis compatible in a loose invocation context with F_i (§5.3) ore_iis not pertinent to applicability.
If no method applicable by loose invocation is found, the search for applicable 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 applicable by loose invocation.