Saturday, September 25, 2004

Re: Generics and different interpretations of backwards compatibility

I'm actually a bit confused about this. If your new Java 1.5 code can run on previous VM's then you will only be able to use the Java API from previous versions right? You can't use any new functionality added to the library. So you will need to get the new API's anyway?

I am not sure if my explanation is totally correct.

What Mohn said about needing the Java 5.0 VM to run 5.0 API enhancements is correct. When backward compatibility is mentioned about Java releases, it means that the bytecode is similar to old releases. So new compilers will not generate bytecode which is new. Just the conversion of code like generics to bytecode will be done by the compiler. Other features also need the compiler to generate code. So the VM as such does not need to recognise any new keywords. So the JVM's do not need to change the core. Just add the newer libraries (rt.jar). Only one keyword enum has been added in 5.0. Enums are also classes in Java.

In .NET on the other hand newer bytecode keywords might have been added. So running that code will require different changes in the VM.

Which do you think is better??

(I think I made this blog a bit confusing)

No comments: