Re: subclassing and generics
- From: "Chris Uppal" <chris.uppal@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 31 May 2006 13:03:15 +0100
Hendrik Maryns wrote:
I am very surprised nobody gave the advise to not use inheritance at
all.
+1. Including the surprise ;-)
It /might/ be that the OP's uses of FooClass should also "know" that the
objects are Maps (or even TreeMaps), but -- like you -- I doubt it.
Delegation is
the better option, and it also makes the generics issue easier.
Sometimes having a difficulty with generics can indicate a flawed design.
Essentially the Java compiler is telling you "your design sucks" (of course,
/I/ would never be that rude ;-).
Unfortunately, it can be difficult to tell whether a generics problem is
actually caused by iffy design, or whether it's just another flaw in generics
themselves. But they can help diagnose an unclean design, or promote a clean
one.
(There now, I've gone and said something positive about generics! I promise
it won't soon happen again ;-)
-- chris
.
- References:
- subclassing and generics
- From: Henry Townsend
- Re: subclassing and generics
- From: Philipp Leitner
- Re: subclassing and generics
- From: Henry Townsend
- Re: subclassing and generics
- From: Henry Townsend
- Re: subclassing and generics
- From: Timo Stamm
- Re: subclassing and generics
- From: Oliver Wong
- Re: subclassing and generics
- From: Henry Townsend
- Re: subclassing and generics
- From: Hendrik Maryns
- subclassing and generics
- Prev by Date: javax.faces.FacesException: Assertion Failed....help me!!!
- Next by Date: Java Web Services
- Previous by thread: Re: subclassing and generics
- Next by thread: Re: subclassing and generics
- Index(es):
Relevant Pages
|