Skip to Content.
Sympa Menu

xom-interest - Re: [XOM-interest] Subclassing and check methods

xom-interest AT lists.ibiblio.org

Subject: XOM API for Processing XML with Java

List archive

Chronological Thread  
  • From: Elliotte Rusty Harold <elharo AT metalab.unc.edu>
  • To: jcowan AT reutershealth.com
  • Cc: xom-interest AT lists.ibiblio.org
  • Subject: Re: [XOM-interest] Subclassing and check methods
  • Date: Sat, 13 Mar 2004 12:33:59 -0500

At 11:12 AM -0500 3/12/04, jcowan AT reutershealth.com wrote:

That reminds me. As part of this effort, the throwables for these
protected mutator methods should be broadened to XMLException.
(I know the clause has no actual effect on the compiler, but it's good
documentation to get it right.) I'd rather throw the same exception
from setLocalName and insertChild in this case (an IllegalAddException
or a new subclass of it), but currently setLocalName is (documented as)
only throwing IllegalNameException.

The mutator methods are public, not protected. Does that change your opinion on this? I'm not sure whether the @throws clause should really be used to document every runtime exception an overriding method may plausibly throw. I documented them this way before because the method itself (not an overriding method in a subclass but the method in the superclass) might pass on one of these exception's thrown by a subclass's checkFoo method. However, that's no longer the case. In order to throw a different exception the method must be overridden by a different method. In this context does it still make sense to document the subclass's runtime exceptions in the superclass JavaDoc?
--

Elliotte Rusty Harold
elharo AT metalab.unc.edu
Effective XML (Addison-Wesley, 2003)
http://www.cafeconleche.org/books/effectivexml
http://www.amazon.com/exec/obidos/ISBN%3D0321150406/ref%3Dnosim/cafeaulaitA




Archive powered by MHonArc 2.6.24.

Top of Page