unimplemented methods
Per Bothner
per@bothner.com
Sun Mar 2 00:25:00 GMT 2003
I just looked at a couple of classes (java.net.URI
and java.awt.GridBagLayout) and noticed lots of
unimplemented methods just do nothing or return null.
This has to stop. If an method does not do what it
is supposed to do, then it must throw an exception.
I'll make an exception for a method where you might
get semi-useful results if it isn't implemented
correctly, but if a class isn't anywhere close to
useful, it shouldn't pretend to be.
That raises the question: What exception to throw?
We could add a special gnu exception, but I suggest
UnsupportedOperationException. E.g:
public URI (String scheme, String ssp, String fragment)
throws URISyntaxException
{
throw new UnsupportedOperationException();
}
--
--Per Bothner
per@bothner.com http://www.bothner.com/per/
More information about the Java
mailing list