跳到主要内容

JDK8新特性

JDK8共更新55个新特性。部分重要特性会在后续的文章中单独介绍。特性列表如下

模块编号特性名称
--/--126Lambda Expressions & Virtual Extension Methods
138Autoconf-Based Build System
160Lambda-Form Representation for Method Handles
161Compact Profiles
162Prepare for Modularization
164Leverage CPU Instructions for AES Cryptography
174Nashorn JavaScript Engine
176Mechanical Checking of Caller-Sensitive Methods
179Document JDK API Support and Stability
vm/--142Reduce Cache Contention on Specified Fields
vm/gc122Remove the Permanent Generation
173Retire Some Rarely-Used GC Combinations
vm/rt136Enhanced Verification Errors
147Reduce Class Metadata Footprint
148Small VM
171Fence Intrinsics
core/--153Launch JavaFX Applications
core/lang101Generalized Target-Type Inference
104Annotations on Java Types
105DocTree API
106Add Javadoc to javax.tools
117Remove the Annotation-Processing Tool (apt)
118Access to Parameter Names at Runtime
120Repeating Annotations
139Enhance javac to Improve Build Speed
172DocLint
core/libs103Parallel Array Sorting
107Bulk Data Operations for Collections
109Enhance Core Libraries with Lambda
112Charset Implementation Improvements
119javax.lang.model Implementation Backed by Core Reflection
135Base64 Encoding & Decoding
149Reduce Core-Library Memory Usage
150Date & Time API
155Concurrency Updates
170JDBC 4.2
177Optimize java.text.DecimalFormat.format
178Statically-Linked JNI Libraries
180Handle Frequent HashMap Collisions with Balanced Trees
core/i18n127Improve Locale Data Packaging and Adopt Unicode CLDR Data
128BCP 47 Locale Matching
133Unicode 6.2
core/net184HTTP URL Permissions
core/sec113MS-SFU Kerberos 5 Extensions
114TLS Server Name Indication (SNI) Extension
115AEAD CipherSuites
121Stronger Algorithms for Password-Based Encryption
123Configurable Secure Random-Number Generation
124Enhance the Certificate Revocation-Checking API
129NSA Suite B Cryptographic Algorithms
130SHA-224 Message Digests
131PKCS#11 Crypto Provider for 64-bit Windows
140Limited doPrivileged
166Overhaul JKS-JCEKS-PKCS12 Keystores
web/jaxp185Restrict Fetching of External XML Resources

--/--

126 Lambda Expressions & Virtual Extension Methods

Add lambda expressions (closures) and supporting features, including method references, enhanced type inference, and virtual extension methods, to the Java programming language and platform.

126 Lambda 表达式和虚拟扩展方法

添加Lambda表达式(闭包)和一些新特性到 Java 编程语言和平台, 包括方法引用、增强类型推理和虚拟扩展方法。

138 Autoconf-Based Build System

Introduce autoconf (./configure-style) build setup, refactor the Makefiles to remove recursion, and leverage JEP 139: Enhance javac to Improve Build Speed.

138 基于 Autoconf 的构建系统

引入 autoconf( ./configure-style)构建设置,重构 Makefile 以删除递归,并利用 JEP 139:增强 javac 以提高构建速度

160 Lambda-Form Representation for Method Handles

Improve the implementation of method handles by replacing assembly language paths with an optimizable intermediate representation and then refactoring the implementation so that more work is done in portable Java code than is hardwired into the JVM.

160 方法句柄的 Lambda 形式表示

通过将汇编语言路径替换为可优化的中间表示形式,然后重构实现,从而改进方法句柄的实现,以便在可移植的 Java 代码中完成比硬连线到 JVM 中更多的工作。

161 Compact Profiles

Define a few subset Profiles of the Java SE Platform Specification so that applications that do not require the entire Platform can be deployed and run on small devices.

162 Prepare for Modularization

Undertake changes to smooth the eventual transition to modules in a future release, provide new tools to help developers prepare for the modular platform, and deprecate certain APIs that are a significant impediment to modularization.

164 Leverage CPU Instructions for AES Cryptography

Improve the out-of-box AES Crypto performance by using x86 AES instructions when available, and by avoiding unnecessary re-expansion of the AES key.

174 Nashorn JavaScript Engine

Design and implement a new lightweight, high-performance implementation of JavaScript, and integrate it into the JDK. The new engine will be made available to Java applications via the existing javax.script API, and also more generally via a new command-line tool.

176 Mechanical Checking of Caller-Sensitive Methods

Improve the security of the JDK’s method-handle implementation by replacing the existing hand-maintained list of caller-sensitive methods with a mechanism that accurately identifies such methods and allows their callers to be discovered reliably.

179 Document JDK API Support and Stability

There is a long-standing shortcoming in the JDK in terms of clearly specifying the support and stability usage contract for com.sun.* types and other types shipped with the JDK that are outside of the Java SE specification. These contracts and potential evolution policies should be clearly captured both in the source code of the types and in the resulting class files. This information can be modeled with JDK-specific annotation types.

vm/--

142 Reduce Cache Contention on Specified Fields

Define a way to specify that one or more fields in an object are likely to be highly contended across processor cores so that the VM can arrange for them not to share cache lines with other fields, or other objects, that are likely to be independently accessed.

vm/gc

122 Remove the Permanent Generation

Remove the permanent generation from the Hotspot JVM and thus the need to tune the size of the permanent generation.

173 Retire Some Rarely-Used GC Combinations

Remove three rarely-used combinations of garbage collectors in order to reduce ongoing development, maintenance, and testing costs.

vm/rt

136 Enhanced Verification Errors

Provide additional contextual information about bytecode-verification errors to ease diagnosis of bytecode or stackmap deficiencies in the field.

147 Reduce Class Metadata Footprint

Reduce HotSpot’s class metadata memory footprint in order to improve performance on small devices.

148 Small VM

Support the creation of a small VM that is no larger than 3MB.

171 Fence Intrinsics

Add three memory-ordering intrinsics to the sun.misc.Unsafe class.

core/--

153 Launch JavaFX Applications

Enhance the java command-line launcher to launch JavaFX applications.

core/lang

101 Generalized Target-Type Inference

Smoothly expand the scope of method type-inference to support (i) inference in method context and (ii) inference in chained calls.

104 Annotations on Java Types

Extend the set of annotatable locations in the syntax of the Java programming language to include names which indicate the use of a type as well as (per Java SE 5.0) the declaration of a type.

105 DocTree API

Extend the Compiler Tree API to provide structured access to the content of javadoc comments.

106 Add Javadoc to javax.tools

Extend the javax.tools API to provide access to javadoc.

117 Remove the Annotation-Processing Tool (apt)

Remove the apt tool, associated API, and documentation from the JDK.

118 Access to Parameter Names at Runtime

Provide a mechanism to easily and reliably retrieve the parameter names of methods and constructors at runtime via core reflection.

120 Repeating Annotations

Change the Java programming language to allow multiple application of annotations with the same type to a single program element.

139 Enhance javac to Improve Build Speed

Reduce the time required to build the JDK and enable incremental builds by modifying the Java compiler to run on all available cores in a single persistent process, track package and class dependences between builds, automatically generate header files for native methods, and clean up class and header files that are no longer needed.

172 DocLint

Provide a means to detect errors in Javadoc comments early in the development cycle and in a way that is easily linked back to the source code.

core/libs

103 Parallel Array Sorting

Add additional utility methods to java.util.Arrays that use the JSR 166 Fork/Join parallelism common pool to provide sorting of arrays in parallel.

107 Bulk Data Operations for Collections

Add functionality to the Java Collections Framework for bulk operations upon data. This is commonly referenced as “filter/map/reduce for Java.” The bulk data operations include both serial (on the calling thread) and parallel (using many threads) versions of the operations. Operations upon data are generally expressed as lambda functions.

109 Enhance Core Libraries with Lambda

Enhance the Java core library APIs using the new lambda language feature to improve the usability and convenience of the library.

112 Charset Implementation Improvements

Improve the maintainability and performance of the standard and extended charset implementations.

119 javax.lang.model Implementation Backed by Core Reflection

Provide an implementation of the javax.lang.model.* API backed by core reflection rather than by javac. In other words, provide an alternate API to access and process the reflective information about loaded classes provided by core reflection.

135 Base64 Encoding & Decoding

Define a standard API for Base64 encoding and decoding.

149 Reduce Core-Library Memory Usage

Reduce the dynamic memory used by core-library classes without adversely impacting performance.

150 Date & Time API

Define a new date, time, and calendar API for the Java SE platform.

155 Concurrency Updates

Scalable updatable variables, cache-oriented enhancements to the ConcurrentHashMap API, ForkJoinPool improvements, and additional Lock and Future classes.

170 JDBC 4.2

Minor enhancements to JDBC to improve usability and portability

177 Optimize java.text.DecimalFormat.format

Optimize java.text.DecimalFormat.format by taking advantage of numerical properties of integer and floating-point arithmetic to accelerate cases with two or three digits after the decimal point.

178 Statically-Linked JNI Libraries

Enhance the JNI specification to support statically linked native libraries.

180 Handle Frequent HashMap Collisions with Balanced Trees

Improve the performance of java.util.HashMap under high hash-collision conditions by using balanced trees rather than linked lists to store map entries. Implement the same improvement in the LinkedHashMap class.

core/i18n

127 Improve Locale Data Packaging and Adopt Unicode CLDR Data

Create a tool to convert LDML (Locale Data Markup Language) files into a format usable directly by the runtime library, define a way to package the results into modules, and then use these to incorporate the de-facto standard locale data published by the Unicode Consortium’s CLDR project into the JDK.

128 BCP 47 Locale Matching

Define APIs so that applications that use BCP 47 language tags (see RFC 5646) can match them to a user’s language preferences in a way that conforms to RFC 4647.

133 Unicode 6.2

Extend existing platform APIs to support version 6.2 of the Unicode Standard.

core/net

184 HTTP URL Permissions

Define a new type of network permission which grants access in terms of URLs rather than low-level IP addresses.

core/sec

113 MS-SFU Kerberos 5 Extensions

Add the MS-SFU extensions to the JDK’s Kerberos 5 implementation.

114 TLS Server Name Indication (SNI) Extension

Add support for the TLS Server Name Indication (SNI) Extension to allow more flexible secure virtual hosting and virtual-machine infrastructure based on SSL/TLS protocols.

115 AEAD CipherSuites

Support the AEAD/GCM cipher suites defined by SP-800-380D, RFC 5116, RFC 5246, RFC 5288, RFC 5289 and RFC 5430.

121 Stronger Algorithms for Password-Based Encryption

Provide stronger Password-Based-Encryption (PBE) algorithm implementations in the SunJCE provider.

123 Configurable Secure Random-Number Generation

Enhance the API for secure random-number generation so that it can be configured to operate within specified quality and responsiveness constraints.

124 Enhance the Certificate Revocation-Checking API

Improve the certificate revocation-checking API to support best-effort checking, end-entity certificate checking, and mechanism-specific options and parameters.

129 NSA Suite B Cryptographic Algorithms

Provide implementations of the cryptographic algorithms required by NSA Suite B.

130 SHA-224 Message Digests

Implement the SHA-224 message-digest algorithm and related algorithms.

131 PKCS#11 Crypto Provider for 64-bit Windows

Include the SunPKCS11 provider in the JDK for 64-bit Windows.

140 Limited doPrivileged

Enable code to assert a subset of its privileges without otherwise preventing the full access-control stack walk to check for other permissions.

166 Overhaul JKS-JCEKS-PKCS12 Keystores

Facilitate migrating data from JKS and JCEKS keystores by adding equivalent support to the PKCS#12 keystore. Enhance the KeyStore API to support new features such as entry metadata and logical views spanning several keystores. Enable the strong crypto algorithms introduced in JEP-121 to be used to protect keystore entries.

web/jaxp

185 Restrict Fetching of External XML Resources

Enhance the JAXP APIs to add the ability to restrict the set of network protocols that may be used to fetch external resources.

Process finished with exit code 0