[jdom-interest] JDOM not using raw typing

Endre Stølsvik jdom at stolsvik.com
Wed Mar 28 01:36:01 PST 2007


Jason Hunter wrote:
> This has been discussed a lot lately.  The reason is to add support for 
> Java 5 means removing support for people on Java versions previous to 
> that.  You can make two releases, but that has the potential to cause 
> dependency problems in larger projects.  So for now you have a few 
> warnings as the price for Java 1.4 people to be able to use JDOM.  :)
> 

Well, since I didn't get any response to this the last time, I'll shove
this in again:

Using legacy code in new code:

http://java.sun.com/docs/books/tutorial/extra/generics/legacy.html
   " ... the assignment is legal, but it generates an unchecked warning.
The warning is needed, because the fact is that the compiler can't
guarantee its correctness. "
   " Now let's consider the inverse case. Imagine that Fooblibar.com
chose to convert their API to use generics, but that some of their
clients haven't yet. ... "

Generifying old code, while keeping backwards compat:

http://java.sun.com/docs/books/tutorial/extra/generics/convert.html
   " Earlier, we showed how new and legacy code can interoperate. Now,
it's time to look at the harder problem of "generifying" old code. "
   " You also need to ensure that the revised API retains binary
compatibility with old clients. This implies that the erasure of the API
must be the same as the original, ungenerified API. In most cases, this
falls out naturally, but there are some subtle cases. ... "

javac -source=1.5 -target=1.3  ?


Also, one could use org.jdom2 as package name for the 1.5 version, 
although obviously utterly loosing compatibility between code coded 
against v1 and other code coded against v2 - but I think even this could 
be handled using a simple "converter" between a v1 DOM and a v2 DOM, or 
the other way.

> 
> Hielke Hoeve wrote:
>> Hi there,
>>
>> I was wondering if there is any reason why JDOM isn't using raw
>> typing. I'm making a configuration parser for my own open source
>> project but I'm using somewhat strict settings in Eclipse and I have a
>> lot of warnings in my project about Lists being a raw type. I could
>> add @SuppresWarnings to silence Eclipse about that particular line but
>> I'd rather fix the "problem" than hiding it.
>>
>> If there isn't any reason I was wondering where I could commit or in
>> another way present a JDOM version that does. I have attempted to
>> alter the nightly build to use typing but it's quite a task.
>>
>> Greetings,
>>
>> Hielke Hoeve
>> _______________________________________________
>> To control your jdom-interest membership:
>> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
>>
> _______________________________________________
> To control your jdom-interest membership:
> http://www.jdom.org/mailman/options/jdom-interest/youraddr@yourhost.com
> 
> 




More information about the jdom-interest mailing list