javajvmbytecodebackwards-compatibility

Are there any specific examples of backward incompatibilities between Java versions?


Have there been incompatibilities between Java releases where Java source code/Java class files targeting Java version X won't compile/run under version Y (where Y > X) ?

By "Java release" I mean versions such as:

House rules:


Solution

  • Compatibility notes for various versions:

    The first major hiccup I remember was the introduction of assert in Java 1.4. It affected a lot of JUnit code:

    11. In Java 1.4, assert is a keyword. Won't this conflict with JUnit's assert() method?

    JUnit 3.7 deprecated assert() and replaced it with assertTrue(), which works exactly the same way.

    JUnit 4 is compatible with the assert keyword. If you run with the -ea JVM switch, assertions that fail will be reported by JUnit.