views:

274

answers:

3

Hello,
this question is related to the the other topic discussed here:
http://stackoverflow.com/questions/1266940/is-java-bytecode-compatible-with-different-versions-of-java
but in this case would like to know whether compatibility is preserved within the same version but on different updates.
For example, is bytecode generate by the compiler on version 1.6.0_14 compatible with JVM on 1.6.0 ? Code runs happily but I don't know whether there is any issue which might arise unexpectedly.

Regards.

+4  A: 

Yes. Byte code only changes the major¹ point releases. The update (_XX) releases are API & tools based bug fixes, performance increases and changes to the none-standard command switches. Update releases will not break the APIs or change the class file versions.

1) Bah for Suns version number system.

mlk
+2  A: 

Yes it should be binary compatible, excepted for some corner case liste in this document.

elhoim
The list seems to concern only problems that older (pre Java 6) byte code may have when running on the current JVM.
Michael Borgwardt
elhoim
As I understand it minor version have now been phased out by Suns marketing team. You now have the update (_XX) release and major point releases only. But given we are talking about Suns number system this will likely be changed tomorrow.
mlk
@mlk - details of Java version numbering here: http://java.sun.com/javase/6/webnotes/version-6.html
Jesper
+4  A: 

The class file format has a version number exactly in order to solve this question. If there ever were a breaking change within the same version, I would expect the class file format number to increase as well (possibly the minor_version, which has so far been unused), thereby making older JVMs reject the class files immediately with an UnsupportedClassVersionError

Michael Borgwardt
This means I will not know until I test/load all the classes in my code.
rstar
You don't usually have individual classes compiled separately by a different compiler. I guess it might be possible to have a rarely-used component in a JAR file turn out to have an incompatible version at the worst possible moment, but it's a rather contrived scenario.
Michael Borgwardt