[jdom-interest] Java 5.0 JDOM Plans?

Jason Hunter jhunter at xquery.com
Tue Aug 30 20:05:32 PDT 2005


>>detach() is a big annoying one.
> 
> Don't see that one?

Content has a detach() that returns type Content, which means you can't 
anymore say:

Element detached = otherElt.detach();

You have to cast:

Element detached = (Element) otherElt.detach();

With Java 5, the call to detach() could return Element specifically.  A 
docType.getParent() could return Document instead of Parent.  A 
text.getParent() likewise could return Element.

Covariant return types let you return specific types rather than 
superclass types, and it's nice because beginners don't even realize 
there's this fancy thing going on -- it just makes sense.

-jh-



More information about the jdom-interest mailing list