1 Introduction
A few days ago just introduced a Java14 JEP 14 What's new preview feature useful Java 359: Records (Preview). Java 14 released a final version in the 17th. Most people still use the Java 8 , really eat less than the exhaust. But whatever the outcome, not the LTS version, we do not panic.
2. Java14 new features
This release contains JEP (the Java / the JDK Enhancement Proposals, proposals to enhance the JDK) than Java 12 and Java13 are more together. A total of 16 new features. Here is a brief look at my list:
-
305: instanceof pattern matching (preview) -
343: packaging tools (Incubator) -
345: NUMA memory allocation optimization G1 -
349: JFR event flow -
352: non-atomic byte buffer mapping -
358: null pointer exception friendly -
359: Records (Preview) -
361: Switch expression (standard) -
362: abandon Solaris and SPARC port -
363: Remove CMS (Concurrent Mark Sweep) garbage collector -
364: ZGC on macOS system -
365: ZGC on Windows systems -
366: Deprecated ParallelScavenge + SerialOld GC composition -
367: 移除 Pack200 Tools 和 API -
368: 文本块 (第二个预览版) -
370: 外部存储器 API (Incubator)
详细可以去官方文档查看。但是我个人认为有可用的新特性并不是很多,还是那句话大家不要慌。
3. 我们该如何选择 JDK 版本
其实还有很多同学不了解,自从JDK 修改了发布策略以后加快了迭代速度,每年的 3 月、9 月各会发布一个新的GA版本。大家都知道迁移成本很高。所以我们应该知道如何去选择JDK版本。这里我总结了几点:
-
处于商业成本和软件协议考虑,尽量使用 OpenJDK ,市面上有很多优秀的 OpenJDK,我们就在使用 AWS 的 Corretto。 -
尽量使用 LTS 版本,其实不光是 JDK 所有的软件都尽量使用长期支持版本。 -
尽量不要去盲目升级老项目的 JDK,除非你有充分的时间和精力去折腾。
4.总结
今天简单介绍了Java14的发布情况,也提供了一些升级JDK的建议,我个人认为没有必要升级,研究一下倒是可以的。不知道同学们有什么看法,可以留言讨论