Programming language: Java 17 extends pattern matching and seals classes

Published by: MRT

Published on:

Programming language: Java 17 extends pattern matching and seals classes

Java 17 was the first release with long-term support (LTS) since Java 11 in 2018. It contains the new language features from Java 12 to 16, which have been developed since then, as well as other innovations from Java Enhancement Proposals (JEPs) for JDK 17. In addition, the team is coming up with a new website and a proposed shorter release cycle.

The announcement of Java 17 took place at the virtual event “Oracle Developer Live: Java Innovations”. In line with the publication, Chief Architect Mark Reinhold gave announced the proposal on his blogto shorten the LTS release cycle from three years to two – despite the fact that some companies are still sticking to the penultimate LTS version Java 8, which appeared in 2014. This year’s Snyk report on the JVM ecosystem revealed, however, that many of the respondents rely on the parallel use of different Java versions, so that they could be more upgradeable than it seems at first glance.

Already at the beginning of the year it was foreseeable that some of the proposed JEPs would find their way into JDK 17, including the new rendering pipeline for macOS mentioned in JEP 382that accesses the new Apple Metal API. The previous pipeline used an outdated OpenGL API, the days of which are numbered at Apple.

Another proposed feature was the uniform API for existing and newly added pseudo-random number generators called RandomGenerator. Also this proposal from JEP 356 is implemented in the final release of JDK 17.

Java 17 extends pattern matching to switch expressions and switch statements and thus sets that Preview feature desired in JEP 406 around. This should enable the testing of an expression against a series of patterns, each with a specific action, whereby complex, data-oriented queries can be expressed concisely and reliably.

Pattern matching, which is also used in other programming languages, was first introduced in JDK 14 as a preview feature and has been available since Java 16 based on JEP 394 also for the instanceof-Operator use.

Sealed classes and interfaces have been known since Java 15 when they started in preview mode and received further innovations in Java 16. Sealing is used to limit access by other classes and interfaces for their expansion or implementation. In Java 17 the sealed classes are now according to JEP 409 to develop the preview status.

Other new features in JDK 17 include the removal of the experimental AOT and JIT compiler, as its maintenance proved to be too time-consuming, as well as the deprecation of the security manager, which is to be omitted in a future release.

Last but not least, Oracle presented a brand new website tailored for Java developers: is intended to provide a home for updated Java tutorials. In addition, it provides information and links to the community and current Java news as well as a Java project overview – including the Download link to the current version 17 should not be missing.

More information about the release of Java 17 interested parties can find in the release notes.


Article Source

Disclaimer: This article is generated from the feed and not edited by our team.