[jdom-interest] Suggestion : make Element.getParent() final ?

Madjid Ghazi storm at storm.demon.co.uk
Mon Jun 21 13:27:40 PDT 2004

Hi all

I just spent two hours debugging my own buggy code and it turns out that
the problem was that I had inadvertently overridden the   getParent()
method of the Element class. (In my own defence the method was named
that way since it returned the name of the father or mother of the

So I was being told that the new element that I had just made had a
parent and could not be added to the root element via the
addContent(Content)   method.

It all makes sense now but all of this got me thinking why would you
want to override the getParent() anyway ? Specially since other JDOM
methods seem to use it.

Should it not be a final method to avoid idiots like me breaking things


More information about the jdom-interest mailing list