Compatibility - backward or forward ?
Hi,
I must admit, that I have lost the concept of what is compatible with what.
Could someone explain me what is the Sun's policy about this issue ?
The bottom line: what can I run where (there is also distinction between
code compatibility and binary compatibility ... ohhh :/) and what can I write
where .....
Thanks,
Adrian
# 1
Hi Adrian,
Except for a few minor source incompatibilities, which are documented in the JDK release notes, you can generally assume the following:
- Source that compiles with javac 1.4 will compile with javac 5.0
- Binaries compiled with javac 1.4 will run on 5.0 runtimes
- Binaries compiled with javac 5.0 that use generics and other new language features will not run on 1.4 runtimes
- Binaries compiled with javac 5.0 using "-source 1.4 -target 1.4" will run on 1.4 runtimes
There was a nasty binary compatibility bug with java.sql.Timestamp.compareTo recently, but I think that's all sorted out now in the latest builds of each version. (I forget which versions it affected, but it was to do with a bad change to the compareTo signature that led to NoSuchMethodErrors.)
Cheers,
Alex