JSR 379: Java SE 9: Annex 1 (original) (raw)
JSR 379: Java SE 9: Annex 1
Public Review Specification
API Specification Change Summary
2017/3/6 22:41 -0800 [75327a751fcc]
Copyright © 2017 Oracle and/or its affiliates · All Rights Reserved
This document describes the API specification changes made in Java SE 9 relative to Java SE 8, except for features or changes specified in related Component JSRs.
Contents
All changes to the specification made between Java SE 8 and Java SE 9, including trivial changes such as corrections of typographical errors and misspellings, are indicated in Annex 2, where insertions are conveniently shown on a light green background and deletions are shown struck through on a light red background.
Significant features, enhancements, bug fixes, and clarifications are described in the following sections of this document.
Core Libraries | ||
---|---|---|
Applets Beans Collections Streams I/O & NIO java.lang Reflection java.lang.ref | java.lang.invoke java.math java.time Concurrency java.util Logging Regular Expressions Internationalization | Networking JAR & ZIP APIs RMI CORBA Security Scripting JNDI JMX |
User Interface | XML | Tool Interface |
2D AWT Swing Sound | XML Parsing STaX | java.lang.instrument / JVM TI |
Core Libraries
Applets
Applets: Deprecate Applets
All APIs supporting applets including the entirejava.appletpackage (java.applet.Applet,java.applet.AppletStub,java.applet.AudioClip,java.applet.AppletContext) and thejavax.swing.JAppletclass have been deprecated. Browser-vendors have already removed the required browser plug-in to run a Java applet or have announced a time-line for removal. Alternative technologies such as Java Web Start or installable applications are recommended.
Deprecation Note: While there is currently no intention to remove these APIs in a future release; their use is strongly discouraged. An intent to remove these APIs may declared in the future.
Additional details may be found inJEP 289 Deprecate the Applet API.
The enhancement associated with this change is8149502.
Applets: Deprecate APIs which reference Applets
All APIs whose signatures refer to types defined in thejava.applet package weredeprecated. This is the complete list of affected APIs: interfacejava.beans.AppletInitializer,java.beans.Beans.instantiate, and methodjavax.swing.RepaintManager.addDirtyRegion.
Deprecation Note: While there is currently no intention to remove these methods in a future release; their use is strongly discouraged. An intent to remove these APIs may declared in the future.
The bug associated with this change is8169900.
Beans
Beans: Clarify meaning of
null
return value forSimpleBeanInfo.loadImage()
The specification of the return value ofjava.beans.SimpleBeanInfo.loadImagewas updated to include the interpretation of a
null
return value.Beans: Add annotations to generate
BeanInfo
classes at runtimeNew annotationsjava.beans.JavaBean,java.beans.BeanProperty, andjavax.swing.SwingContainerwere added to allow runtime generation of java.beans.BeanInfoclasses. These new annotations may be used to replace the compile-time javadoc
@beaninfo
tags.The enhancements associated with this change are4058433 and8132973.
Beans: Specify
IllegalArgumentException
conditions forEventHandler.create()
The overloads of
java.beans.EventHandler.create()
do not support non-public interfaces. The specification of these methods was updated to describe the current long-standing behaviour. Ajava.lang.IllegalArgumentExceptionwill be thrown whenever there is a restriction to define the proxy class is violated. These are the affected method overloads:java.beans.EventHandler.create(Class,Object,String),java.beans.EventHandler.create(Class,Object,String,String), andjava.beans.EventHandler.create(Class,Object,String,String,String).Beans: Generify
java.beans.beancontext
packageMethods in package java.beans.beancontextwere paramaterized with an unbounded wildcard (
<?>
). This change was motivated by a desire to reduce build warnings. This is the complete list of affected public methods:java.beans.beancontext.BeanContextServiceAvailableEvent.BeanContextServiceAvailableEvent,java.beans.beancontext.BeanContextServiceAvailableEvent.getCurrentServiceSelectors,java.beans.beancontext.BeanContextServiceAvailableEvent.getServiceClass,java.beans.beancontext.BeanContextServiceRevokedEvent.BeanContextServiceRevokedEvent,java.beans.beancontext.BeanContextServiceRevokedEvent.getServiceClass,java.beans.beancontext.BeanContextServiceRevokedEvent.isServiceClass,java.beans.beancontext.BeanContextServicesSupport.addService,java.beans.beancontext.BeanContextServicesSupport.hasService,java.beans.beancontext.BeanContextServicesSupport.getService,java.beans.beancontext.BeanContextServicesSupport.getCurrentServiceClasses,java.beans.beancontext.BeanContextServicesSupport.getCurrentServiceSelectors,java.beans.beancontext.BeanContextServicesSupport.revokeService, andjava.beans.beancontext.BeanContextSupport.iterator.The bug associated with this change is8039096.
Collections
Collections: Add convenience factory methods for collections
Static factory methods were defined to conveniently create compact, unmodifiable instances of thejava.util.List,java.util.Map, andjava.util.Setinterfaces with a small number elements. The following changes were necessary:
- In java.util.List, the class specification was updated to describe these immutable static factory methods and 11 overloads of java.util.List.of, supporting
List
creation with a fixed number of elements, were added.- In java.util.Map, the class specification was updated to describe these immutable static factory methods and 11 overloads of java.util.Map.of, supporting
Map
creation with a fixed number of key-value pairs, were added. Two additional methods,java.util.Map.entry, andjava.util.Map.ofEntries, were added to return an immutable map containing the keys and values extracted from the given entries and immutablejava.util.Map.Entry containing the given key and value, respectively.- In java.util.Set, the class specification was updated to describe these immutable static factory methods and 11 overloads of java.util.Set.of, supporting
Set
creation with a fixed number of elements, were added.Additional details may be found inJEP 269 Convenience Factory Methods for Collections,
The enhancements associated with this change are8048330, 8133977,8144952, and8159404.
Collections: Enhance
List.spliterator
for randomly accessible listsThe specification ofjava.util.List.spliteratorwas enhanced to describe how to account forjava.util.Listimplementingjava.util.RandomAccess.
The enhancement associated with this change is8158365.
Collections: Declare unspecified behaviour for
Iterator
methodsThe specifications ofjava.util.Iterator.remove,java.util.Iterator.forEachRemaining, andjava.lang.Iterable.forEachwere updated to explicitly declare that behaviour is unspecified if the action has a side-effect that modifies the underlying source of elements.
The bug associated with this change is8168745.
Collections: Specify exceptional conditions for
Map
,HashMap
, &Hashtable
The specification of thejava.util.Mapinterface was updated to declare that mapping functions should not modify the Map during computations. If any of the
compute*()
ormerge()
methods of java.util.HashMapandjava.util.Hashtabledetect that mapping functions have modified the map, they will throw ajava.util.ConcurrentModificationExceptionjust like the bulk operations. This is the complete list of affected methods:java.util.Map.computeIfAbsent,java.util.Map.computeIfPresent,java.util.Map.compute,java.util.Map.merge,java.util.HashMap.computeIfAbsent,java.util.HashMap.computeIfPresent,java.util.HashMap.compute,java.util.HashMap.merge,java.util.Hashtable.computeIfAbsent,java.util.Hashtable.computeIfPresent,java.util.Hashtable.compute, andjava.util.Hashtable.merge.The bug associated with this change is8071667.
Collections: Repeat class-level warnings in
Vector
andHashtable
methodsAlljava.util.Enumerations returned by java.util.Vectorandjava.util.Hashtablein the presence of structural modifications are undefined as previously described in the class documentation. More explicit warnings have been provided in the class documentation and in these methods:java.util.Vector.elements,java.util.Hashtable.keys, andjava.util.Hashtable.elements.
The enhancement associated with this change is8020860.
Collections: Remove incorrect restriction from
ArrayList.removeRange()
Injava.util.ArrayList.removeRange, the list of conditions for throwing ajava.lang.IndexOutOfBoundsExceptionwas updated to eliminate “
fromIndex <= size()
”.The bug associated with this change is8014066.
Collections: Add
Enumeration.asIterator()
An adaptor methodjava.util.Enumeration.asIteratorwas added to returnjava.util.Iteratorwhich wraps the
Enumeration
instance and forwards method invocations.The enhancement associated with this change is8072726.
Collections: Remove references to private fields in
AbstractList.subList()
References to the names of private fields in the
@implSpec
ofjava.util.AbstractList.subListwere removed.The enhancement associated with this change is8079136.
Collections: Declare
Spliterator.CONCURRENT
&Spliterator.IMMUTABLE
mutually exclusiveThe specification of constant java.util.Spliterator.CONCURRENTwas enhanced to declare that it is mutually exclusive from java.util.Spliterator.IMMUTABLE. Prior to this change, the relationship was implied.
The enhancement associated with this change is8032513.
Streams
Streams: Enhance specification for floating-point summation for non-finite values
The specification for the following methods was enhanced to describe how non-finite values, NaN, and infinity affect the returned value:java.util.DoubleSummaryStatistics.getAverage,java.util.DoubleSummaryStatistics.getSum,java.util.stream.DoubleStream.average, andjava.util.stream.DoubleStream.sum.
The bug associated with this change is8030942.
Streams: Add
Stream.ofNullable()
A static, convenience method,java.util.stream.Stream.ofNullable, was added to return a singleton stream containing the provided element or the empty stream.
The enhancement associated with this change is8050819.
Streams: Add
Stream.{drop,take}While()
Methods to take or drop elements while a predicate operating on those elements returns
true
were added. The following methods were added:java.util.stream.Stream.dropWhile,java.util.stream.Stream.takeWhile,java.util.stream.IntStream.dropWhile,java.util.stream.IntStream.takeWhile,java.util.stream.LongStream.dropWhile,java.util.stream.LongStream.takeWhile,java.util.stream.DoubleStream.dropWhile, andjava.util.stream.DoubleStream.takeWhile.The enhancement associated with this change is8071597.
Streams: Add finite
Stream.iterate()
Methods accepting a predicate to determine whether the stream source terminates were added:java.util.stream.Stream.iterate,java.util.stream.IntStream.iterate,java.util.stream.LongStream.iterate, andjava.util.stream.DoubleStream.iterate.
The enhancement associated with this change is8072727 and8164691.
Streams: Generify
Stream.generate()
The parameter of methodjava.util.stream.Stream.generatewas paramaterized with a bounded wildcard type.
The bug associated with this change is8132097.
Streams: Modify
Stream.collect()
The specification of the following methods was modified to indicate that the value of the second argument is combined into the first.
java.util.stream.Stream.collect. andjava.util.stream.DoubleStream.iterate.
The bug associated with this change is8164691.
Streams: Specify stream pipeline optimization
The class specifications of java.util.stream.Stream,java.util.stream.IntStream,java.util.stream.LongStream, andjava.util.stream.DoubleStreamwere enhanced to indicate that a stream implementation is free to elide any number of stages in a stream pipeline as long as it can prove that doing so does not affect the computation.
The bug associated with this change is8130023.
Streams: Update Collectors
The following changes were made to java.util.stream.Collectors.
- Add
Collectors.flatMapping()
: A mapping collector that maps an element to a stream of zero or more mapped elements was added: java.util.stream.Collectors.flatMapping.
The enhancement associated with this change is8071600.- Add
Collectors.filtering()
: A mapping collector that accepts elements of a specified type was added:java.util.stream.Collectors.filtering.
The enhancement associated with this change is8144675.- Propagate caveat to all
Collectors
: The existing type, mutability, serializability, and thread-safety caveat should be applied to alljava.util.stream.Collectors that implicitly create java.util.Collections. This caveat was unintentionally omitted from the original specification. The missing caveat was added to the following methods:java.util.stream.Collectors.groupingByConcurrent(Function),java.util.stream.Collectors.groupingByConcurrent(Function,Collector),java.util.stream.Collectors.partitioningBy,java.util.stream.Collectors.toMap(Function,Function),java.util.stream.Collectors.toMap(Function,Function,BinaryOperator),java.util.stream.Collectors.toConcurrentMap(Function,Function), andjava.util.stream.Collectors.toConcurrentMap(Function,Function,BinaryOperator).
The bug associated with this change is8068599.- Require presence of entries: The specification ofjava.util.stream.Collectors.partitioningBy(Predicate) andjava.util.stream.Collectors.partitioningBy(Predicate,Collector) was modified to require that the returned may contain entries for both
true
andfalse
keys.
The bug associated with this change is8170943.Streams: Clarify
BaseStream.spiterator()
The specification ofjava.util.stream.BaseStream.spliteratorwas clarified to indicate that characteristics of the returned value may be a sub-set of those that may be derived from the stream-pipeline.
The bug associated with this change is8048689.
I/O & NIO
I/O & NIO: Enhance
Charset*.replaceWith()
The specification of the replacement value parameter of java.nio.charset.CharsetDecoder.replaceWithandjava.nio.charset.CharsetEncoder.replaceWithwas enhanced to provide constraints on the replacement string. It may not be
null
and the String length may not be longer than the value returned bymaxBytesPerChar
.The bug associated with this change is8073692.
I/O & NIO: Remove
FilePermission
path name canonicalizationThe path name canonicalization process injava.io.FilePermissionwas removed so that only the original path name argument is used in the
implies()
,equals()
, andhashCode()
. methods. The actual file system is never accessed. Specification changes were required in java.io.FilePermission,java.io.FilePermission.FilePermission,java.io.FilePermission.implies, andjava.io.FilePermission.equals.Compatibility Note: Two
FilePermission
objects will not be equal to each other in the following situations:
- One object uses an absolute path and the other a relative path;
- One object uses a symbolic link and the other the target; or
- One object uses a Windows long name and the other a DOS-style 8.3 name, even if they point to the same file in the file system.
The bugs associated with this change are8164705 and8168979.
I/O & NIO: Specify exceptional conditions for
Reader
The abstract methodjava.io.Reader.readdid not specify pre-conditions for the parameters. The long-standing behaviour to throw ajava.lang.IndexOutOfBoundsExceptionwhen conditions were not met was added to
Reader.read()
and similar methods in all publically exported subtypes. This is the complete list of affected methods: java.io.Reader.read,java.io.CharArrayReader.read,java.io.InputStreamReader.read,java.io.PushbackReader.read,java.io.PipedReader.read,java.io.StringReader.read,java.io.FilterReader.read,java.io.BufferedReader.read, andjava.io.LineNumberReader.read.The bug associated with this change is8029689.
I/O & NIO: Enhance
*Reader.close()
for multi-thread useAn unexpectedjava.lang.NullPointerExceptionwas thrown occasionally in a multi-threaded application. Specification for thread blocking was added to the following methods:java.io.CharArrayReader.close,java.io.PushbackReader.close, andjava.io.StringReader.close.
The bug associated with this change is8143394.
I/O & NIO: Tidy various
read*()
method injava.io
Three kinds of problems were addressed by this change:
- The specification of the
off
parameter injava.io.ObjectInputStream.read,java.io.DataInput.readFully,java.io.DataInputStream.readFully,java.io.ObjectInputStream.readFully, andjava.io.RandomAccessFile.readFully was ambiguous since it could be interpreted as the offset of the data within the stream rather than the offset in the provided byte array. The specification was clarified to indicate the latter.- Conditions producing a java.lang.NullPointerException were missing in java.io.DataInput.readFully(byte[]),java.io.DataInput.readFully(byte[],int,int),java.io.DataInputStream.readFully(byte[]),java.io.DataInputStream.readFully(byte[],int,int),java.io.ObjectInputStream.readFully(byte[]),java.io.ObjectInputStream.readFully(byte[],int,int),java.io.RandomAccessFile.readFully(byte[]), and java.io.RandomAccessFile.readFully(byte[],int,int). An appropriate
@throws
was added.- Conditions producing a java.lang.IndexOutOfBoundsException were missing in java.io.DataInput.readFully,java.io.DataInputStream.readFully,java.io.ObjectInputStream.readFully, and java.io.RandomAccessFile.readFully. An appropriate
@throws
was added.The bug associated with this change is8154183.
I/O & NIO: Specify exceptional conditions for
Writer
The abstract methodsjava.io.Writer.writeandjava.io.Writer.writedid not specify pre-conditions for their parameters. The long-standing behaviour to throw ajava.lang.IndexOutOfBoundsExceptionwhen conditions were not met was added to these
Writer.read()
methods and similar methods in all publically exported subtypes. This is the complete list of affected methods: java.io.Writer.write(char[],int.int),java.io.Writer.write(String,int,int),java.io.BufferedWriter.write(char[],int,int),java.io.BufferedWriter.write(String,int,int),java.io.CharArrayWriter.write(char[],int,int),java.io.CharArrayWriter.write(String,int,int),java.io.FilterWriter.write(char[],int,int),java.io.FilterWriter.write(String,int,int),java.io.PipedWriter.write(char[],int,int),java.io.PrintWriter.write(char[],int.int),java.io.PrintWriter.write(String,int,int),java.io.StringWriter.write(char[],int,int), andjava.io.StringWriter.write(String,int,int).The bug associated with this change is8130679.
I/O & NIO: Add
InputStream.transferTo()
A convenience method,java.io.InputStream.transferTo, was added to support transferring contents from an input stream to an output stream.
The enhancement associated with this change is8066867.
I/O & NIO: Add
InputStream.readAllBytes()
&InputStream.readNBytes()
Convenience methodsjava.io.InputStream.readAllBytesandjava.io.InputStream.readNByteswere added to support reading all remaining bytes from the input stream and reading a given number of bytes from the input stream respectively.
The enhancement associated with this change is8080835.
I/O & NIO: Clarify exceptional conditions for
InputStream.skip()
Conditions for throwingjava.io.IOExceptionin the abstract methodjava.io.InputStream.skipwere unclear with regard to seeking. References to “seeking” were replaced with
InputStream.skip()
and similar methods in all publically exported subtypes. This is the complete list of affected methods:java.io.InputStream.skip,java.io.BufferedInputStream.skip,java.io.FilterInputStream.skip, andjava.io.PushbackInputStream.skip.The bug associated with this change is8136738.
I/O & NIO: Clarify flushing behaviour in
FilterOutputStream.close()
The java.io.FilterOutputStream.closemethod specified that it invokesjava.io.FilterOutputStream.flushbefore closing the underlying stream; however, it is ambiguous whether
flush()
is always invoked, even for streams that are already closed. The specification was clarified to describe the long-standing behaviour to invokeflush()
only if the stream is not closed.The bug associated with this change is8054565.
I/O & NIO: Enhance
java.nio.file
package description fornull
argumentsThejava.nio.filepackage description was enhanced to state that ajava.lang.NullPointerExceptionwill be thrown when a passed array contains a
null
element.The enhancement associated with this change is8062632.
I/O & NIO: Use co-variance in
java.nio.Buffer
and all subclassesMany methods injava.nio.Bufferare final and cannot be overridden by subclasses to provide co-variant overrides on the return type. Thus an awkward cast was required. The final identifier was removed from the following methods:java.nio.Buffer.clear,java.nio.Buffer.flip,java.nio.Buffer.limit,java.nio.Buffer.mark,java.nio.Buffer.position,java.nio.Buffer.reset, andjava.nio.Buffer.rewind. Corresponding methods with a co-variant return type were added to all public subclasses: java.nio.ByteBuffer,java.nio.CharBuffer,java.nio.DoubleBuffer,java.nio.FloatBuffer,java.nio.IntBuffer,java.nio.LongBuffer,java.nio.MappedByteBuffer, andjava.nio.ShortBuffer.
The enhancement associated with this change is4774077.
I/O & NIO: Add
Buffer.{duplicate,slice}()
Since every known subclass of java.nio.Bufferdefinedjava.nio.Buffer.duplicateandjava.nio.Buffer.slicemethods in exactly the same way, their specification was moved to
Buffer
.The enhancement associated with this change is8150785.
I/O & NIO: Add
ByteBuffer.{alignmentOffset,alignedSlice}()
Two methods were added.java.nio.ByteBuffer.alignmentOffsetqueries for misalignment at a given index and unit size.java.nio.ByteBuffer.alignedSliceslices a buffer after the position and limit are rounded to align for a given unit size.
The enhancement associated with this change is8149469.
I/O & NIO: Allow
null
parameter inAtomicMoveNotSupportedException
The specification for the
reason
parameter of the constructor, java.nio.file.AtomicMoveNotSupportedException.AtomicMoveNotSupportedException, was updated to to allownull
.The enhancement associated with this change is8024086.
I/O & NIO: Declare some methods in
Path
default
Eight methods in interfacejava.nio.file.Pathwere declared
default
. An@implNote
was added to each method describing the expected implementation. This is the complete list of affected methods: java.nio.file.Path.startsWith,java.nio.file.Path.endsWith,java.nio.file.Path.resolve,java.nio.file.Path.resolveSibling(String),java.nio.file.Path.resolveSibling(Path),java.nio.file.Path.toFile,java.nio.file.Path.register(WatchService,WatchEvent.Kind…), andjava.nio.file.Path.iterator.The enhancement associated with this change is8030090.
I/O & NIO: Specify exceptional conditions for
File
The specification for all methods injava.nio.file.Filesthat allow file open options to be specified was modified to throw ajava.lang.IllegalArgumentExceptionwhen invalid options or combinations of options are specified. The specification describing conditions to throw ajava.lang.SecurityExceptionwas enhanced to indicate that it may be thrown when the file is open with the
DELETE_ON_CLOSE
option. This is the complete list of affected methods: java.nio.file.Files.newBufferedWriter(Path,Charset,OpenOption…),java.nio.file.Files.newBufferedWriter(Path,OpenOption…),java.nio.file.Files.write(Path,byte[],OpenOption…),java.nio.file.Files.write(Path,Iterable,Charset,OpenOption…), andjava.nio.file.Files.write(Path,Iterable,OpenOption…).The bugs associated with this change are8062553 and8065109.
I/O & NIO: Clarify behaviour for zero attributes
The specification for java.nio.file.Files.readAttributeswas updated to match the long-standing behaviour. An attribute-list of zero elements throws a java.lang.IllegalArgumentException. If the list must have one more elements.
The bug associated with this change is8064466.
I/O & NIO: Support serialization filtering
Object serialization provides a mechanism to filter classes and objects during deserialization. This will improve security and robustness. Multiple changes were necessary to support serialization filtering:
- A new functional interface,java.io.ObjectInputFilter, was defined to filter classes, array lengths, and graph metrics during deserialization;
- A new nested interface,java.io.ObjectInputFilter.FilterInfo, provides access to information about the current object being deserialized;
- A new nested classes,java.io.ObjectInputFilter.Config, provides access to the process-wide filter;
- A new target name, “
serialFilter
”, was added tojava.io.SerializablePermission;- New methods java.io.ObjectInputStream.getObjectInputFilter andjava.io.ObjectInputStream.setObjectInputFilter were added to set and get the individual stream filter respectively; and
- Adjustments to constructors and methods in java.io.ObjectInputStream to account for the presence of filters.
Additional details may be found inJEP 290 Filter Incoming Serialization Data.
The enhancements associated with this change are8155760,8169645,8170291, and8166739.
I/O & NIO: Revise
objectInputStream.resolve{Proxy}?Class()
The specifications ofjava.io.ObjectInputStream.resolveClassandjava.io.ObjectInputStream.resolveProxyClasswere revised to filter the platform class loader and its ancestors rather than just the null class loader.
java.lang
java.lang: Update the primitive wrapper classes
The following changes were made to the primitive wrapper classes:
- New parse methods taking ajava.lang.CharSequence and a range were added to java.lang.Integer andjava.lang.Long. This will eliminate String object creation when only a portion of the string must be interpreted as a number. The following method were added:java.lang.Integer.parseInt,java.lang.Integer.parseUnsignedInt,java.lang.Long.parseLong, andjava.lang.Long.parseUnsignedLong.
The enhancements associated with this change are8041972 and8055251.java.lang: Update String, StringBuilder, & StringBuffer
The following changes were made tojava.lang.Stringand related classes.
- The class specification ofjava.lang.String contained language which unnecessarily locked down the implementation of java.lang.String.concat The implementation-specific wording was moved to an
@implNote
.
The enhancement associated with this change is8155215.- The class specification was enhanced to note that String comparison does not take locale into consideration.java.text.Collator is recommended for finer-grained, locale-sensitive String comparisons. The method specifications of java.lang.String.equalsIgnoreCase,java.lang.String.regionMatches(int,String,int,int), andjava.lang.String.regionMatches(boolean,int,String,int,int) were similarly adjusted.
The bug associated with this change is8138824.- The specification of java.lang.String.indexOf was not consistent with the similar methodjava.lang.StringBuilder.indexOf for the empty string. The specification was updated to match the long-standing behaviour.
For consistency between theindexOf()
andlastIndexOf()
methods in java.lang.String,java.lang.StringBuilder, andjava.lang.StringBuilder, the specifications inString
was propagated toStringBuffer
andStringBuilder
. This is the complete list of affected methods:java.lang.String.indexOf,java.lang.String.lastIndexOf,java.lang.StringBuffer.indexOf(String),java.lang.StringBuffer.indexOf(String,int),java.lang.StringBuffer.lastIndexOf(String),java.lang.StringBuffer.lastIndexOf(String,int),java.lang.StringBuilder.indexOf(String),java.lang.StringBuilder.indexOf(String,int),java.lang.StringBuilder.lastIndexOf(String), and java.lang.StringBuilder.lastIndexOf(String,int).
The bug associated with this change is8027640.- Several code point methods in java.lang.StringBuffer and java.lang.StringBuilder throw ajava.lang.IndexOutOfBoundsException; however, only the
StringBuilder
methods contained the required@throws
. The missing specification was added to the followingStringBuffer
methods:java.lang.StringBuffer.codePointAt,java.lang.StringBuffer.codePointBefore,java.lang.StringBuffer.codePointCount, andjava.lang.StringBuffer.offsetByCodePoints.
The bug associated with this change is8048264.java.lang: Add
StackWalker
A standard API to efficiently traverse selected frames on the execution stack was provided. It allows easy filtering of, and lazy access to stack trace information. The java.lang.StackWalkerclass contains methods to open a sequential stream of java.lang.StackWalker.StackFrameobjects for the current thread and to examine the contents of the stack frames. java.lang.StackFramePermissioncontrols access to the stack frame information including the class loader name. These APIs replace functionality provided by the internal method
sun.reflect.Reflection.getCallerClass()
.Additional details may be found inJEP 259 Stack-Walking API.
The enhancements associated with this change are8140450 and8153912.
java.lang: Add
Runtime.Version
The static, nested, inner classjava.lang.Runtime.Versionwas added to provide a simple API to parse, validate, and compare version-strings. The representation of the version-string contains a version number optionally followed by pre-release and build information. Access to the Runtime version is via the new static method, java.lang.Runtime.version.
Additional details may be found in JEP 223 New Version-String Scheme.
The enhancements associated with this change are8144062 and8161236.
java.lang: Process API Updates
The API for controlling and managing operating-system processes was enhanced via the following changes:
- A new value-based interface,java.lang.ProcessHandle, provides OS-specific process information about processes and their descendants, including the process identifier (PID) or equivalent, the command-line of the process, and liveness.
- Methods injava.lang.Process were added to access
ProcessHandle
information for the processes and their descendants.- The target name, “
manageProcess
”, was added tojava.lang.RuntimePermission to allow code to identify and terminate processes that it did not create.Additional details may be found inJEP 102 Process API Updates.
The enhancements associated with this change are8077350,8133216,8129344,8131763,8138566,8003488,8140213, and8140250.
java.lang: Update Process
The following changes were made to java.lang.Process.
- Invalid characters in command arguments was added to the set of operating-system dependencies which may throwjava.io.IOException injava.lang.ProcessBuilder.start.
The bug associated with this change is8131763.- In methodsjava.lang.ProcessBuilder.start andjava.lang.Runtime.exec the specification was enhanced to document the long-standing behaviour of throwing ajava.lang.UnsupportedOperationException when the operating system does not support process creation.
The bug associated with this change is8055330.- The methodjava.lang.ProcessBuilder.startPipeline was added to create a pipeline of processes linked by their standard input and output streams.
The enhancement associated with this change is8132394.- The fieldjava.lang.ProcessBuilder.Redirect.DISCARD was added as a convenience to direct output to the operating system’s
null
file.
The enhancement associated with this change is8132541.- A blanket
null
-handling statement was added to the class specifications ofjava.lang.ProcessBuilder and redundant method@throws NullPointerException
statements were removed.
The bug associated with this change is8050464.java.lang: Define behaviour of
null
resource nameThe specification of all methods to locate a resource by name were updated to describe the long-standing behavior to throwjava.lang.NullPointerExceptionif the provided name is
null
. This is the complete list of affected methods:java.lang.ClassLoader.getResource java.lang.ClassLoader.getResources java.lang.ClassLoader.resources java.lang.ClassLoader.getResourceAsStreamandjava.net.URLClassLoader.getResourceAsStream.The enhancement associated with this change is81702940.
java.lang: Add
ClassLoader.resources()
java.lang.ClassLoader.resourceswas added to support return of ajava.util.stream.Streamwhose elements are the URLs of all the resources with a given name.
The enhancement associated with this change is8161230.
java.lang: Specify exceptional condition for
get*Package()
The specifications of java.lang.ClassLoader.getPackage,java.lang.Package.getPackageand the new methodjava.lang.ClassLoader.getDefinedPackage, were updated to describe conditions for throwing ajava.lang.NullPointerException.
The bug associated with this change is8165346.
java.lang: Add
ClassLoader.isRegisteredAsParallelCapable()
java.lang.ClassLoader.isRegisteredAsParallelCapablewas added to return a boolean indicating whether or not the class loader can load multiple classes concurrently.
The enhancements associated with this change are8165793 and8169435.
java.lang: Enhanced
ClassLoader
with respect to loading array classesThe specification of java.lang.ClassLoaderwas enhanced to explicitly state that java.lang.Class.forNamemust be used to create java.lang.Classobjects representing array classes.
The enhancement associated with this change is6516909.
java.lang: Update
ClassLoader.getSystemClassLoader()
The specification of java.lang.ClassLoader.getSystemClassLoaderwas updated to remove the possibility of a
null
return value.The bug associated with this change is8165563.
java.lang: Update Math & StrictMath
The following changes were made tojava.lang.Math andjava.lang.StrictMath.
- fma support: Static methods supporting fused multiply-accumulate (fma) were added tojava.lang.Math andjava.lang.StrictMath. This the complete list of method:java.lang.Math.fma(float,float,float),java.lang.Math.fma(double,double,double),java.lang.StrictMath.fma(float,float,float), andjava.lang.StrictMath.fma(double,double,double).
The enhancement associated with this change is4851642.floorDiv()
,floorMod()
, &multiplyExact()
: Methods injava.lang.Math andjava.lang.StrictMath were added for thefloorDiv
,florMod
, andmultiplyExact
operations. This is the complete list of new methods:java.lang.Math.floorDiv,java.lang.Math.floorMod,java.lang.Math.multiplyExact,java.lang.StrictMath.floorDiv,java.lang.StrictMath.floorMod, andjava.lang.StrictMath.multiplyExact.
The enhancement associated with this change is8023217.multiplyFull()
&multiplyHigh()
: Methods supporting multiplication of to 64-bit integers to produce a 128-bit result were added tojava.lang.Math andjava.lang.StrictMath. This is the complete list of new methods: java.lang.Math.multiplyFull,java.lang.Math.multiplyHigh,java.lang.StrictMath.multiplyFull, andjava.lang.StrictMath.multiplyHigh.
The enhancement associated with this change is5100935.java.lang: Declare
SecurityException
consistently in class loader methodsThe conditions under whichjava.lang.SecurityExceptionmay be thrown was located in a combination of the method description and the associated
@throws
tag. For consistency this information was consolidated into the@throws
tag. Uniform wording was used for additional clarity. This is the complete list of affected methods:java.lang.Class.forName,java.lang.Class.getClassLoader,java.lang.ClassLoader.getParent,java.lang.ClassLoader.getSystemClassLoader, andjava.lang.Thread.getContextClassLoader.The bug associated with this change is7181225.
java.lang: Revise SecurityManager.check{TopLevelWindow,SystemClipboard,AccessAwtEventQueueAccess}
The specifications for deprecated methodsjava.lang.SecurityManager.checkTopLevelWindow,java.lang.SecurityManager.checkSystemClipboardAccess, andjava.lang.SecurityManager.checkAwtEventQueueAccesswere revised to check the target name “
AllPermission
” as described in the Java SE 8 Platform Specification. These methods are superseded by invocations ofjava.lang.SecurityManager.checkPermissionwithAWTPermission("showWindowWithoutWarningBanner")
,AWTPermission("accessClipboard")
, andAWTPermission("accessEventQueue")
respectively.The enhancement associated with this change is8029886.
java.lang: Add
Thread.onSpinWait()
Some hardware platforms may benefit from a software hint indicating that a spin loop is in progress. Thejava.lang.Thread.onSpinWaitmethod was added to indicate that the caller is momentarily unable to progress until one or more actions by other activities have occurred.
Additional details may be found inJEP 285 Spin-Wait Hints.
The enhancement associated with this change is8147832.
java.lang: Support threads that do not inherit inheritable thread-locals
Many threads created by the platform are short-lived, performing some simple asynchronous operation on behalf of the platform. These threads should not inherit inheritable thread-local variables. A new constructor,java.lang.Thread.Thread, was added to explicitly opt out of this inheritance. The specification ofjava.lang.InheritableThreadLocalwas augmented to note that initial values may not be set at object creation.
The enhancement associated with this change is8056152.
java.lang: Enhance
Deprecated
The class specification of java.lang.Deprecatedcorresponding to the
@Deprecated
annotation was enhanced to provide more nuanced information about the life cycle of APIs. Two methods were added:
- java.lang.Deprecated.since returns a String representing the version in which the annotated element was deprecated.
- java.lang.Deprecated.forRemoval indicates whether there is intent to remove the annotated element in a future version.
Additional details may be found inJEP 277 Enhanced Deprecation.
The enhancement associated with this change is8145461.
java.lang: Specify behaviour of
@Deprecated
when applied to package declarationsThe specification of java.lang.Deprecatedwas updated to state that is has no effect when applied to a package declaration.
The bug associated with this change is6481080.
java.lang: Deprecate boxed primitive constructors & identify APIs which may be removed in a future release
Three kinds of deprecation have been addressed by this change.
- All boxed primitive constructors (e.g.java.lang.Boolean.Boolean(boolean) andjava.lang.Boolean.Boolean(String)) have been deprecated. Use of these constructors encourages creation of new boxed instances and dependency on their identity. This conflicts with value-types in a future release. The static factory
valueOf()
methods have better time and space performance characteristics. Theparse*()
methods are recommended for conversion to primitive types.
Deprecation Note: While there is currently no intention to remove these constructors in a future release; their use is strongly discouraged. An intent to remove these APIs may declared in the future.- A limited number of old, obsolete, and dysfunctional methods which were already deprecated have been designated as likely candidates for removal in the next major release of the platform. This is the list of affected methods:
- java.lang.Runtime.getLocalizedInputStream was deprecated in JDK 1.1 and is superseded by use of the Unicode-friendly
*Reader
classes injava.io.- java.lang.Runtime.getLocalizedOutputStream was deprecated in JDK 1.1 and is superseded by use of the Unicode-friendly
*Writer
classes injava.io.- java.lang.Runtime.runFinalizersOnExit was deprecated in JDK 1.2 because it is unsafe. Finalizers may be invoked on live Objects.
- java.lang.SecurityManager.checkAwtEventQueueAccess was deprecated in Java SE 8 because it is error-prone. It is superseded by
SecurityManager.checkPermission( AWTPermission("accessEventQueue"))
- java.lang.SecurityManager.checkMemberAccess was deprecated in Java SE 8 because it is error-prone. It is superseded by
SecurityManager.checkPermission( java.security.Permission)
- java.lang.SecurityManager.checkSystemClipboardAccess was deprecated in Java SE 8 because it is error-prone. It is superseded by
SecurityManager.checkPermission( AWTPermission("checkSystemClipboardAccess"))
- java.lang.SecurityManager.checkTopLevelWindow was deprecated in Java SE 8 because it is obsolete. It is superseded by
SecurityManager.checkPermission( AWTPermission("showWindowWithoutWarningBanner"))
- java.lang.Thread.countStackFrames was deprecated in JDK 1.2 because it is error-prone and the return value is poorly specified.
- java.lang.Thread.destroy was deprecated in Java 2 SE 5.0 because it unimplemented and any implementation would be prone to deadlocks.
- java.lang.Thread.stop was deprecated in JDK 1.2 because it is unsafe. It may generate exceptions that the target thread cannot handle.
Deprecation Note: These methods have been annotated withforRemoval=true
indicating a high probability that they will be removed in the next major release of the Platform.- APIs which were previously deprecated have been modified to include the new
since="x"
element to indicate the Java SE version in which the API was deprecated. This allows the value to be retrieved using thejava.lang.Deprecated.since method. This affects 24 methods and constants.Additional details about the API life cycle may be found inJEP 277 Enhanced Deprecation.
The enhancement associated with this change is8145468.
java.lang: Enhance
SafeVarargs
The specification ofjava.lang.SafeVarargswas enhanced to allow
@SafeVarargs
on private methods.The enhancement associated with this change is7196160.
java.lang: Deprecate
Runtime.trace{Instruction,MethodCall}()
java.lang.Runtime.traceInstructionsandjava.lang.Runtime.traceMethodCallswere deprecated because they were not implemented and the intended functionality has been provided via alternative JVM-specific tracing mechanisms.
Deprecation Note: These methods have been annotated with
forRemoval=true
indicating a high probability that they will be removed in the next major release of the Platform.Additional details about the API life cycle may be found inJEP 277 Enhanced Deprecation.
The bug associated with this change is8153330.
java.lang: Deprecate
Compiler
The classjava.lang.Compilerwas intended to control just-in-time (JIT) compilation. Unfortunately, JITs are highly specialized and the controls they need are all very implementation-specific. These APIs are ignored by almost all JIT implementations. For HotSpot, this functionality is superseded byJEP 165 Compiler Control.
Deprecation Note: These methods have been annotated with
forRemoval=true
indicating a high probability that they will be removed in the next major release of the Platform.Additional details about the API life cycle may be found in JEP 277 Enhanced Deprecation.
The enhancement associated with this change is4285505.
java.lang: Generify
SecurityManager.getClassContext()
The return type of the protectedjava.lang.SecurityManager.getClassContextwas paramaterized with an unbounded wildcard (
<?>
). This change was motivated by a desire to reduce build warnings.The bug associated with this change is8027063.
Reflection
Reflection: Update Class
- java.lang.Class.newInstance was deprecated because it violates the checked exception definition. It allows undeclared checked exceptions to be thrown by the nullary constructor. The preferred method isjava.lang.reflect.Constructor.newInstance which wraps the constructor’s exceptions with anjava.lang.reflect.InvocationTargetException.
Deprecation Note: While there is currently no intention to remove this method in a future release; their use is strongly discouraged. An intent to remove these APIs may declared in the future.
The enhancement associated with this change is6850612.- The specification of java.lang.Class.getFields was enhanced to reflect long-standing behaviour to return all public fields on superinterfaces.
The bug associated with this change is8063147.- The specifications of java.lang.Class.getMethod andjava.lang.Class.getMethods were updated to be consistent with each other and to provide algorithms describing how the methods are identified.
The bug associated with this change is8062389.- The specifications of java.lang.Class.toGenericString andjava.lang.Class.toString was enhanced to include specification about array handling.
The bug associated with this change is8060077.Reflection: Tidy
Constructor
&Method
classesThree problems were addressed by this change:
- java.lang.reflect.Constructor.toString failed to state that it prints out “throws” information if present. This long-standing behaviour was documented.
- java.lang.reflect.Constructor.toGenericString used the phrase “return type” instead of “class name”. The incorrect text was replaced.
- The inherited specification injava.lang.reflect.Method.getDeclaringClass was augmented to provide additional information about the return type.
The bug associated with this change is8169479.
Reflection: Clarify
Executable.getAnnotatedReceiverType()
The specification ofjava.lang.reflect.Executable.getAnnotatedReceiverTypewas clarified to indicate that it will return
null
forConstructors
of nested static classes, top-level classes, local classes, and anonymous classes.The bug associated with this change is8044629.
Reflection: Add
AnnotatedElement.getAnnotatedOwnerType()
The interface java.lang.reflect.AnnotatedElementdid not support access to the potentially annotated owner type which retained its annotations. The java.lang.reflect.AnnotatedType.getAnnotatedOwnerTypemethod was added to provide this functionality. Similar methods were added to
AnnotatedElement
’s implementing classes:java.lang.reflect.AnnotatedArrayType.getAnnotatedOwnerType,java.lang.reflect.AnnotatedParameterizedType.getAnnotatedOwnerType,java.lang.reflect.AnnotatedTypeVariable.getAnnotatedOwnerType, andjava.lang.reflect.AnnotatedWildcardType.getAnnotatedOwnerType.The bug associated with this change is8057804.
Reflection: Clarify treatment of bounds for annotated types
The specification of the bounds for several annotated types was missing. Three problems were addressed by this change:
- The specifications of java.lang.reflect.AnnotatedWildcardType.getAnnotatedLowerBounds and java.lang.reflect.AnnotatedWildcardType.getAnnotatedUpperBounds were modified to declare the return a zero-length array and
Object
respectively when no explicit bounds are declared. The behaviour matches the correspondingjava.lang.reflect.WildcardType.getLowerBounds and java.lang.reflect.WildcardType.getUpperBounds.- The specification of java.lang.reflect.AnnotatedTypeVariable.getAnnotatedBounds was enhanced to declare that the returned bound is
Object
if a bound is not explicitly declared, This matches the un-annotated variant,java.lang.reflect.TypeVariable.getBounds.The bug associated with this change is8054304.
Annotations: Adjust number of type contexts
The specification forjava.lang.annotation.ElementTypereferred to the precise number of type contexts. A more general reference was provided to avoid the need to update this part of the specification as the language evolves.
The bug associated with this change is8033812.
Annotations: Support serialization of
AnnotationTypeMismatchException
Instances ofjava.lang.annotation.AnnotationTypeMismatchExceptioncould not be serialized because they contained a non-transient and non-static internal field of typejava.lang.reflect.Method which not serializable. The specification for all methods containing signature elements referencing that field were modified to allow it to be
null
. These are the affected public members of the class:java.lang.annotation.AnnotationTypeMismatchException.AnnotationTypeMismatchException java.lang.annotation.AnnotationTypeMismatchException.element, andjava.lang.annotation.AnnotationTypeMismatchException.foundType,The bug associated with this change is6226715.
java.lang.ref
java.lang.ref: Add
Cleaner
The new memory management class,java.lang.ref.Cleaner, provides an alternative to finalization. Object references and their corresponding cleaning actions are registered. Once the
Cleaner
has been notified that the object has become phantom reachable, the cleaning actions are executed.The enhancement associated with this change is8138696.
java.lang.ref: Automatically clear
PhantomReference
The specification ofjava.lang.ref.PhantomReferencewas aligned with soft and weak references which are automatically cleared by the garbage collector as they are enqueued.
The enhancement associated with this change is8071507.
java.lang.ref: Add
Reference.reachabilityFence()
The new static method,java.lang.ref.Reference.reachabilityFence, guarantees an ordering for strong reachability. Thus, the provided object will be strongly reachable regardless of any prior actions. Adjustments to the java.lang.ref.Referenceclass specification were required,
Additional details may be found inJEP 193 Variable Handles.
The enhancement associated with this change is8133348.
java.lang.invoke
java.lang.invoke: Add Variable Handles
Support for variable handles was added. A variable handles is a typed reference to a variable which supports read and write access to the variable under a variety of modes. Multiple changes were necessary:
- A new abstract class,java.lang.invoke.VarHandle, representing a dynamically-typed reference to a variable or family of variables, was added. Read and write access to the variable is supported in a variety of access modes as well as single-bit test-and-operate operations.
- A new nested type-safe enum,java.lang.invoke.VarHandle.AccessMode, containing constants for 31 possible modes was added
- The class file specification of java.lang.invoke.MethodHandles was extended and the following methods were added:java.lang.invoke.MethodHandles.varHandleExactInvoker,java.lang.invoke.MethodHandles.varHandleInvoker,java.lang.invoke.MethodHandles.arrayElementVarHandle,java.lang.invoke.MethodHandles.byteArrayViewVarHandle, and java.lang.invoke.MethodHandles.byteBufferViewVarHandle.
- The class file specification ofjava.lang.invoke.MethodHandles.Lookup was extended and the following methods was added:java.lang.invoke.MethodHandles.Lookup.findStaticVarHandle,java.lang.invoke.MethodHandles.Lookup.findVarHandle, and java.lang.invoke.MethodHandles.Lookup.unreflectedVarHandle.
Additional details may be found inJEP 193 Variable Handles.
The enhancements associated with this change are8149644,8151198,8151705,8154556,8154737,8154755,8157726,8158039,8161444,8162106,8162107, and8162108.
java.lang.invoke: Support enhanced method handles
The java.lang.invoke.MethodHandle,java.lang.invoke.MethodHandles, andjava.lang.invoke.MethodHandles.Lookupclasses were augmented to ease common uses cases and enable better compiler optimizations. Multiple changes were necessary:
- Argument handling was augmented: Two method overloads were added to java.lang.invoke.MethodHandle to create array-collecting and array-spreading method handles respectively:java.lang.invoke.MethodHandle.asCollector. andjava.lang.invoke.MethodHandle.asSpreader.
java.lang.invoke.MethodHandles was enhanced with the addition of new additional method overload, java.lang.invoke.MethodHandles.foldArguments, and three new methods:java.lang.invoke.MethodHandles.zero,java.lang.invoke.MethodHandles.empty, andjava.lang.invoke.MethodHandles.dropArgumentsToMatch.- Support for loops and try/finally blocks was added: Several static methods were added to java.lang.invoke.MethodHandles to support various looping constructs:java.lang.invoke.MethodHandles.loop,java.lang.invoke.MethodHandles.whileLoop,java.lang.invoke.MethodHandles.doWhileLoop,java.lang.invoke.MethodHandles.countedLoop(MethodHandle,MethodHandle,MethodHandle),java.lang.invoke.MethodHandles.countedLoop(MethodHandle,MethodHandle,MethodHandle,MethodHandle),java.lang.invoke.MethodHandles.iteratedLoop, andjava.lang.invoke.MethodHandles.tryFinally.
- New lookups for interfaces methods were added: The class specification of java.lang.invoke.MethodHandles.Lookup was adjusted and two new methods were added to support interface lookups:java.lang.invoke.MethodHandles.Lookup.findClass andjava.lang.invoke.MethodHandles.Lookup.accessClass.
Additional details may be found inJEP 194 Enhanced Method Handles.
The enhancements associated with this change are8130227,8150829,8151179,8158169,8153637,8150956,8158171, and8167974.
java.lang.invoke: Indify string concatenation
Methods to facilitate the creation of optimized String concatenation methods were added injava.lang.invoke.StringConcatFactory. When linkage invariants are violated, the new exceptionjava.lang.invoke.StringConcatException, is thrown.
Additional details may be found inJEP 280 Indify String Concatenation
The enhancements associated with this change are8085796,
java.lang.invoke: Specify behaviour for static methods
Exceptional handling for
static
methods in java.lang.invoke.MethodHandles.Lookupwas missing. The following changes were required:
- The specifications ofjava.lang.invoke.MethodHandles.Lookup.findSpecial(Class,String,MethodType,Class) andjava.lang.invoke.MethodHandles.Lookup.unreflectSpecial(Method,Class) were extended to describe the long-standing behaviour of throwing ajava.lang.IllegalAccessException if the provided method is
static
.
The bug associated with this change is8138578.- Similarly, the specification of java.lang.invoke.MethodHandles.Lookup.findVirtual was extended to describe the long-standing behaviour of throwing ajava.lang.IllegalAccessException if the provided method is
static
.
The bug associated with this change is8138884.java.lang.invoke: Refine
MethodHandle
&MethodHandles
Several changes were applied systematically to java.lang.invoke.MethodHandleandjava.lang.invoke.MethodHandles:
- Several method handle combinators express the result of their application in terms of pseudo code that uses type variables. These type variables were documented.
- A note was added to all method handle combinators and adapters that do not return vararg collectors indicating that the resulting adapter is never a variable-arity method handle.
- The documentation ofjava.lang.invoke.MethodHandles.tryFinally was clarified to mention the possible omission of trailing arguments.
This is the complete list of affected methods:java.lang.invoke.MethodHandle.asCollector(Class,int),java.lang.invoke.MethodHandle.asCollector(int,Class,int),java.lang.invoke.MethodHandle.bindTo,java.lang.invoke.MethodHandles.catchException,java.lang.invoke.MethodHandles.collectArguments,java.lang.invoke.MethodHandles.filterArguments,java.lang.invoke.MethodHandles.filterReturnValue,java.lang.invoke.MethodHandles.foldArguments(MethodHandle,int,MethodHandle),java.lang.invoke.MethodHandles.foldArguments(MethodHandle,MethodHandle),java.lang.invoke.MethodHandles.guardWithTest,java.lang.invoke.MethodHandles.insertArguments, andjava.lang.invoke.MethodHandles.permuteArguments.
The bugs associated with this change are8143410 and8150360.
java.lang.invoke: Clarify lookup context in
MethodHandles
The specifications of java.lang.invoke.MethodHandles.publicLookup,java.lang.invoke.MethodHandles.Lookup.accessClass,java.lang.invoke.MethodHandles.Lookup.findClass, and java.lang.invoke.MethodHandles.Lookup.inwere clarified to describe what constitutes a lookup context for a
Lookup
instance.The bug associated with this change is8150782.
java.lang.invoke: Specify exceptional conditions for
MethodHandles.loop()
The specification of java.lang.invoke.MethodHandles.loopwas modified to reformulate the conditions leading tojava.lang.IllegalArgumentException.
The bug associated with this change is8150635.
java.lang.invoke: Add
MethodHandles.arrayConstructor()
java.lang.invoke.MethodHandles.arrayConstructorwas added to create a method handle constructing arrays of the specified type.
The bug associated with this change is8155106.
java.lang.invoke: Add
MethodHandles.arrayLength()
java.lang.invoke.MethodHandles.arrayLengthwas added to return the length of an array.
The enhancement associated with this change is8156915.
java.lang.invoke: Propagate errors from
invokedynamic
Thejava.lang.invokepackage specification was updated to reflect changes to the Java SE 9 Edition of the Java Virtual Machine Specification. Exceptions from
invokedynamic
are propagated directly from the bootstrap method. Formerly, they were wrapped by ajava.lang.BootstrapMethodError.The enhancement associated with this change is8166974.
java.math
java.math: Add
BigDecimal.sqrt()
A method returning an approximation of the square root was added:java.math.BigDecimal.sqrt.
The enhancement associated with this change is4851777.
java.math: Add
BigInteger
square root methodsTwo methods returning the integer square root were added.java.math.BigInteger.sqrtreturns the largest integer which is less than or equal to the real square root.java.math.BigInteger.sqrtAndRemainderreturns a
BigInteger
array of two elements. The first element in the array is the integer square root and the second is the remainder.The enhancement associated with this change is8032027.
java.math: Add
BigInteger.TWO
The constantjava.math.BigInteger.TWOequal to
BigInetger.valueOf(2)
was added.The enhancement associated with this change is8152237.
java.math: Add more byte array constructors to BigInteger
Two constructors which use sub-arrays with offset and length for the two’s complement and sign-magnitude representation of
BigInteger
were added: java.math.BigInteger.BigInteger(byte[],int,int)andjava.math.BigInteger.BigInteger(int,byte[],int,int)The enhancement associated with this change is4026465.
java.math: Update
BigInteger
Serialized Form documentationInaccurate specification for the serialization of java.math.BigIntegerwas updated. For backwards compatibility, the integers
-1
,-1
,-2
, and-2
are the fixed values of the obsolete fieldsbitCount
,bitLength
,lowestSetBit
, andfirstNonzeroByteNum
respectively. These obsolete fields and are retained in the serialized form for backwards compatibility.The bug associated with this change is8035279.
java.math: Deprecate
BigDecimal
rounding mode integer constantsEight legacy constants and their uses in three
BigDecimal
method signatures were deprecated in favor ofjava.math.RoundingModewhich was added by JSR 176: Java 2 SE 5.0 (Tiger) Release Contents via componentJSR-13 Decimal Arithmetic Enhancements. The complete list of affected methods and fields is as follows:java.math.BigDecimal.divide(BigDecimal,int),java.math.BigDecimal.divide(BigDecimal,int,int),java.math.BigDecimal.setScale,java.math.BigDecimal.ROUND_UP,java.math.BigDecimal.ROUND_DOWN,java.math.BigDecimal.ROUND_CEILING,java.math.BigDecimal.ROUND_FLOOR,java.math.BigDecimal.ROUND_HALF_UP,java.math.BigDecimal.ROUND_HALF_DOWN,java.math.BigDecimal.ROUND_HALF_EVEN, andjava.math.BigDecimal.ROUND_HALF_UNNECESSARY.Deprecation Note: While there is currently no intention to remove these APIs in a future release; use of them is strongly discouraged. An intent to remove this API may declared in the future.
The enhancement associated with this change is4943627.
java.time
java.time: Correct boundaries specified by
ChronoField.EPOCH_DAY
The boundaries specified by java.time.temporal.ChronoField.EPOCH_DAYwere corrected to match the epoch day of
LocalDate.MIN.toEpochDay()
andLocalDate.MAX.toEpochDay()
.The bug associated with this change is8160681.
java.time: Support date-time patterns
'v'
&'vvv'
Support for time-zone formatting of generic non-locations formats and corresponding patterns letters
'v'
and'vvv'
defined by CLDRsection 8 was provided. Changes to the class specification ofjava.time.format.DateTimeFormatterand new methodsjava.time.format.DateTimeFormatterBuilder.appendGenericZoneText(TextStyle)andjava.time.format.DateTimeFormatterBuilder.appendGenericZoneText(TextStyle,Set)were required.The enhancement associated with this change is8155823.
java.time: Refine computation of time-zone name format
The specification for the computation of the time-zone format was optimized injava.time.format.DateTimeFormatterBuilder.appendZoneText(TextStyle)andjava.time.format.DateTimeFormatterBuilder.appendZoneText(TextStyle,Set). If the input temporal is a java.time.chrono.ChronoLocalDateTimeand it is not in the daylight savings overlap, then the DST status may be determined with the help of the Zone Id.
The enhancement associated with this change is8154567.
java.time: Change the definition of pattern letters
'A'
,'n'
, and'N'
The specifications of pattern letters
`A`
,'n'
, and'N'
injava.time.format.DateTimeFormatterBuilder.appendPatternwas changed to match the specification inCLDRsection 8. Prior to this change, the user was required to include pattern letters to handle the longest anticipated output value. Shorter values were zero-padded.The bug associated with this change is8148949.
java.time: Add pattern letter
'g'
Pattern letter
`g`
matching the field java.time.temporal.JulianFields.MODIFIED_JULIAN_DAYwas added to java.time.format.DateTimeFormatterBuilder.appendPattern. The new pattern letter matches the specification inCLDRsection 8.The bug associated with this change is8148949.
java.time: Add pattern letter
'DD'
Pattern letter
`DD`
was added tojava.time.format.DateTimeFormatterBuilder.appendPattern. The new pattern letter matches theCLDRspecification.The bug associated with this change is8079628.
java.time: Add
Chronology
&IsoChronology
methods for epoch time conversionThe following two method overloads were added to return the number of seconds from the beginning of the epoch:java.time.chrono.Chronology.epochSecond(int,int,int,int,int,int,ZoneOffset)and java.time.chrono.Chronology.epochSecond(Era,int,int,int,int,int,intZoneOffset).
The enhancement associated with this change is8030864.
java.time: Specify adjacent value parsing in
DateTimeForamtterBuilder.appendFraction()
The specification ofjava.time.format.DateTimeFormatterBuilder.appendFractionwas adjusted to use adjacent value parsing as described in java.time.format.DateTimeFormatterBuilder.appendValue. This allows successful parsing of fractional seconds.
The bug associated with this change is8031085.
java.time: Specify lenient parsing for offset parsing
The specifications ofjava.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME,java.time.format.DateTimeFormatter.BASIC_ISO_DATE,java.time.format.DateTimeFormatterBuilder.appendOffset, and java.time.format.DateTimeFormatterBuilder.appendOffsetIdwere modified to allow minutes and seconds to be optional via a lenient mode to offset parsing. This aligns this specification with the Date and Time Format, ISO 8601.
The bug associated with this change is8032051.
java.time: Support parsing of a single digit hour
The specifications ofjava.time.format.DateTimeFormatterBuilder.appendOffsetwas modified to to support parsing a single digit hour in the offset. Prior to this change the the date and time needed to be parsed separately.
The enhancement associated with this change is8066806.
java.time: Add
Duration.dividedBy()
The methodjava.time.Duration.dividedBywas added to return the number of whole times that a
Duration
occurs within thisDuration
, e.g. how many four hour periods there are in twelve hours.The enhancement associated with this change is8032510.
java.time: Add
JapaneseEra.getDisplayName()
An override of java.time.chrono.Era.getDisplayName,java.time.chrono.JapaneseEra.getDisplayName, was added to return the textual name identifying the era.
The bug associated with this change is8054214.
java.time: Modify the return value of
ZoneRulesProvider.getAvailableZoneIds()
The return type of java.time.zone.ZoneRulesProvider.getAvailableZoneIdswas modified to return an immutable set to improve the method performance.
The bug associated with this change is8066291.
java.time: Clarify
DateTimeFormatter
resolutionThe specification of java.time.format.DateTimeFormatterwas clarified to describe resolution when both zone and offsets are available. Since the offset has higher precedence over the zone, the zone should be ignored when forming the instant.
The bug associated with this change is8066982.
java.time: Clarify behaviour of
Chronology.isLeapYear()
outside ofChronology
rangeThe specification of java.time.chrono.Chronology.isLeapYearwas clarified to allow either a best guess or
false
for years outside of the range ofjava.time.chrono.Chronology. The correct result is guaranteed within the range.The bug associated with this change is8067800.
java.time: Add
Clock.tickMillis()
The method of java.time.Clock.tickMilliswas added to return a millisecond clock. This new method follows the existing pattern of the methods java.time.Clock.tickSecondsandjava.time.Clock.tickMinutes.
The enhancement associated with this change is8071919.
java.time: Change the return type of
LocalDate.getEra()
The return type of java.time.LocalDate.getErawas changed from java.time.chrono.Erato the more specific typejava.time.chrono.IsoErawhich is the correct era type for the calendar system. The method specification was also updated to remove reference to non-existentjava.time.chrono.IsoChronologyconstants.
The bug associated with this change is8072746.
java.time: Add conditions for throwing
IllegalArgumentException
toZoneOffseTransitionRule.of()
The specification of the static factory method,java.time.zone.ZoneOffsetTransitionRule.of, was modified to throw ajava.lang.IllegalArgumentExceptionwhen
getNano()
returns a non-zero value sinceZoneOffsetTransitionRule
does not support sub-second time resolutions.The bug associated with this change is8079063.
java.time: Add methods
Local{Date,Time}.ofInstant
Two static methods,java.time.LocalDate.ofInstantandjava.time.LocalTime.ofInstantwere added to ease conversion fromjava.time.Instantto java.util.Dateandjava.time.Instanttojava.time.LocalDate.
The enhancement associated with this change is8133079.
java.time: Add methods to retrieve portions of a
Duration
Convenience methodsjava.time.Duration.toDaysPart,java.time.Duration.toHoursPart,java.time.Duration.toMinutesPart,java.time.Duration.toSecondsPart,java.time.Duration.toMillisPart, andjava.time.Duration.toNanosPartwere added to extract portions of the java.time.Duration. Prior to these additions, they were computed from the existing java.time.Duration.getSeconds. Additionally, the methodjava.time.Duration.toSecondswas added following the existing method naming convention in this class.
The enhancement associated with this change is8142936.
java.time: Add methods to convert to seconds since the beginning of the epoch
Epoch seconds are used in many conversions. Many java.time APIs provide
toEpochSeconds
methods; however, they are missing in few notable, final classes. The necessary methods were added:java.time.LocalDate.toEpochSecond,java.time.LocalTime.toEpochSecond, andjava.time.OffsetTime.toEpochSecond. A constant for the beginning of the epoch (1970-1-1
) was also added: java.time.LocalDate.EPOCH.The enhancement associated with this change is8143413.
java.time: Add support to create streams of dates
Methods returning a sequential, ordered stream of dates within a given range and were added:java.time.LocalDate.datesUntil(LocalLdate), andjava.time.LocalDate.datesUntil(LocalDate,Period). The first method is expected to be frequently needed, yet tricky to implement correctly. The second method is quite difficult to implement correctly.
The enhancement associated with this change is8146218.
java.time: Add
Duration.truncatedTo()
A method,java.time.Duration.truncatedTo, that returns a copy of the instance with the smaller units set to zero was added. This method eliminates the need to perform computations using the epoch-second or nano-of-second values.
The enhancement associated with this change is8148849.
Concurrency
Concurrency: Update Concurrency
Concurrency support was extended with an inter-operable publish-subscribe framework, enhancements in the java.util.concurrent.CompletableFuture, class, and various other improvements.
- Interoperability among a number of asynchronous systems running on Java virtual machines is supported with the addition of thejava.util.concurrent.Flow class and its four nested interfaces, java.util.concurrent.Flow.Processor,java.util.concurrent.Flow.Publisher,java.util.concurrent.Flow.Subscriber, andjava.util.concurrent.Flow.Subscription. Additional, a utility class,java.util.concurrent.SubmissionPublisher was provided to create custom components.
The enhancement associated with this change is8134850.- Thejava.util.concurrent.CompletableFuture, class was enhanced to support delays for timeouts and subclassing and to provide a few utility methods. This is the complete list of new methods:java.util.concurrent.CompletableFuture.completeAsync(Supplier),java.util.concurrent.CompletableFuture.completeAsync(Supplier,Executor),java.util.concurrent.CompletableFuture.completeOnTimeout,java.util.concurrent.CompletableFuture.completedStage,java.util.concurrent.CompletableFuture.copy,java.util.concurrent.CompletableFuture.defaultExecutor,java.util.concurrent.CompletableFuture.delayedExecutor(long,TimeUnit),java.util.concurrent.CompletableFuture.delayedExecutor(long,TimeUnit,Executor),java.util.concurrent.CompletableFuture.failedFuture,java.util.concurrent.CompletableFuture.failedStage,java.util.concurrent.CompletableFuture.minimalCompletionStage,java.util.concurrent.CompletableFuture.newIncompleteFuture, andjava.util.concurrent.CompletableFuture.orTimeout.
The enhancement associated with this change is8134851.- The methodjava.util.concurrent.ForkJoinTask.pollSubmission. was added to define tasks that might sometimes prefer to poll external submissions.
The enhancement associated with this change is8134852.- A number of maintenance changes were made to 34 existing methods in scattered across the following classes in java.util.concurrent:java.util.concurrent.ConcurrentLinkedDeque,java.util.concurrent.CopyOnWriteArrayList,java.util.concurrent.CopyOnWriteArraySet,java.util.concurrent.LinkedTransferQueue,java.util.concurrent.Phaser,java.util.concurrent.ScheduledExecutorService,java.util.concurrent.Semaphore,java.util.concurrent.SynchronousQueue, andjava.util.concurrent.ThreadPoolExecutor. Addressed issues included minor clarifications, additional statements regarding deadlock and process progress, specification re-writes, and sample code updates.
The following methods were added:java.util.concurrent.ConcurrentLinkedDeque.toString,java.util.concurrent.LinkedTransferQueue.toString,java.util.concurrent.LinkedTransferQueue.toArray(),java.util.concurrent.LinkedTransferQueue.toArray(T[]), and java.util.concurrent.SynchronousQueue.toString.
The enhancement associated with this change is8134853.Additional details may be found inJEP 266 More Concurrency Updates
Concurrency: Specify exceptional conditions for
ThreadPoolExecutor.setCorePoolSize()
The specification ofjava.util.concurrent.ThreadPoolExecutor.setCorePoolSizewas updated to throw ajava.lang.IllegalArgumentExceptionif the provided core pool size is not between 0 and the maximum pool size.
The bug associated with this change is7153400.
Concurrency: Improve
CompletableFuture
compositionThe description of the relationship between the future returned by the composition methods and the future returned by the supplied function was revised. They are connected by a relay; the returned future completes when the other completes, with the same value. Confusing references to stages being “executed” was replaced with more precise text. In addition to updating the class specification ofjava.util.concurrent.CompletableFuture, the following methods were affected:java.util.concurrent.CompletableFuture.acceptEitherAsync,java.util.concurrent.CompletableFuture.runAfterBothAsync(CompletionStage,Runnable),java.util.concurrent.CompletableFuture.runAfterBothAsync(CompletionStage,Runnable,Executor),java.util.concurrent.CompletableFuture.thenAcceptBothAsync(CompletionStage,BiConsumer),java.util.concurrent.CompletableFuture.thenAcceptBothAsync(CompletionStage,BiConsumer,Executor),java.util.concurrent.CompletableFuture.thenApply,java.util.concurrent.CompletableFuture.thenCombineAsync(CompletionStage,BiFunction),java.util.concurrent.CompletableFuture.thenCombineAsync(CompletionStage,BiFunction,Executor),java.util.concurrent.CompletableFuture.thenCompose,java.util.concurrent.CompletableFuture.thenComposeAsync(Function),java.util.concurrent.CompletableFuture.thenComposeAsync(Function,Executor),java.util.concurrent.CompletableFuture.whenComplete,java.util.concurrent.CompletableFuture.whenCompleteAsync(BiConsumer), andjava.util.concurrent.CompletableFuture.whenCompleteAsync(BiConsumer,Executor).
The bugs associated with this change are8139927 and8143089.
Concurrency: ForkJoinPool updates
The following changes were made to java.util.concurrent.ForkJoinPool.
- A new constructor, java.util.concurrent.ForkJoinPool.ForkJoinPool, was added to provide more control over the pool for the management of thread and execution of
ForkJoin
tasks. The specification of existingForkJoinPool
constructors with fewer parameters was adjusted to reference “defaults for all other parameters”.
The bug associated with this change is8157523.- The class specification was updated to declare that the default factory for creating worker threads will create threads that have nojava.security.Permissions.
- The class specification was updated to describe the new system property, “
java.util.concurrent.ForkJoinPool.common.maximumSpares
”, which is used too support thread throttling.
The bug associated with this change is8056248.- The class specification was updated to clarify what thread context class loader will be set for threads running in the fork join common pool.
The bug associated with this change is8172726.Concurrency: Describe implementation requirements for atomicity guarantee
The class specification ofjava.util.concurrent.ConcurrentMapwas enhanced to describe all required method overrides to maintain atomicity guarantees.
The bug associated with this change is8078645.
Concurrency: Revise
java.util.concurrent.atomic
to useVarHandles
The packagejava.util.concurrent.atomicwas comprehensively updated to leverage java.lang.invoke.VarHandlespecification and methods. Twelve classes were affected.
The enhancement associated with this change is8080603.
Concurrency: Specify lack of order for
Priority*Queue.spliterator()
The class specifications of java.util.PriorityQueueandjava.util.concurrent.PriorityBlockingQueuewere updated to include
splitorator()
in the caveat which states that the method does not traverse the queue in a guaranteed orderThe bug associated with this change is8132964.
Concurrency: Add
TimeUnit.toChronoUnit()
&TimeUnit.of()
Methodsjava.util.concurrent.TimeUnit.toChronoUnitandjava.util.concurrent.TimeUnit.ofwere added to convert betweenjava.util.concurrent.TimeUnitandjava.time.temporal.ChronoUnit.
The enhancement associated with this change is8141452.
Concurrency: Deprecate
Atomic*.weakCompareAndSet()
and addAtomic*.weakCompareAndSetPlain()
The convention for methods injava.lang.invoke.VarHandleis that plain access is unqualified for read or write methods and volatile access is unqualified for read-modify-write methods. This means that
Atomic*.weakCompareAndSet()
andAtomic*.weakCompareAndSetVolatile()
are inconsistently named. To reduce confusion,Atomic*.weakCompareAndSet()
are deprecated:java.util.concurrent.atomic.AtomicBoolean.weakCompareAndSet,java.util.concurrent.atomic.AtomicInteger.weakCompareAndSet,java.util.concurrent.atomic.AtomicIntegerArray.weakCompareAndSet,java.util.concurrent.atomic.AtomicLong.weakCompareAndSet,java.util.concurrent.atomic.AtomicLongArray.weakCompareAndSet,java.util.concurrent.atomic.AtomicReference.weakCompareAndSet, andjava.util.concurrent.atomic.AtomicReferenceArray.weakCompareAndSet.Deprecation Note: While there is currently no intention to remove these methods in a future release; their use is strongly discouraged. An intent to remove these APIs may declared in the future.
Atomic*.weakCompareAndSetPlain
are the new replacements:java.util.concurrent.atomic.AtomicBoolean.weakCompareAndSetPlain,java.util.concurrent.atomic.AtomicInteger.weakCompareAndSetPlain,java.util.concurrent.atomic.AtomicIntegerArray.weakCompareAndSetPlain,java.util.concurrent.atomic.AtomicLong.weakCompareAndSetPlain,java.util.concurrent.atomic.AtomicLongArray.weakCompareAndSetPlain,java.util.concurrent.atomic.AtomicReference.weakCompareAndSetPlain, andjava.util.concurrent.atomic.AtomicReferenceArray.weakCompareAndSetPlain.The enhancement associated with this change is8164814.
Concurrency: Clarify
Semaphore.drainPermits()
The specification ofjava.util.concurrent.Semaphore.drainPermitswas extended to describe the behaviour when the number of permits is negative.
The bug associated with this change is8169272.
Concurrency: Define access control context for
ThreadPoolExecutor.finalize()
The specification of java.util.concurrent.ThreadPoolExecutor.finalizewas enhanced to declare that the finalizer runs using the access control context captured during construction of the
ThreadPoolExecutor
.Concurrency: Document
null
return value forForkJoinWorkerThread.newThread()
The specification for return value of java.util.concurrent.ForkJoinPool.ForkJoinWorkerThreadFactory.newThreadwas extended to expect a
null
when the request is rejected.The enhancement associated with this change is8143086.
java.util
The following changes have been made in thejava.utilpackage, in addition to changes detailed elsewhere in this document.
java.util: Remove fail-fast guarantee from
Properties
collections viewsjava.util.Properties was partially de-synchronized. Setters and bulk operations are unchanged. Simple getter methods and legacy enumerations are now unsynchronized. Iterators returned by “collection views”,java.util.Properties.entrySet,java.util.Properties.keySet, andjava.util.Properties.values, are no longer fail-fast; hence, the unchecked exceptionjava.util.ConcurrentModificationExceptionwill not be thrown. These iterators continue to guarantee traversal exactly once; however, they are not guaranteed to reflect modifications subsequent to their construction. This modification reduces the potential for deadlock.
The bug associated with this change is8029891.
java.util: Update Formatter
The following changes were made tojava.util.Formatter.
- The class specification for all conversions was updated to specify that all conversions results in “
null/NULL
” if the input argument isnull
.- All
format()
methods which are defined to use a default locale were inconsistent in describing how the default is determined. The following specifications were modified to use the locale returned byLocale.getDefault(Locale.Category.FORMAT)
:java.io.PrintStream.format(String,Object…),java.lang.String.format(String,Object…), and the class specification ofjava.util.Formatter.
The bug associated with this change is8146156.- The class specification for the
%n
conversion was updated to specify existing behaviour to return the platform-specific line separator returned byjava.lang.System.lineSeparator.
The bug associated with this change is8080252.java.util: Deprecate
Observer
&Observable
Thejava.util.Observerinterface andjava.util.Observableclass were deprecated. Their event model was limited and under specified. Neither has been maintained or enhanced in years. The packagejava.beansprovides a richer event model. Concurrent data structures injava.util.concurrentprovides reliable and ordered messaging among threads.
Deprecation Note: While there is currently no intention to remove this method in a future release; use of it is strongly discouraged. An intent to remove this API may declared in the future.
The bug associated with this change is8154801.
java.util: Add utility methods to check indexes & ranges
Utility methods were added for index/range bounds checking. Since these critical checks are deceptively easy; coding errors may have significant consequences. The static check index/range methods were added to java.util.Objects. Suitable constructors to
*IndexOutOfBoundException
that accept out of bounds values were also added. This is the complete list of new static methods and constructors:java.util.Objects.checkIndex(int,int),java.util.Objects.checkIndex(int,int,BiFunction),java.util.Objects.checkFromToIndex,java.util.Objects.checkFromIndexSize,java.lang.IndexOutOfBoundsException.IndexOutOfBoundsException(int),java.lang.ArrayIndexOutOfBoundsException.ArrayIndexOutOfBoundsException(int), andjava.lang.StringIndexOutOfBoundsException.StringIndexOutOfBoundsException(int).The enhancement associated with this change is8135248.
java.util: Specify exceptional conditions for
Properties.load()
The specification of methodsjava.util.Properties.load(Reader)andjava.util.Properties.load(InputStream)was updated to describe the long-standing behaviour to throwjava.lang.NullPointerExceptionwhen the parameter is
null
.The bug associated with this change is8073214.
java.util: Clarify mutability of
Properties.stringPropertyNames()
return valueThe specification of methodjava.util.Properties.stringPropertyNameswas updated to declare the long-standing behaviour to return an unmodifiable set of keys.
The bug associated with this change is8059361.
java.util: Add methods for array comparisons & mismatches
Support for comparison and identification of mismatches of arrays was provided via the addition of java.lang.Byte.compareUnsigned,java.lang.Short.compareUnsigned, and 57 static methods of the form
Arrays.equal()
,Arrays.compare()
,Arrays.compareUnsigned()
, andArrays.mismatch()
where parameters always include two arrays.The enhancements associated with this change are8033148 and8141409.
java.util: Support streams in
Scanner
The following new methods returning streams were added tojava.util.Scanner:java.util.Scanner.findAll(String),java.util.Scanner.findAll(Pattern),java.util.Scanner.tokens.
The enhancement associated with this change is8072722.
java.util: Add stream-returning methods to classes which only have
Enumeration
-returning methodsSeveral classes which only returnjava.util.Enumerations for traversal were identified. Companion methods returning streams were added. This is the complete list of new methods:java.net.NetworkInterface.inetAddresses,java.net.NetworkInterface.subInterfaces,java.net.NetworkInterface.networkInterfaces,java.security.PermissionCollection.elementsAsStream, andjava.sql.DriverManager.drivers.
The specification of java.util.Collections.enumerationwas clarified to say that an Iterator derived from an Enumeration does not support removal of elements.
The enhancements associated with this change are8081678 and8164815.
java.util: Specify late-binding for streaming methods
The specifications of java.util.BitSet.stream,java.lang.CharSequence.chars, andjava.lang.CharSequence.codePointswere enhanced to declare that the sourcejava.util.Spliteratoris late-binding.
The bug associated with this change is8169808.
java.util: Specify argument checking in selected
Scanner
methodsExceptional conditions resulting in ajava.lang.IllegalArgumentExceptionwhen the radix is outside of range was added. This the complete list of affected methods:java.util.Scanner.hasNextBigInteger,java.util.Scanner.hasNextByte,java.util.Scanner.hasNextInt,java.util.Scanner.hasNextLong,java.util.Scanner.hasNextShort,java.util.Scanner.nextBigInteger,java.util.Scanner.nextByte,java.util.Scanner.nextInt,java.util.Scanner.nextLong, and java.util.Scanner.nextShort.
The bug associated with this change is8166261.
java.util: Add SPI to invoke command-line tools
A general means for a application code to invoke tools in the same virtual machine was added by interface java.util.spi.ToolProvider. These service provider implementations are found using java.util.ServiceLoader.
The enhancement associated with this change is8159855.
java.util: Document exceptional conditions in
Preferences
The specifications for all
put*()
,get*()
, andremove()
methods injava.util.prefs.AbstractPreferencesandjava.util.prefs.Preferenceswere updated to prohibit the use of any key or value String containing codepointU+000
(the null control character). If this character is detected, ajava.lang.IllegalArgumentExceptionis thrown. This affects 15 methods in each class.The class specification ofjava.util.prefs.AbstractPreferenceswas updated to correct references to the return type of
flush()
andsync()
methods. They return aboolean
instead of the documentedvoid
.The bugs associated with this change are8038373 and8075156.
java.util: Update Objects
The following changes were made to java.util.Objects.
- Convenience methodsjava.util.Objects.requireNonNullElse andjava.util.Objects.requireNonNullElseGet were added to compute a non-
null
default and to compute a non-null value produced by the supplying function.
The enhancements associated with this change are8138963 and8141652.- The specifications ofjava.util.Objects.checkIndex,java.util.Objects.checkFromToIndex andjava.util.Objects.checkFromIndexSize were modified to declare behaviour if the exception mapping function returns
null
or throws an exception.
The enhancement associated with this change is8142493.java.util: Update Optional
The following changes were made to java.util.Optional and primitive specializations.
- java.util.Optional.stream,java.util.OptionalDouble.stream,java.util.OptionalInt.stream, andjava.util.OptionalLong.stream were added to transform a stream into a stream of present values.
The enhancement associated with this change is8050820.- The parameter of the primitive specialization methods,java.util.OptionalDouble.orElseThrow,java.util.OptionalInt.orElseThrow, andjava.util.OptionalLong.orElseThrow, was aligned with java.util.Optional.orElseThrow.
The bug associated with this change is8059324.- java.util.Optional.ifPresentOrElse,java.util.OptionalDouble.ifPresentOrElse,java.util.OptionalInt.ifPresentOrElse, andjava.util.OptionalLong.ifPresentOrElse were added to preform a consumer-based action when a value is present and a runnable-based action when the value is not present.
The enhancement associated with this change is8071670.- java.util.Optional.or was added to return an
Optional
describing the value if present or anotherOptional
produced by the supplying function.
The enhancement associated with this change is8080418.- Wildcards were added to the declaration ofjava.util.Optional.flatMap.
The bug associated with this change is8152617.
Logging
Logging: Support platform logging
A minimal logging API which platform classes may use to log messages, along with a service interface for consumers of those messages was defined. The following changes were required:
- A new nested class,java.lang.System.LoggerFinder, which creates, manages, and configures loggers to the underlying framework in use.
- A new nested interface,java.lang.System.Logger, which logs messages that will be routed to the underlying framework used byjava.lang.System.LoggerFinder.
- A new type-safe enum,java.lang.System.Logger.Level, which maps system logger levels to a severity.
- Two new static methods, java.lang.System.getLogger(String) andjava.lang.System.getLogger(String,ResourceBundle) were added to return an instance of the java.lang.System.LoggerFinder for the caller’s use.
- A newjava.lang.RuntimePermission, with target name “
loggerFinder
”, was added to protect access to loggers of system classes.Additional details may be found inJEP 264 Platform Logging API & Service.
The enhancements associated with this change are8140364 and8148568.
Logging: Remove selected
PropertyChangeListeners
As described in the Java SE 8 Platform Specification (JSR 337), a few methods have a chain of dependencies that ultimately requires the very large
java.desktop
module. Any application that uses the core logging or JAR-file APIs could only run on a configuration of the Platform that includes the desktop APIs, which is clearly undesirable. These methods were removed:
LogManager.addPropetyChangeListener(java.beans.PropertyChangeListener)
LogManager.removePropertyChangeListener(java.beans.PropertyChangeListener)
The enhancement associated with this change is8029805.
Logging: Add
LogManager.*ConfigurationListener()
New methodsjava.util.logging.LogManager.addConfigurationListenerandjava.util.logging.LogManager.removeConfigurationListenerwere added to provide equivalent functionality as removed methods
LogManager.addPropetyChangeListener()
andLogManager.removePropertyChangeListener()
. These new methods are the alternative for applications which can not subclassLogManager
.The enhancement associated with this change is8043306.
Logging: Add
LogManager.updateConfiguration()
methodsMethodsjava.util.logging.LogManager.updateConfigurationandjava.util.logging.LogManager.updateConfigurationwere added to update the
LogManager
. Unlikejava.util.logging.LogManager.readConfigurationthese new methods do not invokejava.util.logging.LogManager.resetwhich always removes and closes handlers on all existing loggers. Adjustments were also made to the class specification, java.util.logging.LogManagerand methodsjava.util.logging.LogManager.readConfiguration(),java.util.logging.LogManager.readConfiguration(InputStream), andjava.util.logging.LogManager.reset.The bug associated with this change is8033661 and8075810.
Logging: Add
FileHandler
constructorA new method,java.util.logging.FileHandler.FileHandlerwas added to provide the ability to create logs which are bigger than 2G.
The enhancement associated with this change is8059767.
Logging: Add
<logger>.handlers.ensureCloseOnReset
system propertyA new system configuration property, “
<logger>.handlers.ensureCloseOnReset
”, was added to control whether loggers are closed on java.util.logging.LogManager.reset. Complete documentation may be found in the class specification ofjava.util.logging.LogManager.The bug associated with this change is8060132.
Logging: Add
<handler-name>.maxLocks
system propertyA new system configuration property, “
<handler-name>.maxLocks
”, was added to set the maximum number of concurrent log file locks for ajava.util.logging.FileHandler. The default value is 100. Complete documentation may be found in the class specification of java.util.logging.FileHandlerand the new constructor,java.util.logging.FileHandler.FileHandler.The enhancement associated with this change is8153955.
Logging: Upgrade to nanosecond event time resolution
The resolution of time stamps in java.util.logging.LogRecordwere upgraded from milliseconds to nanoseconds backed by java.time. This change was documented in thejava.util.logging.LogRecord.LogRecord. The event instant may be retrieved and set via new methodsjava.util.logging.LogRecord.getInstantandjava.util.logging.LogRecord.setInstant. The specification of existing methodsjava.util.logging.LogRecord.getMillisandjava.util.logging.LogRecord.setMilliswas enhanced with and
@apiNote
redirecting the user to the corresponding{get,set}Instant()
. Adjustments were also required to the serialized form.The enhancements associated with this change are8072645 and8144262.
Logging: Revise the
Formatter.formatMessage()
specificationThe specification ofjava.util.logging.Formatter.formatMessagewas revised to use java.text.MessageFormatif the string contains digits.
The bug associated with this change is8153666.
Regular Expressions
Regular Expressions: Add two Perl regular expression constructs
The following new regular expression constructs were added to supportUnicode extended grapheme clusters:
'\X'
matches any Unicode extended grapheme cluster'\b{g}'
matches a Unicode extended grapheme cluster boundaryThe enhancement associated with this change is7071819.
Regular Expressions: Support Unicode name
The following new regular expression construct were added to specify a Unicode code point by name:
'\N{name}'
matches the character with the Unicode character name nameThe set of valid name are the valid Unicode character names matched by the new methodjava.lang.Character.codePointOf.
The enhancement associated with this change is8147531.
Regular Expressions: Add
Matcher.appendReplacement()
andMatcher.appendTail
forStringBuilder
Overload methods java.util.regex.Matcher.appendReplacementandjava.util.regex.Matcher.appendTailwere added matching the identically named methods with a
StringBuffer
parameter.The enhancement associated with this change is8039124.
Regular Expressions: Support functional programming
New functional methodsjava.util.regex.Matcher.replaceAllandjava.util.regex.Matcher.replaceFirstwere added matching the identically named methods.java.util.regex.Matcher.resultswas added to return a stream of java.util.regex.MatchResult.
The enhancement associated with this change is8071479.
Internationalization
These are the changes relating to internationalization support, primarily in thejava.utilandjava.textpackages and injava.lang.Character.
Internationalization: Support Unicode 8.0
The supported version of the Unicode standard for java.lang.Characterandjava.lang.Stringwas changed from 6.2.0 to 8.0.0. Due to timing of the Unicode releases with respect to this specification, support was added in two phases, first from Unicode 6.2.0 to 7.0.0 and then from 7.0.0 to 8.0.0. As a result of the full update, four new constants were added tojava.lang.Character, 42 constants were added tojava.lang.Character.UnicodeBlock, 29 enums were added tojava.lang.Character.UnicodeScript, and two ranges were added tojava.awt.font.NumericShaper.Range. The majority of the changes occurred when updating to 7.0.0 since changes for 8.0.0 support were small.
Additional details may be found inJEP 227 Unicode 7.0 andJEP 267 Unicode 8.0.
The enhancements associated with this change are8032446 and8072600.
Internationalization: Update Locale
The following changes were made tojava.util.Locale.
- A means to retrieve country codes for country names which have been deleted from ISO 3166-1 is supported with the addition of the following APIs. A new type-safe enum, java.util.Locale.IsoCountryCode, was added to specify the type defined in ISO 3166. A new method overload was added: java.util.Locale.getISOCountries(Locale.IsoCountryCode). The specification of existing method,java.util.Locale.getISOCountries() was modified in consideration of the new overload.
The bug associated with this change is8071929.- Injava.util.Locale.toString, the separator character between the
script
andextensions
fields was changed from ‘-
’ to ‘_
’ matching the existing implementation.
The bug associated with this change is8025547.- The specifications ofjava.util.Locale.LanguageRange andjava.util.Locale.LanguageRange.LanguageRange were updated to throw ajava.lang.IllegalArgumentException if the provided
range
does not comply with the syntax of the language range in RFC 4647.
The bug associated with this change is8047780.- The method,java.util.Locale.LanguageRange.toString, was added.
The enhancement associated with this change is8026766.Internationalization: Use CLDR Locale data by default
The Unicode Consortium’sCommon Locale Data Repository (CDLR) is the de-facto standard for local data on many platforms. The following changes were required to support CLDR:
- The specification of thejava.util.spi.LocaleServiceProvider class was updated to make CLDR the default locale provider.
The enhancement associated with this change is8008577.- Injava.util.spi.LocaleServiceProvider, a new locale data name, “COMPAT”, was added to replace “JRE” which represents the locale-sensitive service that is compatible with Java SE 8 releases and earlier. The name “JRE” is deprecated.
The enhancement associated with this change is8062006.- Injava.util.spi.LocaleServiceProvider, the default order of preferred local providers was changed from “CLDR,COMPAT,SPI” to “CLDR,COMPAT”, dropping the “SPI” locale service provider which is always loaded, even if there is no implementation.
The enhancement associated with this change is8138613.Additional details may be found inJEP 252 Use CLDR Locale Data by Default.
.
Internationalization: Load
java.{awt.im,text,util}.spi
from the application’s classpathThe SPI implementations forjava.awt.im.spi,java.text.spi, andjava.util.spiwere originally designed to load their provider implementations via the deprecated Java Extension Mechanism. They now locate these implementations on the application’s classpath. The following changes were required:
- The class specification of java.util.spi.LocaleServiceProvider and package specification ofjava.awt.im.spi, were modified to reference this new mechanism.
The bugs associated with this change are8062588- The constructorjava.util.spi.LocaleServiceProvider.LocaleServiceProvider was modified to describe conditions for throwingjava.lang.SecurityException and thejava.lang.RuntimePermission target name “
localeServiceProvider
” was added.
The bugs associated with this change are8075545.- The target name “
localeServiceProvider
” was added to the permission target table in java.lang.RuntimePermission.
The bugs associated with this change are8079186.Internationalization: Provide UTF-8 property resource bundles
Support for encoding resource bundle properties in UTF-8 by default was introduced. The class file specification,java.util.PropertyResourceBundle, and the constructor specification,java.util.PropertyResourceBundle.PropertyResourceBundle, were updated to expect that the input stream is encoded in UTF-8 rather than ISO-8859-1. If an error occurs while reading, the input stream is re-read in ISO-8859-1. A new system property, “
java.util.PropertyResourceBundle.encoding
” may be used to explicitly set the encoding of the steam to either “ISO_8859-1” or “UTF-8”.Additional details may be found inJEP 226 UTF-8 Property Resource Bundles.
The enhancements associated with this change are8027607 and8152629.
Internationalization: Load
ResourceBundleControlProvider
implementations from the application’s classpathjava.util.spi.ResourceBundleControlProvideris an interface for service providers to provide implementations of java.util.ResourceBundle.Control. It was originally designed to load provider implementation via the deprecated Java Extension Mechanism. It now locates SPI implementations on the application’s classpath. The following changes were required:
- The specifications of java.util.ResourceBundle andjava.util.ResourceBundle.getBundle were enhanced to describe the default behaviour when no service provider has been provided and how the service provider is identified.
- The class specification ofjava.util.ResourceBundle.Control was modified to state that service providers of java.util.spi.ResourceBundleControlProvider are ignored in named modules. Hence, applications which implement that interface must useupgradeable modules when they are migrated to modules.
- The specification of the java.util.spi.ResourceBundleControlProvider interface was altered to indicate that provider implementations are loaded from the application’s class path.
The bugs associated with this change are8172365.
Internationalization: Clarify type of constant in
ResourceBundle.Control
A link under the word “unmodifiable” in the specification of constantsjava.util.ResourceBundle.Control.FORMAT_CLASS,java.util.ResourceBundle.Control.FORMAT_DEFAULT, andjava.util.ResourceBundle.Control.FORMAT_PROPERTIES, was removed to clarify that this is a general statement about the expected behaviour of the instance, not the instance itself.
The enhancement associated with this change is8134373.
Internationalization: Clarify context sensitivity of the month pattern
The specification for the “Letter M” month pattern in the class description ofjava.text.SimpleDateFormatwas enhanced to provide examples of the expected output in various situations.
The bug associated with this change is8055900.
Internationalization: Specify exceptional condition for
Format.parseObject()
The specification of methodsjava.text.Format.parseObject(String)andjava.text.Format.parseObject(String,ParsePosition)was updated to describe the long-standing behaviour to throwjava.lang.NullPointerExceptionwhen the provided source parameter is
null
. A similar change was required in all subclasses ofFormat
:java.text.DateFormat.parseObject,java.text.MessageFormat.parseObject, andjava.text.NumberFormat.parseObject.The bugs associated with this change are8073211 and8150702.
Internationalization: Specify exceptional conditions in
Format
The specification of many methods in abstract classjava.text.Formatand concrete subclasses was inconsistent in declaring java.lang.NullPointerExceptionandjava.lang.IllegalArgumentException. The appropriate exceptions were added. This is the complete list of affected classes: java.text.DecimalFormat,java.text.ChoiceFormat,java.text.DateFormat,java.text.MessageFormat,java.text.NumberFormat, andjava.text.SimpleDateFormat.
The bug associated with this change is8169480.
Internationalization: Add references to
Calendar
constants toDateFormatSymbols
Unlike other methods injava.text.DateFormatSymbols, the month-related methods of did not contain references to java.util.Calendar month constants. The required references were added. This is the list of affected methods: java.text.DateFormatSymbols.getMonths,java.text.DateFormatSymbols.setMonths,java.text.DateFormatSymbols.getShortMonths, andjava.text.DateFormatSymbols.setShortMonths.
The bug associated with this change is8129555.
Internationalization: Update Currency
The following changes were made tojava.util.Currency and associated support for currency.
- A new convenience method,java.util.Currency.getNumericCodeAsString, was added to return the numeric currency code of a country as a 3-digit string, possibly with leading zeros, as per ISO-4217.
The enhancement associated with this change is8154295.- Clarify that the phrases “minor units”, “default fraction digits”, and “default number of fraction digits” are equivalent. Also, recommend thatjava.math.BigDecimal be used for monetary values. Changes were made to java.util.Currency andjava.util.Currency.getDefaultFractionDigits.
The bug associated with this change is8074411.- Modify the description of java.lang.NullPointerException injava.util.Currency.getInstance to remove reference to the country code.
The bug associated with this change is8075315.
Networking
Networking: Preserve operating system’s IP address order
A new token, ‘
system
’, was added to the set of possible values for the system propertyjava.net.preferIPV6Addresseswhich may be used to re-order Internet Protocol (IP) addresses. The new value is specified to preserve the order returned by the operating system.The bug associated with this change is8016521.
Networking: Specify exceptional conditions for
URL
constructorsThe specification of the four
URL
constructors was enhanced to describe restrictions on the port number and to document the long-standing behaviour to throw ajava.net.MalformedURLExceptionwhen the port number is invalid. These are the affected constructors:java.net.URL.URL(String,String,int,String),java.net.URL.URL(String,String,String),java.net.URL.URL(URL,String), andjava.net.URL.URL(URL,String,URLStreamHandler).The bug associated with this change is4906983.
Networking: Allow multiple sockets to be bound to the same address and port
Support for a new socket option which allows a number of sockets to be bound to the same address and port was provided with the addition of the following APIs:
- A new constantjava.net.SocketOptions.SO_REUSEPORT andjava.net.StandardSocketOptions.SO_REUSEPORT were added to identify whether the option is enabled.
- The specification ofjava.net.MulticastSocket.MulticastSocket was adjusted to reference the new socket option.
The enhancement associated with this change is6432031.
Networking: Use
ServiceLoader
forURL/URLConnnection
provider lookupThe specification in thejava.netpackage and thejava.net.URL.URLconstructor describing the how protocol handler implementations are found was updated to usejava.util.ServiceLoaderinstead of the old “
java.protocol.handler.pkgs
” system property. The mechanism locates implementations of a new service type, abstract classjava.net.spi.URLStreamHandlerProvider, using the system class loader. A small specification clarification to java.net.URLStreamHandlerFactory.createURLStreamHandlerwas also required.The location of implementations of java.net.ContentHandlerFactorywas changed to use java.util.ServiceLoaderas documented injava.net.URLConnection.getContent. If that fails, the original mechanism based on core reflection is used.
Compatibility Note: Any applications setting the
java.protocol.handler.pkgs
system property will silently fail to find their protocol handlers at runtime.The enhancements associated with this change are8064924 and8064925.
Networking: Generify
URL.getContent()
&URLConnection.getContent()
The parameter type of methodsjava.net.URL.getContentandjava.net.URLConnection.getContentwas paramaterized with an unbounded wildcard (
<?>
).The enhancement associated with this change is8031326.
Networking: Add a general purpose socket option mechanism
Following the model in package
java.nio.channels
, packagejava.net
socket options may now be set via two simplegetOption()
andgetOption()
methods. The set of supported options may be retrieved with the newsupportedOptions()
method. This is the list of new methods: java.net.Socket.setOption,java.net.Socket.getOption,java.net.Socket.supportedOptions,java.net.ServerSocket.setOption,java.net.ServerSocket.getOption,java.net.ServerSocket.supportedOptions,java.net.DatagramSocket.setOption,java.net.DatagramSocket.getOption,java.net.DatagramSocket.supportedOptions, andjava.net.MulticastSocket.supportedOptions.The enhancement associated with this change is8036979.
Networking: Update
URLClassLoader.definePackage()
to expect packages to be defined per class loaderThe specification of the protectedjava.net.URLClassLoader.definePackagemethod was updated to throw ajava.lang.IllegalArgumentExceptionif the package has already been defined by this class loader.
Networking: Add
java.content.handler.pkgs
propertyThe class specification ofjava.net.ContentHandlerwas enhanced with the definition of a new system property, “
java.content.handler.pkgs
” which may be used to define locations to search for content handlers. This replaces the implementation-specific property, “sun.net.www.content
”. Adjustments to reference the new user-definable handlers and to elide references to the old system property were also required injava.net.URL.URLandjava.net.URLConnection.getContent.The enhancement associated with this change is8039470.
Networking: Ignore userinfo in
URLPermission
The class specification of java.net.URLPermissionwas modified to recognize the userinfo portion of a URL (e.g. “
username@
” in a URL) but otherwise ignore that information.The bug associated with this change is8029354.
Networking: Document support of
jar:
scheme URLs inURLClassLoader
The specifications for thejava.net.URLClassLoaderclass and thejava.net.URLClassLoader.URLClassLoaderconstructor were enhanced to declare the long-standing behaviour to accept
jar:
scheme URLs and to describe how they are interpreted.The bug associated with this change is8155770.
Networking: Specify behaviour for platforms lacking multicast support
The method specifications of java.net.MulticastSocket.joinGroup(InetAddress),java.net.MulticastSocket.joinGroup(SocketAddress,NetworkInterface), and java.nio.channels.MulticastChannel.joinwere updated to indicate that anjava.io.IOExceptionwill be thrown if invoked on a platform that does not support multicasting.
The bug associated with this change is8157166.
Networking: Enable per-protocol setting for
URLConnection
cachingNew methodsjava.net.URLConnection.getDefaultUseCachesandjava.net.URLConnection.setDefaultUseCacheswere added to support setting and retrieving of per-protocol defaults. Adjustments to reference the new methods for overriding the default value were made to the specifications of the protected fieldjava.net.URLConnection.useCaches, and the java.net.URLConnection.setUseCaches,java.net.URLConnection.getDefaultUseCaches, andjava.net.URLConnection.setDefaultUseCachesmethods.
The bug associated with this change is8163449.
Networking: Require trailing
':'
in header-namesThe class specification ofjava.net.URLPermissionand the method specification ofjava.net.URLPermission.getActionsdiffered with respect to the presence of the trailing
':'
for empty header-names. The method specification was modified to align with the class specification. The':'
may not be present.The bug associated with this change is8163482.
Networking: Support multi-release JAR files
The class specification of java.net.URLClassLoaderwas extended to include support of multi-release JAR files.
The enhancements associated with this change are8166914 and8172732.
Networking: Add Authenticator.getDefault()
The java.net.Authenticator.getDefaultmethod was added to retrieve the default authenticator.
The enhancement associated with this change is8169068.
Networking: Support per-connection authentication
Support to use HTTP to log to the same web server using different credentials was provided with two additions. A new static method,java.net.Authenticator.requestPasswordAuthentication, asks the given authenticator for a password. New method, java.net.HttpURLConnection.setAuthenticator, supplies an
Authenticator
for use in HTTP authentication.The enhancement associated with this change is8169495.
JAR & ZIP APIs
JAR & ZIP: Remove
Packer/Unpacker
property change listenersThe
java.util.jar.Pack200.{Packer,Unpacker}
addPropertyChangeListener()
andremovePropertyChangeListener()
methods were deprecated in Java SE 8 because they had a chain of dependencies that ultimately required the very largejava.desktop
module. These methods were removed in this specification.The enhancement associated with this change is8029806.
JAR & ZIP: Support Multi-Release JAR Files
The JAR file format was extended to allow a single archive containing multiple, Java-release-specific versions of class files. Multiple changes were necessary:
- A new constant,java.util.jar.Attributes.Name.MULTI_RELEASE, was added to identify multi-release JAR files.
- A new constructor,java.util.jar.JarFile.JarFile, was added.
- A new method,java.util.jar.JarFile.getVersion, was added to access the maximum version if the JAR file is processed as if it unversioned.
- A method indicating whether the JAR file is multi-release, java.util.jar.JarFile.isMultiRelease, was added.
- The class specification ofjava.util.jar.JarFile was extended.
- The specifications for the following existing methods were adjusted:java.util.jar.JarFile.getJarEntry,java.util.jar.JarFile.getEntry,java.util.jar.JarFile.entries, andjava.util.jar.JarFile.stream.
Additional details may be found inJEP 238 Multi-Release JAR Files.
The enhancements associated with this change are8132734,8150680,8165782, and8166735.
JAR & ZIP: Support CRC32C
A new classjava.util.zip.CRC32C, extending thejava.util.zip.Checksuminterface was added. Default implementations for new methods java.util.zip.Checksum.update(byte[])andjava.util.zip.Checksum.update(ByteBuffer)were added. Since the interface provides default implementations of these methods, the overrides injava.util.zip.CRC32andjava.util.zip.Adler32were removed.
The enhancement associated with this change is6321472.
JAR & ZIP: Define
Attributes
iteration orderThe class specification ofjava.util.jar.Attributeswas enhanced to guarantee that the iteration order is the order of insertion.
The bug associated with this change is8062194.
JAR & ZIP: Add
ZipEntry.{get,set}TimeLocal()
New methods java.util.zip.ZipEntry.setTimeLocalandjava.util.zip.ZipEntry.getTimeLocalwere added to avoid implicit timezone conversion between Java time (milliseconds since the beginning of the epoch) and local system time.
The enhancement associated with this change is8075526.
RMI
RMI: Add support for serialization filters
Object serialization generally provides a mechanism to filter classes and objects during deserialization. For RMI, object serialization provides a mechanism for RMI-exported objects to validate the classes expected in invocation. Two changes were necessary:
- The class specification of java.rmi.server.UnicastRemoteObject was modified to declare that exported remote objects use the serialization mechanism defined injava.io.ObjectInputFilter andjava.io.ObjectInputStream during unmarshalling and before dispatch.
- Two overloaded methods were added to provide the filter:java.rmi.server.UnicastRemoteObject.exportObject(Remote,int,ObjectInputFilter) andjava.rmi.server.UnicastRemoteObject.exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory,ObjectInputFilter)
Additional details may be found inJEP 290 Filter Incoming Serialization Data.
The enhancement associated with this change is8165261.
RMI: Update
ActivationInstantiator.newInstance()
andUnicastRemoteObject
to describe access requirementsThe specifications of thejava.rmi.activation.ActivationInstantiator.newInstancemethod and the java.rmi.server.UnicastRemoteObjectclass were updated to stipulate access requirements on packages used by
java.rmi
.The enhancement associated with this change is8044626.
RMI: Refine
RemoteObjectInvocationHandler.invoke()
The specification ofjava.rmi.server.RemoteObjectInvocationHandler.invokewas enhanced to include
finalize()
in the set of methods which require alternate handling. Since theRemoteObjectInvocationHandler
is intended for invoking remote methods and thefinalize
method is a protocol between the garbage collector and an object within a single, local virtual machine, thefinalize()
method will be ignored if the underlying method overrides it.RMI: Remove references to HTTP proxy implementation
The entire RMI HTTP proxy mechanism was deprecated in Java SE 8. Reference to this mechanism was removed to the class specification ofjava.rmi.server.RMISocketFactory.
The enhancement associated with this change is8066750.
CORBA
CORBA: Provide helper classes for IDL-generated exception classes
These four CORBA helper classes for IDL-generated exception classes were added: org.omg.CORBA.BoundsHelper,org.omg.CORBA.TypeCodePackage.BoundsHelper,org.omg.CORBA.TypeCodePackage.BadKindHelper, andorg.omg.CORBA.ORBPackage.InvalidNameHelper. These exception classes extend the serializablejava.lang.Exception; hence they require helper classes for marshalling.
The bug associated with this change is7130985.
CORBA: Extend the search algorithm for
ORB
propertiesThe specification of the search order for locating org.omg.CORBA.ORB’s “
orb.properties
” file was amended to include${java.home}/conf
.The enhancement associated with this change is8049376.
CORBA: Remove references to JDK-specific system property
References to the JDK-specific system property,
jdk.corba.allowInputStreamSubclass
, in org.omg.CORBA_2_3.portable.InputStreamandorg.omg.CORBA_2_3.portable.OutputStreamwere moved to an@implNote
.The bug associated with this change is8077395.
Security
Security: Support DRBG-based SecureRandom implementations
Three Deterministic Random Bit Generator (DRBG) mechanisms described inNIST 800-90Ar1were implemented. The following changes were applied:
- New methods were added tojava.security.SecureRandom to support additional input for seeding, reseeding, and random-bit generation as described byNIST 800-90c. This is the list of new methods:java.security.SecureRandom.getInstance(String,SecureRandomParameters),java.security.SecureRandom.getInstance(String,SecureRandomParameters, String),java.security.SecureRandom.getInstance(String,SecureRandomParameters,Provider),java.security.SecureRandom.getParameters(),java.security.SecureRandom.nextBytes(byte[],SecureRandomParameters),java.security.SecureRandom.reseed(),java.security.SecureRandom.reseed(SecureRandomParameters), andjava.security.SecureRandom.toString.
- The specification of existing constructors and methods in java.security.SecureRandom was adjusted to consolidate common information in the class description rather than individual methods and to accommodate interaction with the new methods. The following is the complete list of affected constructors and methods: java.security.SecureRandom.SecureRandom,java.security.SecureRandom.getInstance(String),java.security.SecureRandom.getInstance(String,String),java.security.SecureRandom.getInstance(String,Provider),java.security.SecureRandom.setSeed,java.security.SecureRandom.nextBytes, andjava.security.SecureRandom.generateSeed.
- A new constructor and several new methods were added tojava.security.SecureRandomSpi to support the new methods injava.security.SecureRandom. This is the list of new constructors and methods:java.security.SecureRandomSpi.SecureRandomSpi,java.security.SecureRandomSpi.engineNextBytes,java.security.SecureRandomSpi.engineReseed,java.security.SecureRandomSpi.engineGetParameters, andjava.security.SecureRandomSpi.toString.
- The specifications of an existing constructor and a few methods injava.security.SecureRandomSpi were adjusted to accommodate interaction with new capabilities. The following is the complete list of updated constructors and methods:java.security.SecureRandomSpi.SecureRandomSpi,java.security.SecureRandomSpi.engineSetSeed, andjava.security.SecureRandomSpi.engineNextBytes.
- A new marker interface,java.security.SecureRandomParameters, which is used to identify parameters injava.security.SecureRandom was added
- A new classjava.security.DrbgParameters implementingjava.security.SecureRandomParameters which specifies DRBG parameters was added.
Additional details may be found inJEP 273 DRBG-Based SecureRandom Implementations.
The feature associated with this change is 8051408.
Security: Create PKCS12 keystores by default
The default keystore type was changed from JKS, a custom, JDK-specific keystore type, toPKCS12 an extensible, standard, and widely-supported format for storing cryptographic keys. The following changes were applied:
- Three new static convenience methods were defined.java.security.KeyStore.getInstance(File,char[]) andjava.security.KeyStore.getInstance(File,KeyStore.LoadStoreParameter) load keystore object of the appropriate keystore type.java.security.KeyStore.Builder.newInstance returns a newjava.security.KeyStore.Builder object.
- In the abstract class,java.security.KeyStoreSpi, the new method,java.security.KeyStoreSpi.engineProbe, was added to probe the provided input stream to determine whether it contains a supported keystore.
- Class specification ofjava.security.KeyStore was updated to encourage applications to use the new APIs when opening existing keystores.
Additional details may be found inJEP 229 Create PKCS12 Keystores by Default.
The enhancements associated with this change are8044445 and8130800.
Security: Define an API for Datagram Transport Layer Security (DTLS)
An API for Datagram Transport Layer Security (DTLS) version 1.0 as defined by RFC 4347 and andRFC 6347 was defined with the following changes in packagejavax.net.ssl:
- The specifications of javax.net.ssl.SSLContext.getSocketFactory,javax.net.ssl.SSLContext.getServerSocketFactory,javax.net.ssl.SSLContext.createSSLEngine,javax.net.ssl.SSLContextSpi.engineGetSocketFactory, andjavax.net.ssl.SSLContextSpi.engineGetServerSocketFactory were updated throw ajava.lang.UnsupportedOperationException since
SocketFactory
andServerSocketFactory
may not be supported by the underlying DTLS implementation.- In classjavax.net.ssl.SSLEngineResult, new APIs were added to support the sequence number of TLS/DTLS records.javax.net.ssl.SSLEngineResult.SSLEngineResult initializes a new instance of this class passing the sequence number as the final parameter. javax.net.ssl.SSLEngineResult.sequenceNumber returns the sequence number of the produced or consumed SSL/TLS/DTLS record.
- A new type-safe enum element,javax.net.ssl.SSLEngineResult.HandshakeStatus.NEED_UNWRAP_AGAIN, was added to indicate that the SSLEngine needs to unwrap before handshaking may continue.
- In classjavax.net.ssl.SSLParameters, the javax.net.ssl.SSLParameters.SSLParameters constructor was updated to provide the specification for additional configuration parameters and the following new methods were added:javax.net.ssl.SSLParameters.setEnableRetransmissions javax.net.ssl.SSLParameters.getEnableRetransmissions javax.net.ssl.SSLParameters.setMaximumPacketSize and javax.net.ssl.SSLParameters.getMaximumPacketSize.
- The following classes required minor adjustments to reference DTLS whenever SSL is mentioned:javax.net.ssl.ExtendedSSLSession,javax.net.ssl.SNIServerName,javax.net.ssl.SSLEngine,javax.net.ssl.SSLParameters,javax.net.ssl.SSLSession, andjavax.net.ssl.X509ExtendedTrustManager.
Additional details may be found inJEP 219 Datagram Transport Layer Security (DTLS).
The enhancements associated with this change are8043758 and8130461.
Security: Clarify that enabled protocols may never be used
The specifications of methodsjavax.net.ssl.SSLSocket.getEnabledProtocols,javax.net.ssl.SSLEngine.getEnabledProtocols, andjavax.net.ssl.SSLServerSocket.getEnabledProtocolswere updated to declare that even if a protocol is enabled, it may never be used under some circumstances.
Security: Support the TLS Application Layer Protocol Negotiation (ALPN) Extension
Thejavax.net.sslpackage was enhanced to support the TLSApplication Layer Protocol Negotiation (ALPN) Extension (RFC 7301). This allows TLS clients and servers to use multiple application-layer protocols over the same transport-layer port. The following methods were added to enable this feature:javax.net.ssl.SSLEngine.getApplicationProtocol,javax.net.ssl.SSLEngine.getHandshakeApplicationProtocol,javax.net.ssl.SSLSocket.getApplicationProtocol,javax.net.ssl.SSLSocket.getHandshakeApplicationProtocol,javax.net.ssl.SSLParameters.getApplicationProtocols, andjavax.net.ssl.SSLParameters.setApplicationProtocols.
The following methods were added to defer the section of an application protocol until after the TLS cipher suite is known:javax.net.ssl.SSLEngine.setHandshakeApplicationProtocolSelector,javax.net.ssl.SSLEngine.getHandshakeApplicationProtocolSelector,javax.net.ssl.SSLSocket.setHandshakeApplicationProtocolSelector, andjavax.net.ssl.SSLSocket.getHandshakeApplicationProtocolSelector.
Additional details may be found inJEP 244 TLS Application-Layer Protocol Negotiation Extension
The enhancements associated with this change are8051498,8171443, and8170282.
Security: Support OCSP stapling for TLS
TLS Certificate Status Request extension (section 8 of RFC 6066) and Multiple Certificate Status Request Extension (RFC 6961) describe “OCSP Stapling” which delegates OCSP from TLS clients to the TLS server. This allows the TLS clients to reliably and efficiently meet X.509 certificate revocation requirements. Thejavax.net.ssl.ExtendedSSLSession.getStatusResponsesmethod was added to provide support for this approach.
Additional details may be found inJEP 249 OCSP Stapling for TLS
The enhancement associated with this change is8046321.
Security: Provide description of default implementation of
KeyStoreSpi.engineLoad()
An
@implSpec
was added to help developers determine whether the default implementation of java.security.KeyStoreSpi.engineLoadmust be overridden.The bug associated with this change is8130850.
Security: Expose session key &
KRB_CRED
GSS-API is the official API for krb5; however, there are cases where required data is not available through it. Several changes were necessary to provide access to the data.
- A new final class,javax.security.auth.kerberos.EncryptionKey, was added to encapsulate the EncryptionKey used in Kerberos as defined in Section 4.2.9 of Kerberos Protocol SpecificationRFC 4120.
- A new final class,javax.security.auth.kerberos.KerberosCredMessage, was added to encapsulate a Kerberos 5 KRB_CRED message as defined in Section 5.8.1 ofRFC 4120.
- Several methods in javax.security.auth.kerberos.KerberosKey were modified to throw ajava.lang.IllegalStateException, if the key is destroyed.
- The specification ofjavax.security.auth.kerberos.KerberosTicket.getSessionKey was modified to declare that the return value is of type javax.security.auth.kerberos.EncryptionKey.
The enhancement associated with this change is8043071.
Security: Generify
javax.xml.crypto
The parameters and return types injavax.xml.cryptopackage and subpackages were paramaterized. This change was motivated by a desire to reduce build warnings. During generification, the javax.xml.crypto.NodeSetDatainterface was changed to implementjava.lang.Iterable to support use in for-each loops.
The enhancement associated with this change is8046949.
Security: Allow
yes
&no
inkerb5.conf
The specification of the
krb5.conf
configuration file format in packagejavax.security.auth.kerberoswas enhanced to interpret values of “yes
” and “no
” as “true
” and “false
” respectively. These values are supported by other krb5 implementations.The enhancement associated with this change is8029995.
Security: Clarify behaviour of
null
location inCodeSource
The specification of the following constructors and methods in java.security.CodeSourcewas updated to describe expectations for
null
as either a location parameter or a location return value:java.security.CodeSource.CodeSource(URL,Certificate[]),java.security.CodeSource.CodeSource(URL,CodeSigner[]),java.security.CodeSource.getLocation,java.security.CodeSource.getCertificates, andjava.security.CodeSource.getCodeSigners.The bug associated with this change is8129972.
Security: Use
ServiceLoader
for JCE provider lookupThe class specification ofjava.security.Providerwas updated to describe how Service provider implementations are found using java.util.ServiceLoaderand loaded by the application class loader. The runtime may only add providers that have been configured for installation. A new method,java.security.Provider.configure, was added to apply the supplied configuration to this provider instance.
The enhancement associated with this change is7191662.
Security: Describe how permissions may be implied
The javax.security.auth.kerberos.ServicePermission.impliesandjavax.security.auth.kerberos.DelegationPermission.impliesmethods were modified to describe how one permission implies another.
The enhancement associated with this change is8129789.
Security: Add
@implNote
to describing how to find a preferred providerAll methods which are used to find a specific algorithm from a list of registered providers were enhanced with an
@implNote
. The note describes how the preferred provider is located. A total of 29 methods in the following packages were affected:java.security,javax.crypto,javax.net.ssl,javax.security.auth.login,javax.security.sasl,javax.xml.crypto.dsig, andjavax.xml.crypto.dsig.keyinfo.The enhancement associated with this change is8133151.
Security: Remove
ExemptionMechanism.finalize()
overrideThe protected override methodjavax.crypto.ExemptionMechanism.finalizewas removed since its presence hurts performance and it does not do anything beyond the default finalizer.
The enhancement associated with this change is8159009.
Security: Replace references to RFC 3280 with RFC 5280
All references to RFC 3280Internet X.509 Public Key Infrastructure Certificate were replaced with the updated RFC 5280Internet X.509 Public Key Infrastructure Certificate. This affectedjava.security.Key,java.security.cert.CRLReason,java.security.cert.PKIXReason,java.security.cert.TrustAnchor,java.security.cert.X509CRL,java.security.cert.X509CRLSelector,java.security.cert.X509CertSelector,java.security.cert.X509Certificate,javax.security.auth.x500.X500Principal, andjavax.security.auth.x500.
The bug associated with this change is8037550.
Security: Specify behaviour for
null
algorithm name ingetInstance()
methodsThere are 21
getInstance()
methods scattered across thejava.security,javax.crypto, andjavax.security.*
packages, typically in one of the following forms:public static AlgorithmParameterGenerator getInstance(String algorithm);
public static AlgorithmParameterGenerator getInstance(String algorithm, String provider);
public static AlgorithmParameterGenerator getInstance(String algorithm, Provider provider);
The specification of these methods was was enhanced to describe the long-standing behaviour to throw a java.lang.NullPointerExceptionwhen passed
null
as an algorithm name.The bug associated with this change is4985694.
Security: Specify behaviour of
Subject
fornull
parametersThe specification of constructorsjavax.security.auth.Subject.Subject()andjavax.security.auth.Subject.Subject(boolean,Set,Set,Set)was enhanced to specify that the sets containing the principals, public credentials, and private credentials prohibit
null
elements and all attempts to query or add anull
will throw ajava.lang.NullPointerException.The bug associated with this change is8015081.
Security: Expand set of required security algorithms
The list of required security algorithms and their associated keysizes was updated. These requirements follow recommendations by standards bodies for cryptographic operations and security protocols. The new algorithm (keysizes in parenthesis) are defined in class specifications as follows:
- java.security.AlgorithmParameterGenerator: DSA (2048), DiffieHellman (2048)
- java.security.KeyPairGenerator: DSA (2048), DiffieHellman (2048, 4096), RSA (4096)
- java.security.Signature: SHA256withDSA
- javax.crypto.Cipher: AES/GCM/NoPadding (128), AES/GCS/PKCSPadding (128)
- javax.net.ssl.SSLContext: TLSv1.1, TLSv1.2
- javax.net.ssl.TrustManagerFactory: PKIX
The enhancements associated with this change are8015388 and8172869.
Security: Remove references to the
sun.security.acl
packageThe class specification of java.security.acl.Aclwas modified to remove references to the
sun.security.acl
implementation package.The bug associated with this change is8072663.
Security: Add
URICertStoreParameters
The new class,java.security.cert.URICertStoreParameters, was added to pass parameters to
CertStore
algorithms which use information contained in a URI to retrieve certificates and CRLs.The bug associated with this change is8038084.
Security: Enhance parameter checking during
CertificateRevokedException
constructionThe specification of constructorjava.security.cert.CertificateRevokedException.CertificateRevokedExceptionwas enhanced to throw ajava.lang.ClassCastExceptionif the provided
Map
contains entries which have incorrect keys ore values.Security: Enhance parameter checking in
Signature.{update,sign}()
The specification of methodsjava.security.Signature.updateandjava.security.Signature.signwas enhanced to throw ajava.lang.IllegalAccessExceptionif the provided integer parameters would cause access beyond the expected bounds of the provided array.
Security: Add algorithm parameter to
EncodedKeySpec
and subclassesA protected constructor which includes the name of an algorithm was added to
EncodedkeySpec
and its subclasses as follows:java.security.spec.EncodedKeySpec.EncodedKeySpec,java.security.spec.PKCS8EncodedKeySpec.PKCS8EncodedKeySpec. andjava.security.spec.X509EncodedKeySpec.X509EncodedKeySpec. This algorithm may be retrieved using the new java.security.spec.EncodedKeySpec.getAlgorithmmethod.The enhancement associated with this change is8047223.
Security: Enhance specification for
DrbgParameters
of strength< 1
The specifications of java.security.DrbgParameters.instantiationandjava.security.DrbgParameters.nextByteswas modified to declare that ajava.lang.IllegalArgumentException. is thrown if the provided
strength
is less than one.The bug associated with this change is8158534.
Security: Enhance Kerberos interactions when a
SecurityManager
is presentA few changes were made to how Kerberos requests are processed when a java.lang.SecurityManageris present. The following adjustments were required:
- The specifications of the
KerberosPrincipal
constructors,javax.security.auth.kerberos.KerberosPrincipal.KerberosPrincipal(String) andjavax.security.auth.kerberos.KerberosPrincipal.KerberosPrincipal(String,int), were modified to describe behaviour when a java.lang.SecurityManager is present. They throw either a java.lang.SecurityException or ajavax.security.auth.kerberos.ServicePermission if conditions were not met.- The specification for theorg.ietf.jgss.GSSName interface was modified to indicate how to use a java.lang.SecurityManager to create a
GSSName
without providing a realm.- The class specification of javax.security.auth.kerberos.ServicePermission was modified to describe the implications of granting the permission.
- The class specification of javax.security.auth.AuthPermission was modified to indicate that reading information inside the principal or credential objects requires no additional permissions.
Security: Load
Policy
via the sytem class loaderThe specifications of java.security.Policywas modified to indicate that the system class loader is used to locate the class instead of the extension class loader provided with the now deprecated Java Extension Mechanism.
The bug associated with this change is8075706.
Security: Update
MessageDigest.isEqual()
The specification of java.security.MessageDigest.isEqualwas modified to remove the phrase “simple byte compare” and to add an
@implNote
providing details of the equality check.The bug associated with this change is8136459.
Scripting
Scripting: Use
ServiceLoader
for Engine discoveryThe specifications for javax.script.ScriptEngineFactoryand thejavax.scriptdescribing the Engine discovery mechanism were updated to replace reference to
META-INF/services
configuration files with use of the service-provider loading facility defined byjava.util.ServiceLoader.The bug associated with this change is8068398.
Scripting: Specify behaviour on
null
argument forScriptEngineFactory.getProgram()
The specification ofjavax.script.ScriptEngineFactory.getProgramwas updated to describe the long-standing behaviour to throwjava.lang.NullPointerExceptionwhen the
arguments
array or any of its elements isnull
.The bug associated with this change is8071588.
Scripting: Specify exceptional conditions for
ScriptContext.setAttribute()
The specification ofjavax.script.ScriptContext.setAttributewas updated to describe the long-standing no-op behaviour ifjavax.script.ScriptContext.GLOBAL_SCOPEis used and there is no associated global bindings.
The bug associated with this change is8071678.
JNDI
JNDI: Use
ServiceLoader
for provider lookupThe specification ofjavax.naming.spi.NamingManager.getInitialContextdescribing the how service provider implementations are found was updated to use java.util.ServiceLoader. If that fails, the original mechanism based on core reflection is used.
The enhancement associated with this change is8044627.
JNDI: Deprecate applet support to initialize context
JNDI defined a convenience mechanism to use an applet to specify all necessary properties for an javax.naming.ldap.InitialLdapContext. This mechanism has been
deprecated
. The environment hashtable should be used instead. The following changes were made:
- The constant javax.naming.Context.APPLET was deprecated.
- The class specification for javax.naming.Context was modified to remove reference to the applet mechanism and all
@see
references to theAPPLET
constant were removed.- The specifications of javax.naming.InitialContext,javax.naming.ldap.LdapContext, andjavax.naming.spi.NamingManager were updated to remove references to the applet mechanism.
The bug associated with this change is8051422.
JNDI: Remove protected
CompoundName.impl
The field
javax.naming.CompoundName.impl
was incorrectly declaredprotected
. This inaccessible implementation type was madeprivate
.The bug associated with this change is8167178.
JMX
JMX: Specify behaviour for unresolvable localhost
The specifications of the
host
parameter of javax.management.remote.JMXServiceURL.JMXServiceURL(String,String,int)andjavax.management.remote.JMXServiceURL.JMXServiceURL(String,String,int,String)were enhanced to specify that if the local hostname cannot be resolved, then it will default to the IP address of an active network interface.The bug associated with this change is 8031753.
User Interface
2D
2D: Update TextLayout.equals() specification
The specification ofjava.awt.font.TextLayout.equalswas modified to indicate that it obeys the general contract ofjava.lang.Object.equals, the long-standing behaviour. Explicit overrides of java.awt.font.TextLayout.equalsandjava.awt.font.TextLayout.hashCodewere removed since they added no value.
The bug associated with this change is 4497648.
2D: Specify SecurityException thrown by
PrinterJob.getUserName()
The specification forjava.awt.print.PrinterJob.getUserNamewas modified to describe conditions for the long-standing behaviour to throw ajava.lang.SecurityException.
The bug associated with this change is 6197099.
2D: Support font loading directly from a file or stream
TrueType font collections used to be rare or only available under limited circumstances thus, pre-existing APIs did not support them. The added methodsjava.awt.Font.createFonts(InputStream)andjava.awt.Font.createFonts(File)both return a
Font[]
of at least one element. These methods support font sources which represent a TrueType/OpenType font collection.The enhancement associated with this change is8055463.
2D: Allow for platform limitations during font rendering
The specification forjava.awt.Fontwas augmented to state that platforms limitations may prevent glyphs from being rendered with the requested properties.
The bug associated with this change is8166034.
2D: Specify
Windows.setIconImages()
behaviour for multi-resolution imagesThe specification of java.awt.Window.setIconImageswas enhanced to described how multi-resolution images are processed when an image is added to the icons list.
The bug associated with this change is8149371.
2D: Add
serialVersionUID
field to serializable types in thejavax.print.*
packagesSome serializable types in packagesjavax.print andjavax.print.attributedid not contain a
serialVersionUID
field. The requisite declaration with a value matching the historical default was added. This is the complete list of affected public classes:javax.print.DocFlavor,javax.print.PrintException,javax.print.attribute.AttributeSetUtilities, andjavax.print.attribute.UnmodifiableSetException.The bug associated with this change is8034050.
2D: Generify
javax.print.*
packagesThe return type of methodsjavax.print.AttributeException.getUnsupportedAttributesandjavax.print.attribute.standard.DialogTypeSelection.getCategorywere paramaterized. This change was motivated by a desire to reduce build warnings.
The bug associated with this change is8042864.
2D: Add
Font.textRequiresLayout()
A new method, java.awt.Font.textRequiresLayout, was added to indicate whether any part of the specified text is from a complex script which would require special processing to render correctly. This method is a replacement for the unsupported, internal
sun.font.FontUtilities.isComplexCharCode()
method.The enhancement associated with this change is8146324.
2D: Provide explicit specification for methods in
AbstractMultiResolutionImage
The specification describing the long-standing behaviour of five methods injava.awt.image.AbstractMultiResolutionImagewas provided. The new specification overrides the original specification inherited from java.awt.Image. This is the complete list of affected methods:java.awt.image.AbstractMultiResolutionImage.getWidth,java.awt.image.AbstractMultiResolutionImage.getHeight, java.awt.image.AbstractMultiResolutionImage.getSource, java.awt.image.AbstractMultiResolutionImage.getGraphics, andjava.awt.image.AbstractMultiResolutionImage.getProperty.
The bug associated with this change is8138771.
2D: Update value of
OpenType.TAG_OPBD
The value of constantjava.awt.font.OpenType.TAG_OPBDwas incorrectly assigned to the same value asjava.awt.font.OpenType.TAG_MORT. The correct value,
0x6F70626UL
, is now used.The bug associated with this change is8077584.
2D: Provide multi-resolution image support on HiDPI displays
A set of images with different resolutions may be encapsulated into a single multi-resolution image for HiDPI displays. The new interfacejava.awt.image.MultiResolutionImagedefines basic operations for a set of images at various resolutions. The classes java.awt.image.AbstractMultiResolutionImageandjava.awt.image.BaseMultiResolutionImageenable rapid creation of a multi-resolution image given a series of images. New image resolution variant hints control which image should be selected for image drawing:java.awt.RenderingHints.KEY_RESOLUTION_VARIANT,java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_DEFAULT,java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_BASE,java.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_SIZE_FIT, andjava.awt.RenderingHints.VALUE_RESOLUTION_VARIANT_DPI_FIT. A naming conventions for the scaled images was defined in java.awt.SplashScreen.
The enhancements associated with this change are8029339 and8151787.
2D: Add
ColorModel*.{equals,hashCode}()
java.awt.image.ColorModeland its subclasses either did not override
equals()
and/orhashCode()
or provided incomplete specification. These deficiencies were remedied as follows:
- Injava.awt.image.ColorModel,java.awt.image.ColorModel.equals, andjava.awt.image.ColorModel.hashCode, overrides were added.
- Injava.awt.image.IndexColorModel,java.awt.image.IndexColorModel.equals, andjava.awt.image.IndexColorModel.hashCode, overrides were added.
- Injava.awt.image.PackedColorModel, an override of java.awt.image.PackedColorModel.hashCode was added.
- Injava.awt.image.ComponentColorModel, the specification ofjava.awt.image.ComponentColorModel.equals was updated and an override of java.awt.image.ComponentColorModel.hashCode was added.
The bug associated with this change is7107905.
2D: Specify ImageIO behaviour for failure to create streams
The conditions under which ajava.io.IOExceptionmay be thrown were extended to include failure to create the required javax.imageio.spi.ImageInputStreamSpiorjavax.imageio.spi.ImageOutputStreamSpi. The following is the list of affected methods:javax.imageio.ImageIO.read(File),javax.imageio.ImageIO.read(InputStream),javax.imageio.ImageIO.read(URL),javax.imageio.ImageIO.write(RenderedImage,String,File), and javax.imageio.ImageIO.write(RenderedImage,String,OutputStream).
The bug associated with this change is8044289.
2D: Update
ImageReader.getRawImageType()
The specification of methodjavax.imageio.ImageReader.getRawImageType, was updated to describe the return value when a close match is not available.
The bug associated with this change is8143562.
2D: Generify
javax.imageio.spi
The return types of methods in javax.imageio.spi.ImageReaderSpiandjavax.imageio.spi.ImageWriterSpiwere paramaterized. This change was motivated by a desire to reduce build warnings.
The enhancement associated with this change is8035487.
2D: Add
serialVersionUID
field to serializable types in thejavax.imageio.*
packagesSome serializable types injavax.imageio,javax.imageio.metadata, andjavax.imageio.spidid not contain a
serialVersionUID
field. The requisite declaration with a value matching the historical default was added. This is the complete list of affected public classes:javax.imageio.IIOException,javax.imageio.metadata.IIOInvalidTreeException, andjavax.imageio.metadata.IIOMetadataNode.The bug associated with this change is8033616.
2D: Enhance Accessibility API to use service provider mechanism
The specification ofjava.awt.Toolkit.getDefaultToolkitwas modified to locate a service provider implementation via the “
javax.accessibility.assistive_technologies
” system property. Existing accessibility provider implementations which do not use the service provider mechanism will continue to be located and function as if the classes are on the classpath.A new abstract class,javax.accessibility.AccessibilityProvider, was added to provide mappings from the platform-specific accessibility APIs to the java Accessibility API.
The enhancement associated with this change is 8055160.
AWT
AWT: Define APIs for platform-specific desktop features
Support for accessing platform-specific desktop features such as interacting with a task bar or dock, or listening for system or application events was added via the following changes:
- New packagejava.awt.desktop contains a series of classes and interfaces which may be used to detect and process events. For instance, thejava.awt.desktop.AppForegroundListener interface contains methods which are invoked when the application moves to and from the foreground and events of typejava.awt.desktop.AppForegroundEvent are sent. This package replaces internal APIs originally defined in the
com.apple.{eawt,eio}
packages.- The new classjava.awt.Desktop and the type-safe enumjava.awt.Desktop.Action support operations such as launching the user’s default browser to show a specified URI or launching the user’s default mail client.
- The new classjava.awt.Taskbar and type-safe enumsjava.awt.Taskbar.Feature, and java.awt.Taskbar.State, support interactions with the platform-specific system task area.
Additional details may be found inJEP 272 Platform-Specific Desktop Features.
The enhancements associated with this change are8143227,8164536, and8166594.
AWT: Remove reference to
awt.toolkit
system propertySince peers are not exported from the
java.desktop
module as a result of 8037739, it is no longer possible to create a customjava.awt.Toolkit. The system property “awt.toolkit
” was the mechanism to set this customization; thus, it is no longer needed. Reference to this historical system property was removed from java.awt.Toolkit.getDefaultToolkit.The bug associated with this change is8130478.
AWT: Deprecate
AWTKeyStroke.registerSubclass()
Analysis revealed that this method was added for historical reasons which are no longer valid as of Java 2 SE 5.0 (see8133453). Since the method is not useful for applications, there is no recommended alternative. Invocation of this method has no effect.
Deprecation Note: While there is currently no intention to remove this method in a future release; use of it is strongly discouraged. An intent to remove this API may declared in the future.
The bug associated with this change is8133453.
AWT: Deprecate JDK 1.0 era constants in
java.awt.event
Thejava.awt.event.InputEventcontained constants following two different naming conventions: the JDK 1.0 naming convention and the extended naming convention introduced in JDK 1.4. Thus, for every value, there were two possible names. The old constants and related methods were deprecated. This is the complete list of affected APIs:java.awt.event.InputEvent.getModifiersExText,java.awt.event.InputEvent.getModifiers,java.awt.AWTEvent.AWTEvent,java.awt.Event,java.awt.event.InputEvent.ALT_GRAPH_MASK,java.awt.event.InputEvent.ALT_MASK,java.awt.event.InputEvent.BUTTON1_MASK,java.awt.event.InputEvent.BUTTON2_MASK,java.awt.event.InputEvent.BUTTON3_MASK,java.awt.event.InputEvent.CTRL_MASK,java.awt.event.InputEvent.META_MASK, andjava.awt.event.InputEvent.SHIFT_MASK.
Deprecation Note: While there is currently no intention to remove these APIs in a future release; use of them is strongly discouraged. An intent to remove this API may declared in the future.
The bug associated with this change is8143077.
AWT: Improve HeadlessException specification
The specification forjava.awt.HeadlessException, introduced in JDK 1.4 was minimal. Specification describing the long-standing behaviour was added to the class description and all methods.
The bug associated with this change is8016313.
AWT: Resolve
Toolkit.isDynamicLayoutActive()
contradictionThe specification forjava.awt.Toolkit.isDynamicLayoutActivewas updated to describe the relationship between this method andjava.awt.Toolkit.isDynamicLayoutSet.
The bug associated with this change is8027324.
AWT: Generify
ParameterBlock.getParamClasses
The return type of methodjava.awt.image.renderable.ParameterBlock.getParamClasseswas paramaterized with an unbounded wildcard (
<?>
). This change was motivated by a desire to reduce build warnings.The bug associated with this change is8039109.
AWT: Add missing specification in
java.awt
packageA number of
@param
,@return
, and@throws
declarations were missing from many methods in thejava.awtpackage. Specification describing the long-standing behaviour was added. In many cases, the new specification merely echos documentation available elsewhere in the method’s specification. Forty-one classes were affected.The bug associated with this change is8043967.
AWT: Add
Component.setMixingCutoutShape()
The methodjava.awt.Component.setMixingCutoutShapewas added to to set a ‘mixing-cutout’ shape for lightweight components only.
The bug associated with this change is8173409.
AWT: Remove references to implementation-specific configuration files
The specification of methodjava.awt.Toolkit.getSystemClipboardwas updated to remove reference to the implementation-specific configuration files “
flavormap.properties
” and “AWT.DnD.flavorMapFileURL
”. All other references to these files were eliminated in Java SE 8 as part ofJEP 162 Prepare for Modularization.The enhancement associated with this change is8047336.
AWT: Specify behaviour of
null
input forCanvas
constructorThe constructor specification of java.awt.Canvas.Canvaswas refined to describe long-standing behaviour on
null
. When invoked withnull
, the default java.awt.GraphicsConfigurationwill be used to construct the new java.awt.Canvas.The bug associated with this change is4703110.
AWT: Specify when
null
will be returned byComponent.create*Image()
The specifications for the return value ofjava.awt.Component.createImage,java.awt.Component.createVolatileImage(int,int), andjava.awt.Component.createVolatileImage(int,int,ImageCapabilities)were updated to replace a weak statement describing when
null
may be returned. The new specification describes the long-standing behaviour to returnnull
if component is not displayable or is headless.The bug associated with this change is6815345.
AWT: Extend
FocusEvent
to include a “cause”Thejava.awt.event.FocusEventclass was enhanced to provide information describing which action caused the event. This information may give a client the ability to provide a more specific response to a focus event. Several changes were necessary:
- A new nested type-safe enum,java.awt.event.FocusEvent.Cause, containing constants for 11 possible conditions was added.
- A new constructor,java.awt.event.FocusEvent.FocusEvent, may be used to set the cause.
- A new method,java.awt.event.FocusEvent.getCause, was introduced to retrieve the immutable cause.
- New cause-aware methods were added to parallel existing focus request methods injava.awt.Component:java.awt.Component.requestFocus(FocusEvent.Cause) java.awt.Component.requestFocus(Boolean,FocusEventCause) java.awt.Component.requestFocusInWindow.
The enhancements associated with this change are8080395 and8154434.
AWT: Clarify platform-dependence of tooltip in
TrayIcon
The display of tooltips for tray icons may not be supported by all platforms. The specification for java.awt.TrayIcon.TrayIcon(Image,String),java.awt.TrayIcon.TrayIcon(Image,String,PopupMenu), andjava.awt.TrayIcon.setToolTipwas updated to reflect this long-standing platform-dependent behaviour.
The bug associated with this change is8117886.
AWT: Declare platform-dependence of
FileDialog
titleThe display of a user-specified title in a java.awt.FileDialogmay not be supported by all platforms; hence the specification was relaxed to allow this behaviour. This is the complete list of affected constructors and methods:java.awt.FileDialog.FileDialog(Frame),java.awt.FileDialog.FileDialog(Frame,String),java.awt.FileDialog.FileDialog(Frame,String,int),java.awt.FileDialog.FileDialog(Dialog),java.awt.FileDialog.FileDialog(Dialog,String), andjava.awt.FileDialog.setTitle.
AWT: Extend
Component.FlipBufferStrategy
to support appletsWhen applets requested a flip buffer strategy using thejava.awt.Component.FlipBufferStrategynested class, ajava.lang.ClassCastExceptionwas thrown because applets were not supported. Changes to the specification for the class and constructor were required.
The bug associated with this change is8130390.
AWT: Remove
BorderLayout
reference to historical releaseThe class specification of java.awt.BorderLayoutreferenced a historical release of the JDK with the assumption that it was the current release. Since the specification for a given release is expected to document the current release, a specific version number is unnecessary. The reference was removed.
The bug associated with this change is8153184.
AWT: Define new line handling in
TextField
The specifications of java.awt.TextField.TextField(String),java.awt.TextField.TextField(String,int), andjava.awt.TextField.setTextwere updated to document the long-standing behaviour of replacing all EOL and LF characters with a space.
The bugs associated with this change are8145284 and8160056.
AWT: Add
serialVersionUID
field to serializable types in thejava.awt.*
packagesSome serializable types injava.awt.color,java.awt.geom,java.awt.image, andjava.awt.printdid not contain a
serialVersionUID
field. The requisite declaration with a value matching the historical default was added. This is the complete list of affected public classes:java.awt.color.CMMException,java.awt.color.ProfileDataException,java.awt.geom.IllegalPathStateException,java.awt.geom.NoninvertibleTransformException,java.awt.image.ImagingOpException,java.awt.image.RasterFormatException,java.awt.image.renderable.ParameterBlock,java.awt.print.PrinterAbortException, andjava.awt.print.PrinterException.The bug associated with this change is8033526.
2D: Enhance the specification for
ServiceUI.printDialog()
parametersThe specifications of the
x
andy
parameters of javax.print.ServiceUI.printDialogwere enhanced to declare that the screen coordinates are relative to the origin of the providedjava.awt.GraphicsConfiguration.The bug associated with this change is6212751.
Swing
Swing: Generify
javax.swing.text
packageMethods in package javax.swing.text were paramaterized. This change was motivated by a desire to reduce build warnings. This is the complete list of affected public methods:javax.swing.text.InternationalFormatter.setMinimum,javax.swing.text.InternationalFormatter.getMinimum,javax.swing.text.InternationalFormatter.setMaximum, andjavax.swing.text.InternationalFormatter.getMaximum.
The bugs associated with this change are8043549 and8055059.
Swing: Generify
javax.swing.*
packagesMethods in package javax.swing were paramaterized. This change was motivated by a desire to reduce build warnings. This is the complete list of affected public methods:javax.swing.DefaultCellEditor.DefaultCellEditor,javax.swing.JTable.JTable,javax.swing.SpinnerDateModel.SpinnerDateModel,javax.swing.SpinnerDateModel.setStart,javax.swing.SpinnerDateModel.getStart,javax.swing.SpinnerDateModel.setEnd,javax.swing.SpinnerDateModel.getEnd,javax.swing.SpinnerNumberModel.SpinnerNumberModel,javax.swing.SpinnerNumberModel.setMinimum,javax.swing.SpinnerNumberModel.getMinimum,javax.swing.SpinnerNumberModel.setMaximum,javax.swing.SpinnerNumberModel.getMaximum,javax.swing.event.RowSorterEvent.RowSorterEvent(RowSorter),javax.swing.event.RowSorterEvent.RowSorterEvent(RowSorter,Type,int[]),javax.swing.event.RowSorterEvent.getSource,javax.swing.table.DefaultTableModel.DefaultTableModel(Vector,int),javax.swing.table.DefaultTableModel.DefaultTableModel(Vector,Vector),javax.swing.table.DefaultTableModel.getDataVector,javax.swing.table.DefaultTableModel.setDataVector,javax.swing.table.DefaultTableModel.addRow,javax.swing.table.DefaultTableModel.insertRow,javax.swing.table.DefaultTableModel.setColumnIdentifiers,javax.swing.table.DefaultTableModel.addColumn,javax.swing.tree.DefaultMutableTreeNode.children,javax.swing.tree.DefaultMutableTreeNode.preorderEnumeration,javax.swing.tree.DefaultMutableTreeNode.postorderEnumeration,javax.swing.tree.DefaultMutableTreeNode.breadthFirstEnumeration,javax.swing.tree.DefaultMutableTreeNode.depthFirstEnumeration, andjavax.swing.tree.DefaultMutableTreeNode.pathFromAncestorEnumeration.
The bugs associated with this change are8043550,8054360, and8055254.
Swing: Generify
javax.swing.*
packagesMethods in packagesjavax.swing.text,javax.swing.plaf,javax.swing.plaf.basic,javax.swing.plaf.metal,javax.swing.plaf.multi,javax.swing.plaf.nimbus, andjavax.swing.plaf.synthwere paramaterized. This change was motivated by a desire to reduce build warnings.
The bug associated with this change is8043548.
Swing: Add
JComponent.getUI()
Methodjavax.swing.JComponent.getUIwas added to return the look and feel delegate that renders the component. The declaration includes thejava.beans.Transientannotation indicating that this method may be ignored by all subclasses ofjava.beans.Encoder.
The enhancements associated with this change are4339584 and8131754.
Swing: Add
JTableHeader.getPreferredSize()
Override methodjavax.swing.table.JTableHeader.getPreferredSizewas added to return the preferred size of the table header. This override of
JComponent.getPreferredSize()
compensates for cases when the user manually sets the preferred size.The bug associated with this change is4473075.
Swing: Revise
TableColumn.addPropertyChangeListener()
The specification of javax.swing.table.TableColumn.addPropertyChangeListenerwas re-written to document existing behaviour and remove references to invalid APIs.
The bug associated with this change is4849595.
Swing: Define behavior for
null
parameter inJInternalFrame.setLayer()
The specification of methodjavax.swing.JInternalFrame.setLayerwas updated to match the long-standing behaviour to throw ajava.lang.NullPointerExceptionwhen the provider parameter is
null
.The bug associated with this change is6206439.
Swing: Provide missing specification for methods in
javax.swing.*
packagesThe specifications of 45 methods injavax.swing.borderpackage and classesjavax.swing.colorchooser.AbstractColorChooserPanel,javax.swing.filechooser.FileFilter,javax.swing.filechooser.FileSystemView, andjavax.swing.filechooser.FileViewwere enhanced with the addition of
@param
and@return
tags to describe the methods expected parameters and return value.The bugs associated with this change are8039966 and8040893.
Swing: Add
{JLayer,LayerUI}.imageUpdate()
New methodjavax.swing.JLayer.imageUpdatewas added to the final
JLayer
class. It delegate to javax.swing.plaf.LayerUI.imageUpdatewhich may be used to control animated gif repainting.Swing: Add ability to disable
JColorChooser
transparency controlsSupport to enable and disable transparency controls was added with methods javax.swing.colorchooser.AbstractColorChooserPanel.setColorTransparencySelectionEnabledandjavax.swing.colorchooser.AbstractColorChooserPanel.isColorTransparencySelectionEnabledwhich set and query the controls respectively, constantjavax.swing.colorchooser.AbstractColorChooserPanel.TRANSPARENCY_ENABLED_PROPERTYwhich indicates that the color transparency may be selected, and method overridejavax.swing.JColorChooser.showDialogwhich shows the modal color-chooser dialog with color transparency selection optionally enabled.
The enhancement associated with this change is8051548.
Swing: Redesign
JLayer.{get,set}Border()
The javax.swing.JLayer.setBorderandjavax.swing.JLayer.getBordermethods were redesigned to delegate to the
JLayer
’s view component. Prior to this change, they always threwjava.lang.IllegalArgumentException.Swing: Add missing specification to
javax.swing.text.html
The specification of over 200 methods and fields in javax.swing.text.htmlwas either entirely missing or incomplete. Specification documenting the long-standing behaviour was added to the following classes:javax.swing.text.html.BlockView,javax.swing.text.html.CSS,javax.swing.text.html.FormSubmitEvent,javax.swing.text.html.HTML,javax.swing.text.html.HTMLDocument,javax.swing.text.html.HTMLEditorKit,javax.swing.text.html.HTMLWriter,javax.swing.text.html.ImageView,javax.swing.text.html.InlineView,javax.swing.text.html.MinimalHTMLWriter,javax.swing.text.html.Option,javax.swing.text.html.ParagraphView, andjavax.swing.text.html.StyleSheet.
The bug associated with this change is8046446.
Swing: Add missing specification to
javax.swing.plaf.basic
The specification of over 100 methods and fields in javax.swing.plaf.basicwas either entirely missing or incomplete. Specification documenting the long-standing behaviour was added to the following classes:javax.swing.plaf.basic.BasicButtonUI,javax.swing.plaf.basic.BasicComboBoxUI,javax.swing.plaf.basic.BasicComboPopup,javax.swing.plaf.basic.BasicDesktopIconUI,javax.swing.plaf.basic.BasicLabelUI,javax.swing.plaf.basic.BasicScrollPaneUI,javax.swing.plaf.basic.BasicSplitPaneDivider, andjavax.swing.plaf.basic.BasicTableUI.
The bug associated with this change is8049704.
sound
Sound: Add
serialVersionUID
field to serializable types in thejavax.imageio.*
packagesSome serializable types injavax.sound.midiandjavax.sound.sampleddid not contain a
serialVersionUID
field. The requisite declaration with a value matching the historical default was added. This is the complete list of affected public classes:javax.sound.midi.InvalidMidiDataException,javax.sound.midi.MidiUnavailableException,javax.sound.sampled.AudioPermission,javax.sound.sampled.LineEvent, javax.sound.sampled.LineUnavailableException, andjavax.sound.sampled.UnsupportedAudioFileException.The bug associated with this change is8034046.
Sound: Specify behavior on
null
argument for methods in packagejavax.sound.midi.*
The specification of methods in
javax.sound.midi
andjavax.sound.midi.spi
was updated to describe the long-standing behaviour to throwjava.lang.NullPointerExceptionwhen passednull
. This is the complete list of affected methods:javax.sound.midi.MidiSystem.getMidiDevice,javax.sound.midi.MidiSystem.getSoundbank(InputStream),javax.sound.midi.MidiSystem.getSoundbank(URL),javax.sound.midi.MidiSystem.getSoundbank(File),javax.sound.midi.MidiSystem.getMidiFileFormat(InputStream),javax.sound.midi.MidiSystem.getMidiFileFormat(URL),javax.sound.midi.MidiSystem.getMidiFileFormat(File),javax.sound.midi.MidiSystem.getSequence(InputStream),javax.sound.midi.MidiSystem.getSequence(URL),javax.sound.midi.MidiSystem.getSequence(File),javax.sound.midi.MidiSystem.getMidiFileTypes,javax.sound.midi.MidiSystem.isFileTypeSupported,javax.sound.midi.MidiSystem.write(Sequence,int,File),javax.sound.midi.MidiSystem.write(Sequence,int,OutputStream),javax.sound.midi.spi.SoundbankReader.getSoundbank(InputStream),javax.sound.midi.spi.SoundbankReader.getSoundbank(File),javax.sound.midi.spi.SoundbankReader.getSoundbank(URL),javax.sound.midi.spi.MidiFileWriter.getMidiFileTypes,javax.sound.midi.spi.MidiFileWriter.isFileTypeSupported,javax.sound.midi.spi.MidiFileWriter.write(Sequence,int,OutputStream),javax.sound.midi.spi.MidiFileWriter.write(Sequence,int,File),javax.sound.midi.spi.MidiFileReader.getMidiFileFormat(InputStream),javax.sound.midi.spi.MidiFileReader.getMidiFileFormat(URL),javax.sound.midi.spi.MidiFileReader.getMidiFileFormat(File),javax.sound.midi.spi.MidiFileReader.getSequence(InputStream),javax.sound.midi.spi.MidiFileReader.getSequence(URL),javax.sound.midi.spi.MidiFileReader.getSequence(File),javax.sound.midi.spi.MidiDeviceProvider.isDeviceSupported, andjavax.sound.midi.spi.MidiDeviceProvider.getDevice.The bug associated with this change is8143909.
Sound: Specify behaviour on
null
argument for methods in packagejavax.sound.sampled
The specification of methods in javax.sound.sampledandjavax.sound.sampled.spiwas updated to consistently throwjava.lang.NullPointerExceptionwhen passed
null
. The only exception to this isjavax.sound.sampled.spi.MixerProvider.getMixerwhich returns the default mixer for anull
parameter. This is the complete list of affected methods:javax.sound.sampled.AudioSystem.getTargetEncodings(AudioFormat),javax.sound.sampled.AudioSystem.getTargetEncodings(AudioFormat.Encoding),javax.sound.sampled.AudioSystem.isConversionSupported,javax.sound.sampled.AudioSystem.getAudioInputStream,javax.sound.sampled.AudioSystem.getTargetFormats,javax.sound.sampled.AudioSystem.isConversionSupported,javax.sound.sampled.AudioSystem.getAudioInputStream,javax.sound.sampled.AudioSystem.getAudioFileFormat(InputStream),javax.sound.sampled.AudioSystem.getAudioFileFormat(File),javax.sound.sampled.AudioSystem.getAudioInputStream(InputStream),javax.sound.sampled.AudioSystem.getAudioInputStream(URL),javax.sound.sampled.AudioSystem.getAudioInputStream(File), javax.sound.sampled.AudioSystem.isFileTypeSupported,javax.sound.sampled.AudioSystem.getAudioFileTypes,javax.sound.sampled.AudioSystem.isFileTypeSupported,javax.sound.sampled.AudioSystem.write(AudioInputStream,AudioFileFormatType,OutputStream),javax.sound.sampled.AudioSystem.write(AudioInputStream,AudioFileFormat.Type,File),javax.sound.sampled.spi.AudioFileReader.getAudioFileFormat(InputStream),javax.sound.sampled.spi.AudioFileReader.getAudioFileFormat(URL),javax.sound.sampled.spi.AudioFileReader.getAudioFileFormat(File), javax.sound.sampled.spi.AudioFileReader.getAudioInputStream(InputStream),javax.sound.sampled.spi.AudioFileReader.getAudioInputStream(URL),javax.sound.sampled.spi.AudioFileReader.getAudioInputStream(File), javax.sound.sampled.spi.AudioFileWriter.isFileTypeSupported,javax.sound.sampled.spi.AudioFileWriter.getAudioFileTypes,javax.sound.sampled.spi.AudioFileWriter.isFileTypeSupported,javax.sound.sampled.spi.AudioFileWriter.write(AudioInputStream,AudioFileFormat.Type,OutputStream),javax.sound.sampled.spi.AudioFileWriter.write(AudioInputStream,AudioFileFormat.Type,File),javax.sound.sampled.spi.FormatConversionProvider.isSourceEncodingSupported,javax.sound.sampled.spi.FormatConversionProvider.isTargetEncodingSupported,javax.sound.sampled.spi.FormatConversionProvider.getTargetEncodings,javax.sound.sampled.spi.FormatConversionProvider.isConversionSupported,javax.sound.sampled.spi.FormatConversionProvider.getTargetFormats,javax.sound.sampled.spi.FormatConversionProvider.isConversionSupported,javax.sound.sampled.spi.FormatConversionProvider.getAudioInputStream(AudioFormat.Encoding,AudioInputStream),javax.sound.sampled.spi.FormatConversionProvider.getAudioInputStream(AudioFormat,AudioInputStream),javax.sound.sampled.spi.MixerProvider.isMixerSupported, andjavax.sound.sampled.spi.MixerProvider.getMixer.The bug associated with this change is8135100.
Sound: Enhance
AudioInputStream.skip()
The specification for javax.sound.sampled.AudioInputStream.skipwas enhanced to describe long-standing behaviour similar to javax.sound.sampled.AudioInputStream.read. The method skips an integral number of frames. If the passed parameter is not an integral number of frames, a maximum computed value will be skipped.
The bug associated with this change is8132782.
XML Parsing
XML Parsing
XML Parsing: Support XML Catalog
A standard XML Catalog API that supportsOASIS XML Catalogs standard, v1.1was provided. The API defines catalog and catalog-resolver abstractions which may be used with the XML parsing processors that accept resolvers via the addition of the javax.xml.catalogpackage containing the following classes:
- The interface,javax.xml.catalog.Catalog, representing the semantics of OASIS Open Catalog files. It can locate replacement text for external entities and alternate URI references for a resource.
- The interfacejavax.xml.catalog.CatalogResolver which consolidates these existing XML resolvers: org.xml.sax.EntityResolver (SAX),javax.xml.stream.XMLResolver (StAX),org.w3c.dom.ls.LSResourceResolver (DOM LS), andjavax.xml.transform.URIResolver (Schema Validation and Transform).
- The classjavax.xml.catalog.CatalogManager which manages the creation of XML Catalogs and Catalog Resolvers.
- The class javax.xml.catalog.CatalogFeatures which holds a collection of features and properties.
- The nested classjavax.xml.catalog.CatalogFeatures.Builder which is used to build ajavax.xml.catalog.CatalogFeatures object.
- The nested type-safe enum, javax.xml.catalog.CatalogFeatures.Feature, which represents the set of Catalog Features.
- The exception,javax.xml.catalog.CatalogException, is a java.lang.RuntimeException which is used for reporting errors which may occur while reading a Catalog or resolving resources.
Integration with the XML parsing processors was provided with the addition of the new constantjavax.xml.XMLConstants.USE_CATALOG.
Additional details may be found inJEP 268 XML Catalogs.
The enhancements associated with this change are8081248, 8144966,8163232,8171243, and8158084.
XML Parsing: Specify behaviour of XPath for
null
contextThe class specification forjavax.xml.xpath.XPathwas aligned with the specification forjavax.xml.xpath.XPath.evaluatewhich defines the long-standing behaviour for a
null
context.The bug associated with this change is6211561.
XML Parsing: Deprecate
XMLReaderFactory
The classorg.xml.sax.helpers.XMLReaderFactoryincluding both of its static methods,org.xml.sax.helpers.XMLReaderFactory.createXMLReader()andorg.xml.sax.helpers.XMLReaderFactory.createXMLReader(String), were deprecated in favor of javax.xml.parsers.SAXParserFactorywhich conforms to the specification of the service-provider loading facility defined by java.util.ServiceLoader. The deprecated class is legacy and has not been updated since 2004.
Deprecation Note: While there is currently no intention to remove this class in a future release; use of it is strongly discouraged. An intent to remove this API may declared in the future.
The bug associated with this change is8152912.
XML Parsing: Update references to configuration files
All references to location of the “
jaxp.properties
” file which is used by factory methods to locate service provider implementations were changed from normative to non-normative. This is the complete list of affected classes:javax.xml.datatype.DatatypeFactory,javax.xml.parsers.DocumentBuilderFactory,javax.xml.parsers.SAXParserFactory,javax.xml.stream.XMLEventFactory,javax.xml.stream.XMLInputFactory,javax.xml.stream.XMLOutputFactory,javax.xml.transform.TransformerFactory,javax.xml.validation.SchemaFactory, andjavax.xml.xpath.XPathFactory.The enhancement associated with this change is8049378.
XML Parsing: Add
*Source.isEmpty()
A convenience method,
isEmpty()
, was added to every*Source
class to determine whether all inputs are empty for the givenSource
object. This is the complete list of new methods:javax.xml.transform.Source.isEmpty,javax.xml.transform.dom.DOMSource.isEmpty,javax.xml.transform.sax.SAXSource.isEmpty,javax.xml.transform.stax.StAXSource.isEmpty,javax.xml.transform.stream.StreamSource.isEmpty, andorg.xml.sax.InputSource.isEmpty.The enhancement associated with this change is8144967.
XML Parsing: Add
*Factory.newDefault{Instance,Factory}()
New public static methods to create a new instance of the system-default implementation were added to all XML parsing factories. This is the complete list of new methods: javax.xml.datatype.DatatypeFactory.newDefaultInstance,javax.xml.parsers.DocumentBuilderFactory.newDefaultInstance,javax.xml.parsers.SAXParserFactory.newDefaultInstance,javax.xml.stream.XMLEventFactory.newDefaultFactory,javax.xml.stream.XMLInputFactory.newDefaultFactory,javax.xml.stream.XMLOutputFactory.newDefaultFactory,javax.xml.transform.TransformerFactory.newDefaultInstance,javax.xml.validation.SchemaFactory.newDefaultInstance, and javax.xml.xpath.XPathFactory.newDefaultInstance.
The enhancement associated with this change is8169778.
XML Parsing: Support complete DOM API
Two packages fromJSR 206: Java API for XML Processing (JAXP) were added, thus providing support for all DOM APIs. Theorg.w3c.dom.rangespackage contains interfaces supporting dynamic document traversal and identification of a content’s range. The org.w3c.dom.traversalpackage contains interfaces supporting document node traversal.
The enhancement associated with this change is8023276.
XML Parsing: Add
ElementTraversal
The new interface,org.w3c.dom.ElementTraversal, defined by the W3CElement Traversal Specification was added It provides a set of read-only attributes which allow navigation between document elements.
The enhancement associated with this change is8135283.
XML Parsing: Generify
javax.xml*
packagesMethods in packagesjavax.xml.stream,javax.xml.stream.events, andjavax.xml.stream.utilwere paramaterized. This change was motivated by a desire to reduce build warnings.
The bug associated with this change is8170556.
XML Parsing: Update the
org.w3c.dom
package specificationA updated description of the supported JAXP specification was provided, including references to DOM Level 3 in theorg.w3c.dompackage specification.
The bug associated with this change is8037948.
XML Parsing: Support any data type
Thejavax.xml.xpathpackage was extended to support any data type in addition to previously defined explicit types. Several changes were necessary:
- The new interfacejavax.xml.xpath.XPathEvaluationResult and the type-safe enumjavax.xml.xpath.XPathEvaluationResult.XPathResultType were defined to represent the result of an evaluation an XPath expression when the return type is unknown.
- The new interfacejavax.xml.xpath.XPathNodes was introduced to represent a set of nodes selected by a location path.
- Injavax.xml.xpath.XPath, the specifications for the following existing methods was adjusted:javax.xml.xpath.XPath.evaluateExpression(String,Object),javax.xml.xpath.XPath.evaluateExpression(String,Object,Class),javax.xml.xpath.XPath.evaluateExpression(String,InputSource), andjavax.xml.xpath.XPath.evaluateExpression(String,InputSource,Class).
- Injavax.xml.xpath.XPathExpression, the specifications for existing methods was adjusted and methods javax.xml.xpath.XPathExpression.evaluateExpression(Object),javax.xml.xpath.XPathExpression.evaluateExpression(Object,Class),javax.xml.xpath.XPathExpression.evaluateExpression(InputSource), andjavax.xml.xpath.XPathExpression.evaluateExpression(InputSource,Class).
The bug associated with this change is8054196.
XML Parsing: Specify exceptional conditions for
XPath
The class specification ofjavax.xml.xpath.XPathwas updated to describe the long-standing behaviour to throw ajavax.xml.xpath.XPathExpressionExceptionwhen the value is
null
and the operation has no dependency on the context.The bug associated with this change is6211561.
STaX
STaX: Update
XML{Event,Stream}?Reader
conditions forSTART_DOCUMENT
returnThe class specification for javax.xml.stream.XMLStreamReaderwas updated to return
START_DOCUMENT
whenever XML document processing begins without an XML declaration. Further adjustments were necessary for javax.xml.stream.XMLStreamReader.getEventTypeandjavax.xml.stream.XMLStreamReader.hasName.Missing
@return
statement were added to document existing behaviour for the following methods:javax.xml.stream.XMLStreamReader.getLocation,javax.xml.stream.XMLStreamReader.getTextLength,javax.xml.stream.XMLStreamReader.getTextStart,javax.xml.stream.XMLEventReader.nextEvent.javax.xml.stream.XMLEventReader.peek,javax.xml.stream.XMLEventReader.getElementText, andjavax.xml.stream.XMLEventReader.nextTag.The bug associated with this change is8069098.
java.lang.instrument / JVM TI
java.lang.instrument: Specify class loader for agent JAR files
The java.lang.instrumentpackage specification was amended to require that the system system class loader support a mechanism to add an agent JAR file to the system classpath. Also, if a custom class loader is used, then it must definejava.lang.instrument.Instrumentation.appendToSystemClassLoaderSearchfor the agent to be loaded at start-up.
The bug associated with this change is8160950.