JavaRush /Java Blog /Random EN /Java 13: what awaits us in the near future?

Java 13: what awaits us in the near future?

Published in the Random EN group
Although there are still three whole months left before the release of Java 13, details about innovations in the upcoming version of our favorite language are constantly appearing on the OpenJDK page. Let's remember that changes in Java are made using proposals to improve the JDK - JEP (JDK Enhancement Proposals), which are later integrated into new versions (well, or not integrated if they are not considered useful and appropriate enough). Below are some features that were proposed for the new version of Java: Text blocks. According to JEP-355 , text blocks should appear in JDK 13 (at the preview level). Text blocks are multi-part string literals that eliminate the need for the vast majority of escape sequences. Now you won’t need to escape most special characters, and automatic line breaks will appear. A text block automatically formats a line and gives developers control over the format. This JEP was created primarily to simplify the processes of writing and reading code, since in Java, embedding non-Java objects (for example, XML or JSON) usually requires “dancing with a tambourine” - specific line editing, so such embeds are usually difficult to create, support and read. Sockets API update. The new Java will most likely rewrite the legacy sockets API. In theory, the updated implementation will become more modern and easier to maintain and debug. It is intended to replace the base implementation used by the net.Socket and java.net.ServerSocket APIs. The new version is designed to easily adapt to working with user-mode threads (fibers or fibers), which are explored in Loom , a project created to make it easier to write, debug, profile and support parallel applications. The roots of the aforementioned legacy APIs go back to JDK 1.0 and contain a mixture of legacy C and Java code that is difficult to debug and maintain. The previous implementation also has other problems: its own data structure to support asynchronous closure, which causes reliability and portability issues, and concurrency issues that require revision. Improvement of ZGC (Z Garbage Collector). In the new version, they want to force the ZGC garbage collector to return unused memory to the operating system. ZGC is marketed as a scalable, low-latency garbage collector, but to date it still does not return unused memory back to the OS, even if that memory has not been used for a long time. Obviously, this is irrational, and for some applications and environments, those that cannot be idle for a long time, this approach is completely critical. Improving the functionality of Class-Data Sharing AppCDSto provide dynamic archiving of classes at the end of application execution. Class-Data Sharing or class data sharing was first introduced in JDK 5. This functionality allows you to pre-process a set of classes in a common archive file, which can then be mapped into memory at runtime to reduce startup time. Archive classes will now include all loaded application and library classes that are not included in the standard base-level CDS archive. This proposal is intended to improve the usability of AppCDS and eliminate the need for users to perform trial runs to create a list of classes for each application. Product version of a new form of expressions with the Switch operator - Switch Expressions . In Java 12 version, a simplification of the switch statement code has appeared in the preview stage. It can be used either in the old fashioned way or as an expression. Now all that remains is to wait for September 17, the release date of Java 13. Well, if you can’t wait to get acquainted with the innovations now, you can download beta builds from the official website.
Comments
TO VIEW ALL COMMENTS OR TO MAKE A COMMENT,
GO TO FULL VERSION