[concurrency-interest] Exception throw but not speficied in the method contract of its interface

Joe Bowbeer jozart@blarg.net
Fri, 8 Oct 2004 21:10:50 -0700


Jean,

Adding to what Hanson wrote:

The guideline for an unchecked exception is to declare it in the javadoc, as 
it is, but not in the source code (as there's no record in the classfile 
anyway).

See http://java.sun.com/j2se/javadoc/writingdoccomments/#throwstag


Implementations are prone to NullPointerException and IllegalStateException 
and other runtime exceptions, whereas an interface like Collection is not...


Joe.


----- Original Message ----- 
From: "Hanson Char" <hanson_char@yahoo.com>
To: "'Jean Morissette'" <jean.morissette666@videotron.ca>; 
<concurrency-interest@altair.cs.oswego.edu>
Sent: Friday, October 08, 2004 5:36 PM
Subject: RE: [concurrency-interest] Exception throw but not speficied in the 
method contract of its interface


In general Runtime exceptions such as IllegalStateException are considered
"unchecked" exceptions, and therefore can always be thrown without being
specified in the interface.

H

-----Original Message-----
From: concurrency-interest-admin@cs.oswego.edu
[mailto:concurrency-interest-admin@cs.oswego.edu]On Behalf Of Jean 
Morissette
Sent: Saturday, 9 October 2004 8:09 AM
To: concurrency-interest@altair.cs.oswego.edu
Subject: [concurrency-interest] Exception throw but not speficied in the 
method contract of its interface

Hi all, the method add(Object) of class AbstractQueue can throw an
IllegalStateException that is not specified in the contract of its
interface Collection.  Is-it normal? -Jean