Home >Java >javaTutorial >What are the new features of jdk8

What are the new features of jdk8

清浅
清浅Original
2019-04-24 17:40:3534114browse

New features in JDK 8 include: introducing Lambda expressions, providing Stream API, enabling client TLS 1.2, supporting AEAD algorithm, higher security, new Modena theme, new packages, etc.

What are the new features of jdk8

What's new in JDK 8

Java Platform, Standard Edition 8 is a feature-rich major release. This document summarizes the features and enhancements in Java SE 8, JDK 8, and Oracle's implementation of Java SE 8. Click a component name for a more detailed description of the component's enhancements.

Java Programming Language

  • Lambda expressions are a new language feature that has been introduced in this version. This feature allows you to treat functions as method parameters, or code as data. Using lambda expressions, you can more concisely represent instances of single-method interfaces (called functional interfaces).

  • Method references provide easy-to-understand lambda expressions for methods that already have names.

  • The default method allows new functionality to be added to the library's interfaces and ensures binary compatibility with code written for older versions of these interfaces.

  • Duplicate annotations support multiple applications of the same annotation type to the same statement or type usage.

  • Type annotations support applying annotations anywhere a type is used, not just declarations. When combined with the pluggable type system, this feature improves type checking of your code.

  • Improved type inference.

  • Method parameter reflection.

Collection

  • The new java.util.stream class in the package provides a Stream API that supports Streams of elements perform functional operations. The Stream API is integrated into the Collections API and can perform batch operations on collections, such as sequential or parallel map-reduce transformations.

  • Performance improvements for HashMap with key conflicts

Compact profile

Includes Java SE A predefined subset of the platform and supports applications that do not require the entire platform to be deployed and run on small devices.

Security

  • Client TLS 1.2 is enabled by default

  • New changes to AccessController.doPrivileged Body supports code asserting a subset of its permissions without preventing a full stack traversal to check for additional permissions

  • Stronger password-based encryption algorithm

  • JSSE server-side support for SSL/TLS Server Name Indication (SNI) extension

  • Support for AEAD algorithm: The SunJCE provider has been enhanced to support AES/GCM/NoPadding cipher implementations as well as GCM Algorithm parameters. The SunJSSE provider has also been enhanced to support AEAD mode-based cipher suites. See Oracle Provider Documentation, JEP 115.

  • Keystore enhancements, including new domain keystore type java.security.DomainLoadStoreParameter and new command option -importpassword

  • ## for the keytool utility
  • #SHA-224 Message Digest

  • Enhanced support for NSA Suite B encryption

  • Better support for high-entropy random numbers Generate

  • Added the java.security.cert.PKIXRevocationChecker class for configuring the revocation check of X.509 certificates

  • Applicable to Windows 64-bit PKCS11

  • New rcache type added to Kerberos 5 replay cache

  • Supports Kerberos 5 protocol translation and restricted delegation

  • Kerberos 5 weak encryption type is disabled by default

  • Unbound SASL for GSS-API/Kerberos 5 mechanism

  • SASL Service for Multiple Host Names

  • JNI Bridge to Native JGSS on Mac OS X

  • SunJSSE Provider Support for stronger temporary DH keys in

  • Support for server-side cipher suite preference customization in JSSE

JavaFX

  • The new Modena theme has been implemented in this version.

  • The new SwingNode class allows developers to embed Swing content into JavaFX applications. See the SwingNode javadoc and Embedding Swing content into JavaFX applications.

  • New UI controls include DatePicker and TreeTableView controls.

  • javafx.print package provides public classes for the JavaFX Printing API. See the javadoc for more information.

  • 3D graphics features now include 3D shapes, cameras, lights, subscenes, materials, picking, and anti-aliasing. New Shape3D (Box, Cylinder, MeshView and Sphere subclasses), SubScene, Material, PickResult, LightBase (AmbientLight and PointLight subclasses) and SceneAntialiasing API classes have been added to the JavaFX 3D graphics library. The Camera API class has also been updated in this release. See the related javadoc for the javafx.scene.shape.Shape3D, javafx.scene.SubScene, javafx.scene.paint.Material, javafx.scene.input.PickResult, and javafx.scene.SceneAntialiasing classes as well as the JavaFX 3D Graphics Getting Started documentation.

  • The WebView class contains new features and improvements. For more information about other HTML5 features, including web sockets, web workers, and web fonts, see HTML5 Supported Features.

  • Enhanced text support, including bidirectional text, complex text scripts (such as Thai and Hindi controls), and multi-line, multi-style text in text nodes.

  • This version adds support for Hi-DPI display.

  • CSS Styleable* classes have become public API. For more information, see the Javafx.css javadoc.

  • The new ScheduledService class allows automatic restart of services.

  • JavaFX is now available for the ARM platform. The JDK for ARM includes the base, graphics, and control components of JavaFX.

Tools

  • The Nashorn engine can be called through the jjs command.

  • java command is used to start JavaFX applications.

  • Rewritten the java man page.

  • Class files can be analyzed through the jdeps command line tool.

  • Java Management Extensions (JMX) supports remote access to diagnostic commands.

  • The jarsigner tool provides an option to request a signed timestamp from a Timestamp Authority (TSA).

Javac Tool

  • #The -parameters option of the javac command can be used to store formal parameter names and enable the reflection API to Retrieve formal parameter names.

  • The javac command now correctly implements the type rules for equality operators in Java Language Specification (JLS) section 15.21.

  • Thejavac tool now supports checking the content of javadoc comments, thus avoiding various problems in the files generated when running javadoc, such as invalid HTML or accessibility issues. This feature can be enabled via a new Xdoclint option. See the output when running "javac -X" for more details. This feature is also available in the javadoc tool and is enabled by default.

  • javac tool now supports generating native headers on demand. This eliminates the need to run the javah tool separately in the build pipeline. This feature can be enabled in javac using the new -h option, which specifies the directory to which header files are written. A header file will be generated for annotated constant fields for any class that has a native method or uses a new annotation of type java.lang.annotation.Native .

Javadoc Tool

  • The javadoc tool supports the new DocTree API, allowing you to treat Javadoc comments as abstract syntax trees to traverse.

  • The javadoc tool supports the new Javadoc Access API, which allows you to call Javadoc tools directly from your Java application without executing a new process. For more information, see the javadoc new features page.

  • The javadoc tool now supports checking the content of javadoc comments, thus avoiding various problems in the files generated when running javadoc, such as invalid HTML or accessibility issues. This feature is enabled by default and can be controlled with the new -Xdoclint option. See the output when running "javadoc -X" for more details. The javac tool also supports this feature, but it is not enabled by default.

Internationalization

  • Unicode enhancements, including support for Unicode 6.2.0

  • Using Unicode CLDR data and java.locale.providers system properties

  • New calendar and locale API

  • Support Custom resource bundles are installed as extensions

Deployment

  • ##It is now possible to use URLPermission to allow sandbox applets and Java Web Start apps connect back to the server that started them. SocketPermission is no longer granted.

  • The Permissions attribute is required in the JAR file manifest of the main JAR file at all security levels.

Date-Time Package

A set of new packages that provide a comprehensive date-time model.

Scripting

The Rhino Javascript engine has been replaced by the Nashorn JavaScript engine

Pack200

  • Pack200 supports constant pool entries and new bytecode introduced by JSR 292

  • JDK8 supports class file changes specified by JSR-292, JSR-308 and JSR-335

IO and NIO

  • New Solaris-oriented SelectorProvider implementation based on the Solaris event port mechanism. To use it, set the value of the system property java.nio.channels.spi.Selector to sun.nio.ch.EventPortSelectorProvider.

  • Reduce the size of the /jre/lib/charsets.jar file

  • Improved the performance of java.lang.String(byte[], *) constructor and java.lang.String.getBytes() method.

java.lang and java.util packages

  • Parallel array sorting

  • Standard encoding and decoding Base64

  • Unsigned arithmetic support

JDBC

  • Removed JDBC-ODBC Bridge.

  • JDBC 4.2 introduces new features.

Java DB

JDK 8 includes Java DB 10.10.

Network

  • The java.net.URLPermission class has been added.

  • In the java.net.HttpURLConnection class, if a security manager is installed, the call requesting to open the connection requires permissions.

Concurrency

  • Some new classes and interfaces have been added to the java.util.concurrent package.

  • Some new methods have been added to the java.util.concurrent.ConcurrentHashMap class to support aggregation operations based on new stream tools and lambda expressions.

  • The java.util.concurrent.atomic package has added new classes to support extensible and updatable variables.

  • Some new methods have been added to the java.util.concurrent.ForkJoinPool class to support universal pools.

  • The new java.util.concurrent.locks.StampedLock class provides a capability-based lock that can control read/write access through three modes.

Java XML - JAXP

HotSpot

  • New Hardware intrinsics to use Advanced Encryption Standard (AES). The UseAES and UseAESIntrinsics flags enable hardware-based AES intrinsics for Intel hardware. Hardware must be 2010 or newer Westmere hardware. For example, to enable hardware AES, use the following flags:

  • -XX: UseAES -XX: UseAESIntrinsics

  • To disable hardware AES, please use the following flags:

  • -XX:-UseAES -XX:-UseAESIntrinsics

  • Removed PermGen.

  • The bytecode instructions called by the method support the default methods in the Java programming language.

Java Mission Control 5.3 Release Notes

JDK 8 includes Java Mission Control 5.3.

The above is the detailed content of What are the new features of jdk8. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn