Friday Java Quiz: Incompatible Language Changes
The evolution of the Java programming language has been managed carefully (maybe too carefully) to avoid incompatible language changes. However, binary compatibility was given more consideration than source compatibility. In the words of one of the Java Posses, your class will continue to work as long as you don't recompile your code.
Q: Which of the following Sun JDK/JSDK/J2SDK/JDK upgrades contain code breaking language/library changes? Give an example snippet.
- Beta ⇒ 1.0
- 1.0 ⇒ 1.1
- 1.1 ⇒ 1.2
- 1.2 ⇒ 1.3
- 1.3 ⇒ 1.4
- 1.4 ⇒ 1.5
- 1.5 ⇒ 1.6
Re: Friday Java Quiz: Incompatible Language Changes
String assert = "assert";
would compile in 1.3, but not 1.4
enum was added in 1.5 as one of the other folks mentioned
I didn't know about strictfp introduced in 1.2 so I read up on it: http://en.wikipedia.org/wiki/Strictfp
Re: Friday Java Quiz: Incompatible Language Changes
One change I found was that some of the new constructors on BigDecimal in Java 5 could cause differences in behaviour when recompiled, since int wasn’t converted to a double any more. I can’t remember precisely what trouble this caused us, though.
Re: Friday Java Quiz: Incompatible Language Changes
Re: Friday Java Quiz: Incompatible Language Changes
The reason I put "Beta => 1.0" in the mix is that I seem to remember some major modifier changes around that time. The beta behavior was described in the first edition of Java In a Nutshell.
But I no long have that book. And couldn't remember the details.
Does anyone remember the episode?