Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Was there ever a "breaking change" in the Java language specification?

Tags:

java

jls

With the problably widely known exception of the introduction of the 'assert' keyword, has there ever been a change in the Java language specification which caused old code to be no longer compatible with newer source levels of the JDK?


Summary so far (many thanks for the comments):

"Older" Java code can cause compilation errors, when upgrading to a later version, if the code uses declarations using one of the keywords which where introduced in a later version of the Java language specification (JLS):

  • assert
  • enum
  • strictfp
like image 623
mjn Avatar asked May 12 '13 10:05

mjn


3 Answers

Java 1.2

  • strictfp keyword.

Java 1.4

  • assert keyword.

Java 1.5

  • enum keyword.
like image 186
pcalcao Avatar answered Oct 20 '22 20:10

pcalcao


I believe that _ was designated a "keyword" in Java 9. See https://blogs.oracle.com/sundararajan/underscore-is-a-keyword-in-java-9%2c-use-this-script-to-check-your-code

like image 43
les2 Avatar answered Oct 20 '22 20:10

les2


Java 10 made var a keyword. It's still a valid variable name but an illegal class name.

like image 2
Pavel Avatar answered Oct 20 '22 19:10

Pavel