> 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...

Signature
Daniel Dyer
http://www.dandyer.co.uk
> > 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
Daniel Dyer - 06 Jul 2006 16:15 GMT
>> > I usually use NotImplementedException() for this purpose. It's in
>> > the sun.reflect.generics package, and it's not documented AFAIK, so
[quoted text clipped - 12 lines]
> it pops up in code which does a lot of reflection stuff (which I haven't
> seen much of yet).
Fair enough, and if it were called NotImplementedYetException I might
agree. Regardless, the fact it's in the Sun namespace and that the
package names imply some connection with reflection and generics would
make we shy away from using it.
I wouldn't be concerned about code that catches
UnsupportedOperationException. I would hope that is a rare occurrence. I
can't imagine a use for it that is not an ugly hack to get around some
more fundamental problem.
I guess the third way would be to write your own ToDoException and use
that.
Dan.

Signature
Daniel Dyer
http://www.dandyer.co.uk
AndrewMackDonna - 06 Jul 2006 23:28 GMT
>>> > I usually use NotImplementedException() for this purpose. It's
>>> in > the sun.reflect.generics package, and it's not documented AFAIK,
[quoted text clipped - 30 lines]
> --Daniel Dyer
> http://www.dandyer.co.uk
I've configured my eclipse to do the same as Oliver's does, only I my
config for methods, looks like.....
throw new RuntimeException("${enclosing_type}.${enclosing_method}() not
yet implemented - faked for unit tests");
Which produces...
public class DerivedClass extends AbstractbaseClass {
protected String getName() {
throw new RuntimeException("DerivedClass.getName() not yet
implemented - faked for unit tests");
}
}