This post originated from an RSS feed registered with Java Buzz
by Marc Logemann.
Original Post: Erasures and the backward compatibility issue
Feed Title: Marc's Java Blog
Feed URL: http://www.logemann.org/day/index_java.xml
Feed Description: Java related topics for all major areas. So you will see J2ME, J2SE and J2EE issues here.
I recently joined the backward compatibility discussion on the net and tried to understand the surroundings on that. I used "Generics" as an example of a place where backwards compatibility drove an implementation.
Dont expect a complete overview on all aspects, because at the end, i am not a compiler programmer. As to Neil Gafter, Sun tried to achieve the following:
* compile old sources on Java5
* run old classes on Java5
* using generic aware APIs in existing applications (compiled against the same API without generics)
To me it seems, the first two goals could have been realised without erasures with a NextGen approach but the third looks hard (perhaps impossible) to achieve without.
After reading the generics forum @ sun for quite a while (very emotional discussions here btw), i ended in believing that the "transitional compatibility" for 3rd party library developers is really a showstopper for not using erasures. Basically Sun helped all those java projects, so that they dont need to offer two version of the same library, one with generics and one without. Your old application can still use the new generics aware log4j lib for example.
But the question remains, how important that feature is? If i were the lead programmer for log4j and Java5 would not have erasures, how hard would it be to recompile my project and distribute a Java5 compatibly version of log4j and keep the old one too?
After all, Generics is just an example of the overall backwards compatibility issue, even though its one of the hardest to follow, because of the complexity of the topic in general.
There are most likely trillion other reasons and pros and cons, but to me it seems that in presence of C#, we (and SUN) have to think about this whole issue of progress and compatibility.
Note: Now Neil Gafter being at Google with dozens other java related folks (joshua bloch, Bosworth, etc.), i am really wondering what Google is out for. Why do they need a compiler designer for instance?
Note: made some edits because of false assumptions after reading Neil's blog..