The question is whether HasId<String> supertype of the original Alert type. The specification is not very clear on this issue.
In the spirit of [4.8], rawtype supertypes must also be erased. Therefore, Alert must have a supertype HasId , but not HasId<String> . However, the section speaks only in terms of “superclasses / interfaces”, and not in terms of “supertypes”.
In the spirit of [4.10], supertypes are detected through direct supertypes. It is unclear how the section relates to raw types. He probably suggests that raw Alert has a direct supertype of HasStringId . That seems fair. Then, since HasId<String> is a direct supertype of HasStringId , by transitivity, HasId<String> is a supertype Alert !
The confusion is rooted in the fact that there are actually two types of HasStringId , one normal, one raw. Although HasStringId not common for itself, it has a common supertype, so it makes sense to talk about an unprocessed version of HasStringId .
The specification makes no distinction between regular and raw HasStringId . This is an oversight.
Suppose raw HasStringId referred to as HasStringId' , then [4.10] makes more sense. The raw Alert direct super HasStringId' is raw HasStringId' . HasStringId' direct super-interface is raw HasId . Therefore, HasId is a supertype of Alert , not HasId<String> .
See section 4 of the JLS . I am linking to the JLS preview here, as JLS 7 has serious editing errors in section 4.10.2.
ZhongYu
source share