6.2. Intersection Types

Intersection types are types that arise in queries (Chapter 17, Queries); they cannot be written directly as part of a programme. Intersection types have also been defined in the Java Language Specification, Third Edition in a similar way.

An intersection type takes the form T & I1 & ... & In, where T is a class type, array type, or primitive type, and the Ik are interface types. An intersection type represents the intersection of its constituent types. Thus, its values are those values which are values of all of the types T and Ik. It is a compile-time error if an empty intersection type arises, i.e., an intersection type which cannot have any value.

For a class type T, an intersection type T & I1 & ... & In has the same members as a class type with an empty body, direct superclass T and direct superinterfaces Ik, declared in the same package in which the intersection type appears.