aspose file tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Can I modify the interface? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Can I modify the interface?" Watch "Can I modify the interface?" New topic
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Can I modify the interface?
 
Similar Threads
[ Servlet ] Error when I added the init() method to a servlet
Wrapper Exception is good or not ??
2 quick questions...
Problem with date insertion in MySQL
Number format