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

半城伤御伤魂 提交于 2019-12-06 20:53:48

问题


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

回答1:


Java 1.2

  • strictfp keyword.

Java 1.4

  • assert keyword.

Java 1.5

  • enum keyword.



回答2:


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




回答3:


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



来源:https://stackoverflow.com/questions/16506411/was-there-ever-a-breaking-change-in-the-java-language-specification

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!