2 min Devops

Java 14, with pattern recognition, promises better code

Oracle has now made Release 14 of Java generally available. The Java Development Kit (JDK) 14 also includes various preview applications, such as pattern recognition in the instance or operator.

The release of version 14 of the programming language is fully in line with the release strategy of two versions per year that the tech giant has been implementing for three years. In this last version, a lot of new functionality has been added week after week.

Pattern recognition

One of the most important new features is adding pattern recognition for instance or operator. This is still in the test phase, according to Oracle. In Java, an operator performs (mathematical) operations with variables.

With the now released preview, the operator now takes a type of test pattern instead of only typing movements of the programmers. This should help them to write more concise code and prevent errors caused by constantly repeating certain type information. In the end, this should also result in better pattern recognition.

Another important new feature are ‘records’ which should provide a compact syntax for explaining classes. With these records, software developers should eventually be able to ‘model data as data’.

Other additions

Other new features of JDK 14 include a foreign memory API and a tool for packaging self-contained Java applications. The latter functionality would be particularly interesting because these applications are currently only delivered as incubator modules.

Furthermore, the release also makes JDK Flight recorder data public. This collected data can be used, for example, by monitoring tools to use a file mapping mode for non-volatile memory. This data should also improve the use of so-called ‘NullPointerExceptions’. This can be done by describing exactly which variable was a ‘null’ and at the same time showing other useful information, according to the release notes.