15.12.2.8. Inferring Unresolved Type Arguments
If any of the method’s type arguments were not inferred from the types of the actual arguments, they are now inferred as follows.
• If the method result occurs in a context where it will be subject to assignment conversion (§5.2) to a type S, then let R be the declared result type of the method, and let R’ = R[T
1=B(T1) ... Tn=B(Tn)]
, where B(Ti) is the type inferred for Ti in the previous section or Ti if no type was inferred.
If S is a reference type, then let S’ be S. Otherwise, if S is a primitive type, then let S’ be the result of applying boxing conversion (§5.1.7) to S.
Then, a set of initial constraints consisting of:
♦ the constraint S’ >> R’, provided R is not void
; and
♦ additional constraints ...
Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.