Java Reference
In-Depth Information
class ColoredPoint extends Point { int color; }
This program causes a compile-time error.
8.1.5. Superinterfaces
The optional
implements
clause in a class declaration lists the names of interfaces that are
direct superinterfaces of the class being declared.
Interfaces:
implements
InterfaceTypeList
InterfaceTypeList:
InterfaceType
InterfaceTypeList
,
InterfaceType
The following is repeated from §
4.3
to make the presentation here clearer:
ClassType:
TypeDeclSpecifier TypeArguments
opt
occurs.
If the
TypeName
is followed by any type arguments, it must be a correct invocation of the
type declaration denoted by
TypeName
, and none of the type arguments may be wildcard
type arguments, or a compile-time error occurs.
It is a compile-time error if the same interface is mentioned as a direct superinterface two or
more times in a single
implements
clause's names. This is true even if the interface is named
in different ways.
Given a (possibly generic) class declaration for
C
<
F
1
,...,
F
n
>
(
n
≥ 0,
C
≠
Object
), the
direct
superinterfaces
of the class type
C
<
F
1
,...,
F
n
>
are the types given in the
implements
clause of
the declaration of
C
, if an
implements
clause is present.
Let
C
<
F
1
,...,
F
n
>
(
n
> 0) be a generic class declaration. The direct superinterfaces of the
parameterized class type
C
<
T
1
,...,
T
n
>
, where
T
i
(1 ≤
i
≤
n
) is a type, are all types
I
<
U
1
θ,...,
U
k
θ
>
, where
I
<
U
1
,...,
U
k
>
is a direct superinterface of
C
<
F
1
,...,
F
n
>
, and θ is the substi-
tution
[
F
1
:=
T
1
,...,
F
n
:=
T
n
]
.