Re: How to override an abstract method returning an interface type
"Daniel Dyer" <dan@dannospamformepleasedyer.co.uk> wrote in message
news:op.tb9vdyazgnpvuy@cgl0656.chaucer.co.uk...
On Thu, 06 Jul 2006 15:41:24 +0100, Oliver Wong <owong@castortech.com>
wrote:
I usually use NotImplementedException() for this purpose. It's in
the sun.reflect.generics package, and it's not documented AFAIK, so I'm
not sure if that's the intended purpose...
Any reason to prefer this to java.lang.UnsupportedOperationException?
To me, UOE implies that the specified operation will NEVER be supported
(e.g. thrown by UnmodifiableList's .add() method), and there may exists code
which tries to catch UOE and handle it somehow (perhaps translating it to a
IllegalArgumentException("Please give me a modifiable list next time.")).
NIE, instead, implies "It's on my TODO list, but I haven't implemented
it yet." I haven't seen any code try to catch NIE. Perhaps it pops up in
code which does a lot of reflection stuff (which I haven't seen much of
yet).
- Oliver