[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
unimplemented methods
From: |
Per Bothner |
Subject: |
unimplemented methods |
Date: |
Sat, 01 Mar 2003 16:02:25 -0800 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3b) Gecko/20030210 |
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
address@hidden http://www.bothner.com/per/
- unimplemented methods,
Per Bothner <=