The Java 9 jdk is worth looking for: more than just modularity

Source: Internet
Author: User
Tags deprecated java web java se

After several delays, Java 9 will appear as Java SDK 9 on September 21, the first major upgrade of the Java Standard Edition since March 2014. The official list of about 90 new features of JDK 9, modularity is the most important one. The task of reconfiguring Java into a modular format has been going on for years, but there are other improvements in the areas of compilation, code caching, and JavaScript deployment.

Java Platform Module system for JDK 9

Java 9 's most valuable feature, modular--in the form of a Java Platform Module system--is designed to divide the JDK into a set of modules that run, compile, or build. Modularity is called "transitive" changes, which can better understand dependencies across modules.

The modular aspects of Java 9 include application packaging, modular JDK, and the re-organization of source code into modules. At build time, the build system will harden the compilation module and strengthen the module boundaries. The image of the JDK and Java Runtime Environment (JRE) will be refactored to handle the module. At the same time, JavaFX UI controls and CSS APIs will also be modularized.

JDK 9 will support many configurations, and scalability, security, and application performance will also be improved. Simplifying Java as a small device is the key to modular work. The Java Platform Module system, which is a component of the jigsaw project, will also be implemented.

With modularity, developers are better able to build and maintain large applications for Java SE (Standard Edition) and EE (Enterprise Edition). But there are differences between Oracle, IBM, Red hat and others about how to make radical changes on the platform. The module system was rejected in May, but was approved after a second ballot in June.

There are controversies about whether modularity will be of great benefit to Java developers, some experts say yes, while others disagree. However, Oracle has been working to implement a modular platform.

The release of Java 9 has been delayed many times for modularity, as Oracle has been trying to migrate to Java 9 more simply, and plans to allow illegal reverse access to code on the Classpath, which the JRE uses to search for classes and resource files. This feature will be disabled after Java 9.

Compiling in Java 9 's JDK

Java 9 provides several new features for compiling code, the most important of which is to compile ahead of time. This feature is still in the experimental phase, which allows Java classes to be compiled into native code before the virtual machine starts. This feature is designed to increase startup time for small and large applications with little impact on peak performance.

The instant (JIT) compiler is fast, but the Java program has become so large that it takes a long time for the JIT to start completely, which makes some Java methods fail to compile and the performance becomes weaker. Compiling in advance is to solve these problems.

But Dmitry Leskov, marketing Director of Java Technology Provider Excelsior, is concerned that the time-to-build technology is not mature enough and expects Oracle to launch a more reliable version of Java 10.

Java 9 also implements the second phase of the Oracle Intelligent compilation deployment. This feature includes improvements to the stability and portability of the Javac tool so that it can be used by default in the JVM (Java Virtual machine). The tool will also be promoted, so it can be used for large projects outside the JDK.

Another new experiment, the compiler feature is the Java-level JVM compiler interface (JVMCI). This interface allows compilers written in Java to be used by the JVM as a dynamic compiler. The JVMCI API provides a mechanism to access the VM structure, install compiled code, and insert the JVM compilation system.

A JVM compiler written in Java should require a high-quality compiler that is easier to maintain and improve than an existing compiler written in C or C + +. In addition, existing Java compiler-supported projects have Graal and Metropolis.

The new compiler control features are designed to control the granularity and method dependencies of the JVM compiler, allowing developers to change compiler control options at run time without causing performance degradation. The tool can also provide a workspace for JVM compiler errors.

The Java 9 JDK will also update the Javac compiler so that it can compile Java 9 programs to run on some older versions of Java.

Java 9 implements the REPL

Java 9 will have a read-eval-print loop (REPL) tool-This is another long-term goal of Java, and after years of Kulia project development, it will become real in this release.

Java 9 's repl is known as Jshell, which interactively evaluates declarative statements and expressions. Developers can get feedback on the program before compiling by simply entering some code.

The features of the command line tool include the end tag and the automatic addition of the required terminal semicolon. The Jshell API allows the use of Jshell functionality in the IDE and other tools, although the tool itself is not an IDE.

The lack of REPL tools is thought to be one reason why colleges are increasingly reluctant to teach Java (languages such as Python and Scala have long repl). The founder of the Scala language, Martin Odersky, questioned the usefulness of Java's repl, saying that Java is statement-oriented, and REPL is expression-oriented.

Code cache segmentation implemented in JDK 9

JDK 9 allows the code cache to be divided into several parts to improve performance and allow for extensions (such as fine-grained locks). Because a specialized iterator skips non-method code, the scan time needs to be improved. The separation of non-method, irregular and non-profiled code increases the execution time of some benchmark tests.

Java 9 supports more standards

Java 9 adds support for several standards.

The new HTTP/2 Client API implements the HTTP/2 protocol, while upgrading to the Web's core HTTP protocol and WebSocket protocol, browser-based interactive communication. The problem with the new API that can replace the HttpURLConnection Api,httpurlconnection API is that it contains protocols that have been invalidated predating HTTP/1, which is too abstract and difficult to use. However, when JDK 9 was released, the new HTTP/2 API was still in the beta test phase.

JDK 9 also adds support for HTML5 . The Javadoc API documentation tools feature has been enhanced to generate HTML5 tags.

Java 9 will also support the Unicode 8.0 encoding standard, which adds 8,000 characters, 10 modules, and 6 scripts.

For security, Java 9 adds an API to the DTLS (Packet Transport Layer Security protocol). The protocol is designed to prevent theft in client/server communications. Listen, tamper, and message forgery, which provides a safe mode for client and server mode.

JDK 9 gets more JavaScript support (Nashorn project)

The Nashorn project was designed to allow JavaScript to perform high-performance and lightweight operation on Java, starting with the Netscape of the Rhino project. The Nashorn project is responsible for embedding JavaScript in Java applications. In fact, a JavaScript engine has been provided for Java in JDK 8.

JDK 9 will include a parser API for the ECMAScript syntax tree. The API will implement ECMAScript code analysis through the IDE and the server framework, without relying on the internal implementation classes of the Nashorn project.

What features are deprecated and removed in Java 9

Java 9 Discards and removes some features that are no longer popular. The most important of these is the applet API, which will be deprecated. Now, the security browser has canceled the Java browser plugin support, because these are obsolete, the advent of HTML5 also accelerated their demise. Developers will be diverted to alternatives such as Java WEB start to launch applications or install applications in a browser. At the same time, appletviewer tools have been deprecated.

Java 9 will discard the concurrent Mark Sweep (CMS) garbage collector and stop supporting it in a future release. The goal is to accelerate the development of other garbage collectors in the hotspot virtual machine. A low-pause G1 garbage collector will be a long-term alternative to CMS.

At the same time, the deprecated garbage collection combination in JDK 8 will be removed in JDK 9. This includes rarely used combinations, such as incremental CMS, Parnew + serialold, and Defnew + CMS, because they increase the extra complexity of the garbage collector code base.

Java 9 will also omit the Java warning from the import statement to help the large code base clear the lint warning. In these code libraries, the deprecated feature is supported for a period of time, and if there is a destination to use a deprecated construct, then importing the deprecated construct does not require a warning message.

The ability to select a JRE at startup with multiple JRE (MJRE) features is also deprecated. This feature is rarely used because it complicates the implementation of the Java launcher and is never fully implemented when it first appears in JDK 5.

Oracle is removing the JVM TI (tool interface) hprof (heap analysis) agent, which has been superseded by the JVM. The Jhat tool has also been removed, and it has been eliminated by advanced heap visualization tools and analyzers.

What's worth looking for in the JDK for Java 9: not just modularity

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.