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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TYPES, VALUES, AND VARIABLES Subtyping among Class and Interface Types 4.10.2<br />

4.10 Subtyping<br />

<strong>The</strong> subtype and supertype relations are binary relations on types. <strong>The</strong> supertypes<br />

of a type are obtained by reflexive and transitive closure over the direct supertype<br />

relation, written S > 1 T, which is defined by rules given later in this section. We<br />

write S :> Tto indicate that the supertype relation holds between S and T. S is a<br />

proper supertype of T, written S > T,<br />

if S :> T and S ≠ T.<br />

<strong>The</strong> subtypes of a type T are all types U such that T is a supertype of U, and the<br />

null type. We write T 1 int<br />

int > 1 char<br />

int > 1 short<br />

short > 1 byte<br />

4.10.2 Subtyping among Class and Interface Types<br />

DRAFT<br />

Let C be a type declaration (§4.12.6, §8.1, §9.1) with zero or more type parameters<br />

(§4.4) F1, ..., Fn which have corresponding bounds B1, ..., Bn. That type declaration<br />

defines a set of parameterized types (§4.5) Cı, where each argument<br />

type Ti ranges over all types that are subtypes of all types listed in the<br />

corresponding bound. That is, for each bound type Si in Bi, Ti is a subtype of Si[<br />

F1 := T1, ..., Fn := Tn].<br />

Given a type declaration for C, the direct supertypes of the parameterized<br />

type (§4.5) C are all of the following:<br />

• the direct superclasses of C.<br />

• the direct superinterfaces of C.<br />

63

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

Saved successfully!

Ooh no, something went wrong!