[jdom-interest] JDOM with generics

Tatu Saloranta cowtowncoder at yahoo.com
Sat May 6 17:21:57 PDT 2006

--- Victor Toni <victor.toni at ebuconnect.de> wrote:

> Jason Hunter wrote:
> > The issue is what happens when your Java 5 program
> depends on JDOM 5 
> > but also on a package that depends on JDOM 1.0? 
> Serious question.  
> > You can't assume you can recompile the package
> because it's not yours. 
> > Assuming it was compiled against JDK 1.2, can it
> understand the JDOM 5 
> > JAR adequately?
> I would second the idea of having a JDOM 1.5 which
> is identical to 1.0 
> (or maybe better 1.0.1 ; -) ) expect that it uses
> Generics. It should be 
> as compatible for older projects as is the 1.5
> runtime.

Unless you mean "and use different package names for
each", I think your sentences are contradictory here?
The whole problem with adding generics (for example)
is that resulting code most likely can not be used
reliably with any prior JVMs (including 1.4), even
with retroweaver (although, I am aware of people who
have been able to run retroweaver processed code in
1.4 too, YMMV; just that it may not be quite as
Many people even assume that it's just asking for
trouble to try to even compile code using javac of a
later JVM (using target modifier), much less to try to
use new features; and thus compile the jars with the
oldest JVM they can use.

So the safest (or only safe?) way would be to use
separate packages like Jason has mentioned, even if
the same class names would still be used; there would
be no (binary) conlicts. This would require
recompilation to take benefit of new code, but that's
needed no matter what, to benefit from generics.
This would add a bit to maintenance overhead, but with
the volume of patches for 1.0, it should be doable.

And while this was done, it might be worth considering
the many-times-rejected common base class for all
nodes, if only for getting some documentation for ones
collection classes. And maybe reorganizing classes as
well... so essentially, I don't see much value in
trying to provide even source-level (minus package
names) compatibility.

-+ Tatu +-

Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 

More information about the jdom-interest mailing list