| Author |
Can I modify the interface?
|
David Kachen
Ranch Hand
Joined: May 20, 2010
Posts: 42
|
|
Hi all,
I want to add some methods throws IllegalArgumentException. In the implementation, I plan to check the parameters and if with them that something is wrong, I will throw IllegalArgumentException. It is admissible?
Best Regards..
|
 |
Carlos Morillo
Ranch Hand
Joined: Jun 06, 2009
Posts: 220
|
|
Hi David,
Yes, you can do that, but there is no need to change the signature of the Sun interface methods,
since IllegalArgumentException extends RuntimeException and therefore it is NOT a checked Exception.
Hope this helps,
Carlos.
|
SCSA, OCA, SCJP 5.0, SCJD http://www.linkedin.com/in/carlosamorillo
|
 |
David Kachen
Ranch Hand
Joined: May 20, 2010
Posts: 42
|
|
Carlos, you are right..
But I mean a javadoc. In the javadoc I need to list all possible situations.
If I pre-suppose that IllegalArgumentException may be thrown, I need to describe it in the javadoc.
Such changes are allowed?
|
 |
Carlos Morillo
Ranch Hand
Joined: Jun 06, 2009
Posts: 220
|
|
No, there is no need.
You only document checked exceptions.
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4355
|
|
No changes are allowed to Sun's interface! Creating your own interface and redefining each method could be an option (and that's what I did)
|
SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4355
|
|
Carlos Morillo wrote:You only document checked exceptions.
I also documented in javadoc the unchecked exceptions, although I didn't mention them in the method signatures. Just like for example the compareTo method from class Date.
|
 |
David Kachen
Ranch Hand
Joined: May 20, 2010
Posts: 42
|
|
|
I'm not going to change the method signature, I just want to competently write Javadoc.
|
 |
David Kachen
Ranch Hand
Joined: May 20, 2010
Posts: 42
|
|
Roel, I understood you.
Thank you all
|
 |
 |
|
|
subject: Can I modify the interface?
|
|
|