10.12.2012 Views

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

The Java Language Specification, Third Edition

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

15.12.2 Compile-Time Step 2: Determine Method Signature EXPRESSIONS<br />

466<br />

DISCUSSION<br />

<strong>The</strong> possibility of an infinite type stems from the recursive calls to lub().<br />

Readers familiar with recursive types should note that an infinite type is not the same<br />

as a recursive type.<br />

15.12.2.8 Inferring Unresolved Type Arguments<br />

If any of the method’s type arguments were not inferred from the types of the<br />

actual arguments, they are now inferred as follows.<br />

• If the method result occurs in a context where it will be subject to assignment<br />

conversion (§5.2) to a type S, then let R be the declared result type of the<br />

method, and let R’ = R[T1 = B(T1) ... Tn = B(Tn)] where B(Ti) is the<br />

type inferred for Ti in the previous section, or Ti if no type was inferred.<br />

<strong>The</strong>n, a set of initial constraints consisting of:<br />

• the constraint S >> R’, provided R is not void; and<br />

• additional constraints Bi[T1 = B(T1) ... Tn = B(Tn)] >> Ti, where Bi<br />

is the declared bound of Ti,<br />

is created and used to infer constraints on the type arguments using the algorithm<br />

of section (§15.12.2.7). Any equality constraints are resolved, and then, for<br />

each remaining constraint of the form Ti

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!