There are several blog posts and articles about the new features of the most recent releases of Java (JDK 12). In this article, I am going to write about the most important removed and deprecated APIs and features in JDK 12.
Although this version does not have long-term support you should keep in mind that it will affect to next long-term support version.
Along with the important features that have been added (for example Switch Expressions or JVM Constants API), there are several important features, APIs and options that have been removed or deprecated.
Here is an overview:
- Removal of javac Support for 6/1.6 source, target, and release Values: Support for the 6/1.6 argument value for javac’s -source, -target, and --release flags have been removed.
- GTK+ 3.20 and Later Unsupported by Swing: Due to incompatible changes in the GTK+ 3 library versions 3.20 and later, the Swing GTK Look and Feel does not render some UI components when using this library.
- Removal of finalize Methods from FileInputStream and FileOutputStream: The finalize methods of FileInputStream and FileOutputStream were deprecated for removal in JDK 9. They have been removed in this release. The recommended approach to close files is to explicitly call close or to use try-with-resources.
- Initial Value of user.timezone System Property Changed: Previously, the initial value was the empty string. In JDK 12, System.getProperty("user.timezone") may return null.
- Enhanced Deprecation: Revamp the @Deprecated annotation, and provide tools to strengthen the API life cycle.
- java.util.Observer and java.util.Observable has been deprecated: For a richer event model, consider using the java.beans package. For reliable and ordered messaging among threads, consider using one of the concurrent data structures in the java.util.concurrent package. For reactive streams style programming, see the Flow API.
- java.applet.Applet has been deprecated: The Applet API is deprecated, no replacement.
- java.lang.Compiler has been deprecated: JIT compilers and their technologies vary too widely to be controlled effectively by a standardized interface. As such, many JIT compiler implementations ignore this interface and are instead controllable by implementation-specific mechanisms such as command-line options. This class is subject to removal in a future version of Java SE.
There are several other features, APIs and options that have been removed or deprecated and you can read more about them from these links: