posted 12 years ago
I'm far from an expert at generics, but I believe the problem is this...
The parameterized type for Hose is E, and you have defined E to extend Hose, however you have not defined for which type it should extend Hose.
Hence, for the class E, the method E getE(); is different depending on for which type Hose is extended. As it currently stands you have extended it for its raw type, without a parametrized type.
This is hard to explain I notice... consider this, instead of your current class definition of Hose, you use:
This will make your code compile. What I tried saying above is that for the class definition I just provided, the method:
... will indeed return a class of the same type, both from class Hose and from class E. If you do not define the parameterized type for E in the class definition for Hose, as I have done above, then there is no telling what the method would return when used from the class E.
// Andreas