Andersen, a software outsourcing company, considers the main features of Java 14 and answers the question of whether businesses and individual developers should transfer to the new version.
[ClickPress, Mon Jul 13 2020] In spring, a new, 14th version of Java was released. Oracle has recently started releasing additions more often, and now, updates come out twice a year. Does this mean that the value of each new version is reduced, and paying attention to each version is not necessary? In this short review, Andersen considers the main features of Java14 and try to figure out if businesses and individual developers should transfer to the new version.
In the 14th version of Java, Oracle added and updated over a dozen features. Andersen specialists have highlighted the 5 most significant changes:
1. Pattern Matching for instanceof (preview). Now the instanceof operator automatically casts the object to the needed type. The command can be written in one line; previously, this required several lines.
2. NullPointerExceptions. The message about the null variable has become more informative: now the JVM indicates which variable is equal to zero. However, it is better to activate this function only on private servers - if the message appears in the public domain, this can lead to data leakage.
3. Switch Expressions. The switch statement has been improved over previous versions: now, multiple options for the value of a variable can be specified on one line. The word expressions means that now, the operator can return values.
4. Records. This operator allows declaring classes containing shallowly immutable data. It also helps to avoid duplicate code.
5. Text Blocks. When writing large text blocks, its easier to create new lines one can simply use a backslash (\) to transfer.
Andersen came to the conclusion that these and other updates of the 14th version are useful, but not necessary. Developers who are just transitioning to the Java language certainly need to start with the latest version. However, transferring ready-made applications written on previous versions to Java 14 does not make sense. A more detailed review with an analysis of the main features and developer feedback can be found on Andersens blog: https://blog.andersenlab.com/en/java14/#scroll-block