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.
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 | ||
User Interface | XML | Tool Interface |
Applets: Deprecate Applets
All APIs supporting applets including the entire java.applet package (java.applet.Applet, java.applet.AppletStub, java.applet.AudioClip, java.applet.AppletContext) and the javax.swing.JApplet class 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 in JEP 289 Deprecate the Applet API.
The enhancement associated with this change is 8149502.
Applets: Deprecate APIs which reference Applets
All APIs whose signatures refer to types defined in the java.applet package were deprecated. This is the complete list of affected APIs: interface java.beans.AppletInitializer, java.beans.Beans.instantiate, and method javax.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 is 8169900.
Beans: Clarify meaning of
null
return value forSimpleBeanInfo.loadImage()
The specification of the return value of java.beans.SimpleBeanInfo.loadImage was updated to include the interpretation of a
null
return value.Beans: Add annotations to generate
BeanInfo
classes at runtimeNew annotations java.beans.JavaBean, java.beans.BeanProperty, and javax.swing.SwingContainer were added to allow runtime generation of java.beans.BeanInfo classes. These new annotations may be used to replace the compile-time javadoc
@beaninfo
tags.The enhancements associated with this change are 4058433 and 8132973.
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. A java.lang.IllegalArgumentException will 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), and java.beans.EventHandler.create(Class,Object,String,String,String).Beans: Generify
java.beans.beancontext
packageMethods in package java.beans.beancontext were 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, and java.beans.beancontext.BeanContextSupport.iterator.The bug associated with this change is 8039096.
Collections: Add convenience factory methods for collections
Static factory methods were defined to conveniently create compact, unmodifiable instances of the java.util.List, java.util.Map, and java.util.Set interfaces 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, and java.util.Map.ofEntries, were added to return an immutable map containing the keys and values extracted from the given entries and immutable java.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 in JEP 269 Convenience Factory Methods for Collections,
The enhancements associated with this change are 8048330, 8133977, 8144952, and 8159404.
Collections: Enhance
List.spliterator
for randomly accessible listsThe specification of java.util.List.spliterator was enhanced to describe how to account for java.util.List implementing java.util.RandomAccess.
The enhancement associated with this change is 8158365.
Collections: Declare unspecified behaviour for
Iterator
methodsThe specifications of java.util.Iterator.remove, java.util.Iterator.forEachRemaining, and java.lang.Iterable.forEach were 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 is 8168745.
Collections: Specify exceptional conditions for
Map
,HashMap
, &Hashtable
The specification of the java.util.Map interface was updated to declare that mapping functions should not modify the Map during computations. If any of the
compute*()
ormerge()
methods of java.util.HashMap and java.util.Hashtable detect that mapping functions have modified the map, they will throw a java.util.ConcurrentModificationException just 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, and java.util.Hashtable.merge.The bug associated with this change is 8071667.
Collections: Repeat class-level warnings in
Vector
andHashtable
methodsAll java.util.Enumerations returned by java.util.Vector and java.util.Hashtable in 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, and java.util.Hashtable.elements.
The enhancement associated with this change is 8020860.
Collections: Remove incorrect restriction from
ArrayList.removeRange()
In java.util.ArrayList.removeRange, the list of conditions for throwing a java.lang.IndexOutOfBoundsException was updated to eliminate “
fromIndex <= size()
”.The bug associated with this change is 8014066.
Collections: Add
Enumeration.asIterator()
An adaptor method java.util.Enumeration.asIterator was added to return java.util.Iterator which wraps the
Enumeration
instance and forwards method invocations.The enhancement associated with this change is 8072726.
Collections: Remove references to private fields in
AbstractList.subList()
References to the names of private fields in the
@implSpec
of java.util.AbstractList.subList were removed.The enhancement associated with this change is 8079136.
Collections: Declare
Spliterator.CONCURRENT
&Spliterator.IMMUTABLE
mutually exclusiveThe specification of constant java.util.Spliterator.CONCURRENT was 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 is 8032513.
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, and java.util.stream.DoubleStream.sum.
The bug associated with this change is 8030942.
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 is 8050819.
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, and java.util.stream.DoubleStream.takeWhile.The enhancement associated with this change is 8071597.
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, and java.util.stream.DoubleStream.iterate.
The enhancement associated with this change is 8072727 and 8164691.
Streams: Generify
Stream.generate()
The parameter of method java.util.stream.Stream.generate was paramaterized with a bounded wildcard type.
The bug associated with this change is 8132097.
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. and java.util.stream.DoubleStream.iterate.The bug associated with this change is 8164691.
Streams: Specify stream pipeline optimization
The class specifications of java.util.stream.Stream, java.util.stream.IntStream, java.util.stream.LongStream, and java.util.stream.DoubleStream were 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 is 8130023.
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 is 8071600.
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 is 8144675.
Propagate caveat to all
Collectors
: The existing type, mutability, serializability, and thread-safety caveat should be applied to all java.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), and java.util.stream.Collectors.toConcurrentMap(Function,Function,BinaryOperator).The bug associated with this change is 8068599.
Require presence of entries: The specification of java.util.stream.Collectors.partitioningBy(Predicate) and java.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 is 8170943.
Streams: Clarify
BaseStream.spiterator()
The specification of java.util.stream.BaseStream.spliterator was 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 is 8048689.
I/O & NIO: Enhance
Charset*.replaceWith()
The specification of the replacement value parameter of java.nio.charset.CharsetDecoder.replaceWith and java.nio.charset.CharsetEncoder.replaceWith was 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 is 8073692.
I/O & NIO: Remove
FilePermission
path name canonicalizationThe path name canonicalization process in java.io.FilePermission was 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, and java.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 are 8164705 and 8168979.
I/O & NIO: Specify exceptional conditions for
Reader
The abstract method java.io.Reader.read did not specify pre-conditions for the parameters. The long-standing behaviour to throw a java.lang.IndexOutOfBoundsException when 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, and java.io.LineNumberReader.read.The bug associated with this change is 8029689.
I/O & NIO: Enhance
*Reader.close()
for multi-thread useAn unexpected java.lang.NullPointerException was 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, and java.io.StringReader.close.
The bug associated with this change is 8143394.
I/O & NIO: Tidy various
read*()
method injava.io
Three kinds of problems were addressed by this change:
The specification of the
off
parameter in java.io.ObjectInputStream.read, java.io.DataInput.readFully, java.io.DataInputStream.readFully, java.io.ObjectInputStream.readFully, and java.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 is 8154183.
I/O & NIO: Specify exceptional conditions for
Writer
The abstract methods java.io.Writer.write and java.io.Writer.write did not specify pre-conditions for their parameters. The long-standing behaviour to throw a java.lang.IndexOutOfBoundsException when 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), and java.io.StringWriter.write(String,int,int).The bug associated with this change is 8130679.
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 is 8066867.
I/O & NIO: Add
InputStream.readAllBytes()
&InputStream.readNBytes()
Convenience methods java.io.InputStream.readAllBytes and java.io.InputStream.readNBytes were 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 is 8080835.
I/O & NIO: Clarify exceptional conditions for
InputStream.skip()
Conditions for throwing java.io.IOException in the abstract method java.io.InputStream.skip were 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, and java.io.PushbackInputStream.skip.The bug associated with this change is 8136738.
I/O & NIO: Clarify flushing behaviour in
FilterOutputStream.close()
The java.io.FilterOutputStream.close method specified that it invokes java.io.FilterOutputStream.flush before 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 is 8054565.
I/O & NIO: Enhance
java.nio.file
package description fornull
argumentsThe java.nio.file package description was enhanced to state that a java.lang.NullPointerException will be thrown when a passed array contains a
null
element.The enhancement associated with this change is 8062632.
I/O & NIO: Use co-variance in
java.nio.Buffer
and all subclassesMany methods in java.nio.Buffer are 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, and java.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, and java.nio.ShortBuffer.
The enhancement associated with this change is 4774077.
I/O & NIO: Add
Buffer.{duplicate,slice}()
Since every known subclass of java.nio.Buffer defined java.nio.Buffer.duplicate and java.nio.Buffer.slice methods in exactly the same way, their specification was moved to
Buffer
.The enhancement associated with this change is 8150785.
I/O & NIO: Add
ByteBuffer.{alignmentOffset,alignedSlice}()
Two methods were added. java.nio.ByteBuffer.alignmentOffset queries for misalignment at a given index and unit size. java.nio.ByteBuffer.alignedSlice slices a buffer after the position and limit are rounded to align for a given unit size.
The enhancement associated with this change is 8149469.
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 is 8024086.
I/O & NIO: Declare some methods in
Path
default
Eight methods in interface java.nio.file.Path were 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…), and java.nio.file.Path.iterator.The enhancement associated with this change is 8030090.
I/O & NIO: Specify exceptional conditions for
File
The specification for all methods in java.nio.file.Files that allow file open options to be specified was modified to throw a java.lang.IllegalArgumentException when invalid options or combinations of options are specified. The specification describing conditions to throw a java.lang.SecurityException was 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…), and java.nio.file.Files.write(Path,Iterable,OpenOption…).The bugs associated with this change are 8062553 and 8065109.
I/O & NIO: Clarify behaviour for zero attributes
The specification for java.nio.file.Files.readAttributes was 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 is 8064466.
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 to java.io.SerializablePermission;- New methods java.io.ObjectInputStream.getObjectInputFilter and java.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 in JEP 290 Filter Incoming Serialization Data.
The enhancements associated with this change are 8155760, 8169645, 8170291, and 8166739.
I/O & NIO: Revise
objectInputStream.resolve{Proxy}?Class()
The specifications of java.io.ObjectInputStream.resolveClass and java.io.ObjectInputStream.resolveProxyClass were revised to filter the platform class loader and its ancestors rather than just the null class loader.
The bugs associated with this change are 8155977 and 8169653.
java.lang: Update the primitive wrapper classes
The following changes were made to the primitive wrapper classes:
New parse methods taking a java.lang.CharSequence and a range were added to java.lang.Integer and java.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, and java.lang.Long.parseUnsignedLong.
The enhancements associated with this change are 8041972 and 8055251.
java.lang: Update String, StringBuilder, & StringBuffer
The following changes were made to java.lang.String and related classes.
The class specification of java.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 is 8155215.
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), and java.lang.String.regionMatches(boolean,int,String,int,int) were similarly adjusted.
The bug associated with this change is 8138824.
The specification of java.lang.String.indexOf was not consistent with the similar method java.lang.StringBuilder.indexOf for the empty string. The specification was updated to match the long-standing behaviour.
For consistency between the
indexOf()
andlastIndexOf()
methods in java.lang.String, java.lang.StringBuilder, and java.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 is 8027640.
Several code point methods in java.lang.StringBuffer and java.lang.StringBuilder throw a java.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, and java.lang.StringBuffer.offsetByCodePoints.The bug associated with this change is 8048264.
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.StackWalker class contains methods to open a sequential stream of java.lang.StackWalker.StackFrame objects for the current thread and to examine the contents of the stack frames. java.lang.StackFramePermission controls 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 in JEP 259 Stack-Walking API.
The enhancements associated with this change are 8140450 and 8153912.
java.lang: Add
Runtime.Version
The static, nested, inner class java.lang.Runtime.Version was 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 are 8144062 and 8161236.
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 in java.lang.Process were added to access
ProcessHandle
information for the processes and their descendants.- The target name, “
manageProcess
”, was added to java.lang.RuntimePermission to allow code to identify and terminate processes that it did not create.Additional details may be found in JEP 102 Process API Updates.
The enhancements associated with this change are 8077350, 8133216, 8129344, 8131763, 8138566, 8003488, 8140213, and 8140250.
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 throw java.io.IOException in java.lang.ProcessBuilder.start.
The bug associated with this change is 8131763.
In methods java.lang.ProcessBuilder.start and java.lang.Runtime.exec the specification was enhanced to document the long-standing behaviour of throwing a java.lang.UnsupportedOperationException when the operating system does not support process creation.
The bug associated with this change is 8055330.
The method java.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 is 8132394.
The field java.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 is 8132541.
A blanket
null
-handling statement was added to the class specifications of java.lang.ProcessBuilder and redundant method@throws NullPointerException
statements were removed.The bug associated with this change is 8050464.
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 throw java.lang.NullPointerException if 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.getResourceAsStream and java.net.URLClassLoader.getResourceAsStream.The enhancement associated with this change is 81702940.
java.lang: Add
ClassLoader.resources()
java.lang.ClassLoader.resources was added to support return of a java.util.stream.Stream whose elements are the URLs of all the resources with a given name.
The enhancement associated with this change is 8161230.
java.lang: Specify exceptional condition for
get*Package()
The specifications of java.lang.ClassLoader.getPackage, java.lang.Package.getPackage and the new method java.lang.ClassLoader.getDefinedPackage, were updated to describe conditions for throwing a java.lang.NullPointerException.
The bug associated with this change is 8165346.
java.lang: Add
ClassLoader.isRegisteredAsParallelCapable()
java.lang.ClassLoader.isRegisteredAsParallelCapable was added to return a boolean indicating whether or not the class loader can load multiple classes concurrently.
The enhancements associated with this change are 8165793 and 8169435.
java.lang: Enhanced
ClassLoader
with respect to loading array classesThe specification of java.lang.ClassLoader was enhanced to explicitly state that java.lang.Class.forName must be used to create java.lang.Class objects representing array classes.
The enhancement associated with this change is 6516909.
java.lang: Update
ClassLoader.getSystemClassLoader()
The specification of java.lang.ClassLoader.getSystemClassLoader was updated to remove the possibility of a
null
return value.The bug associated with this change is 8165563.
java.lang: Update Math & StrictMath
The following changes were made to java.lang.Math and java.lang.StrictMath.
fma support: Static methods supporting fused multiply-accumulate (fma) were added to java.lang.Math and java.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), and java.lang.StrictMath.fma(double,double,double).
The enhancement associated with this change is 4851642.
floorDiv()
,floorMod()
, &multiplyExact()
: Methods in java.lang.Math and java.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, and java.lang.StrictMath.multiplyExact.The enhancement associated with this change is 8023217.
multiplyFull()
&multiplyHigh()
: Methods supporting multiplication of to 64-bit integers to produce a 128-bit result were added to java.lang.Math and java.lang.StrictMath. This is the complete list of new methods: java.lang.Math.multiplyFull, java.lang.Math.multiplyHigh, java.lang.StrictMath.multiplyFull, and java.lang.StrictMath.multiplyHigh.The enhancement associated with this change is 5100935.
java.lang: Declare
SecurityException
consistently in class loader methodsThe conditions under which java.lang.SecurityException may 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, and java.lang.Thread.getContextClassLoader.The bug associated with this change is 7181225.
java.lang: Revise SecurityManager.check{TopLevelWindow,SystemClipboard,AccessAwtEventQueueAccess}
The specifications for deprecated methods java.lang.SecurityManager.checkTopLevelWindow, java.lang.SecurityManager.checkSystemClipboardAccess, and java.lang.SecurityManager.checkAwtEventQueueAccess were revised to check the target name “
AllPermission
” as described in the Java SE 8 Platform Specification. These methods are superseded by invocations of java.lang.SecurityManager.checkPermission withAWTPermission("showWindowWithoutWarningBanner")
,AWTPermission("accessClipboard")
, andAWTPermission("accessEventQueue")
respectively.The enhancement associated with this change is 8029886.
java.lang: Add
Thread.onSpinWait()
Some hardware platforms may benefit from a software hint indicating that a spin loop is in progress. The java.lang.Thread.onSpinWait method 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 in JEP 285 Spin-Wait Hints.
The enhancement associated with this change is 8147832.
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 of java.lang.InheritableThreadLocal was augmented to note that initial values may not be set at object creation.
The enhancement associated with this change is 8056152.
java.lang: Enhance
Deprecated
The class specification of java.lang.Deprecated corresponding 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 in JEP 277 Enhanced Deprecation.
The enhancement associated with this change is 8145461.
java.lang: Specify behaviour of
@Deprecated
when applied to package declarationsThe specification of java.lang.Deprecated was updated to state that is has no effect when applied to a package declaration.
The bug associated with this change is 6481080.
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) and java.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 in java.io.- java.lang.Runtime.getLocalizedOutputStream was deprecated in JDK 1.1 and is superseded by use of the Unicode-friendly
*Writer
classes in java.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 with
forRemoval=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 the java.lang.Deprecated.since method. This affects 24 methods and constants.Additional details about the API life cycle may be found in JEP 277 Enhanced Deprecation.
The enhancement associated with this change is 8145468.
java.lang: Enhance
SafeVarargs
The specification of java.lang.SafeVarargs was enhanced to allow
@SafeVarargs
on private methods.The enhancement associated with this change is 7196160.
java.lang: Deprecate
Runtime.trace{Instruction,MethodCall}()
java.lang.Runtime.traceInstructions and java.lang.Runtime.traceMethodCalls were 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 in JEP 277 Enhanced Deprecation.
The bug associated with this change is 8153330.
java.lang: Deprecate
Compiler
The class java.lang.Compiler was 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 by JEP 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 is 4285505.
java.lang: Generify
SecurityManager.getClassContext()
The return type of the protected java.lang.SecurityManager.getClassContext was paramaterized with an unbounded wildcard (
<?>
). This change was motivated by a desire to reduce build warnings.The bug associated with this change is 8027063.
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 is java.lang.reflect.Constructor.newInstance which wraps the constructor’s exceptions with an java.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 is 6850612.
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 is 8063147.
The specifications of java.lang.Class.getMethod and java.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 is 8062389.
The specifications of java.lang.Class.toGenericString and java.lang.Class.toString was enhanced to include specification about array handling.
The bug associated with this change is 8060077.
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 in java.lang.reflect.Method.getDeclaringClass was augmented to provide additional information about the return type.
The bug associated with this change is 8169479.
Reflection: Clarify
Executable.getAnnotatedReceiverType()
The specification of java.lang.reflect.Executable.getAnnotatedReceiverType was 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 is 8044629.
Reflection: Add
AnnotatedElement.getAnnotatedOwnerType()
The interface java.lang.reflect.AnnotatedElement did not support access to the potentially annotated owner type which retained its annotations. The java.lang.reflect.AnnotatedType.getAnnotatedOwnerType method 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, and java.lang.reflect.AnnotatedWildcardType.getAnnotatedOwnerType.The bug associated with this change is 8057804.
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 corresponding java.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 is 8054304.
Annotations: Adjust number of type contexts
The specification for java.lang.annotation.ElementType referred 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 is 8033812.
Annotations: Support serialization of
AnnotationTypeMismatchException
Instances of java.lang.annotation.AnnotationTypeMismatchException could not be serialized because they contained a non-transient and non-static internal field of type java.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, and java.lang.annotation.AnnotationTypeMismatchException.foundType,The bug associated with this change is 6226715.
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 is 8138696.
java.lang.ref: Automatically clear
PhantomReference
The specification of java.lang.ref.PhantomReference was aligned with soft and weak references which are automatically cleared by the garbage collector as they are enqueued.
The enhancement associated with this change is 8071507.
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.Reference class specification were required,
Additional details may be found in JEP 193 Variable Handles.
The enhancement associated with this change is 8133348.
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 of java.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 in JEP 193 Variable Handles.
The enhancements associated with this change are 8149644, 8151198, 8151705, 8154556, 8154737, 8154755, 8157726, 8158039, 8161444, 8162106, 8162107, and 8162108.
java.lang.invoke: Support enhanced method handles
The java.lang.invoke.MethodHandle, java.lang.invoke.MethodHandles, and java.lang.invoke.MethodHandles.Lookup classes 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. and java.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, and java.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, and java.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 and java.lang.invoke.MethodHandles.Lookup.accessClass.
Additional details may be found in JEP 194 Enhanced Method Handles.
The enhancements associated with this change are 8130227, 8150829, 8151179, 8158169, 8153637, 8150956, 8158171, and 8167974.
java.lang.invoke: Indify string concatenation
Methods to facilitate the creation of optimized String concatenation methods were added in java.lang.invoke.StringConcatFactory. When linkage invariants are violated, the new exception java.lang.invoke.StringConcatException, is thrown.
Additional details may be found in JEP 280 Indify String Concatenation
The enhancements associated with this change are 8085796,
java.lang.invoke: Specify behaviour for static methods
Exceptional handling for
static
methods in java.lang.invoke.MethodHandles.Lookup was missing. The following changes were required:
The specifications of java.lang.invoke.MethodHandles.Lookup.findSpecial(Class,String,MethodType,Class) and java.lang.invoke.MethodHandles.Lookup.unreflectSpecial(Method,Class) were extended to describe the long-standing behaviour of throwing a java.lang.IllegalAccessException if the provided method is
static
.The bug associated with this change is 8138578.
Similarly, the specification of java.lang.invoke.MethodHandles.Lookup.findVirtual was extended to describe the long-standing behaviour of throwing a java.lang.IllegalAccessException if the provided method is
static
.The bug associated with this change is 8138884.
java.lang.invoke: Refine
MethodHandle
&MethodHandles
Several changes were applied systematically to java.lang.invoke.MethodHandle and java.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 of java.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, and java.lang.invoke.MethodHandles.permuteArguments.
The bugs associated with this change are 8143410 and 8150360.
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.in were clarified to describe what constitutes a lookup context for a
Lookup
instance.The bug associated with this change is 8150782.
java.lang.invoke: Specify exceptional conditions for
MethodHandles.loop()
The specification of java.lang.invoke.MethodHandles.loop was modified to reformulate the conditions leading to java.lang.IllegalArgumentException.
The bug associated with this change is 8150635.
java.lang.invoke: Add
MethodHandles.arrayConstructor()
java.lang.invoke.MethodHandles.arrayConstructor was added to create a method handle constructing arrays of the specified type.
The bug associated with this change is 8155106.
java.lang.invoke: Add
MethodHandles.arrayLength()
java.lang.invoke.MethodHandles.arrayLength was added to return the length of an array.
The enhancement associated with this change is 8156915.
java.lang.invoke: Propagate errors from
invokedynamic
The java.lang.invoke package 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 a java.lang.BootstrapMethodError.The enhancement associated with this change is 8166974.
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 is 4851777.
java.math: Add
BigInteger
square root methodsTwo methods returning the integer square root were added. java.math.BigInteger.sqrt returns the largest integer which is less than or equal to the real square root. java.math.BigInteger.sqrtAndRemainder returns 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 is 8032027.
java.math: Add
BigInteger.TWO
The constant java.math.BigInteger.TWO equal to
BigInetger.valueOf(2)
was added.The enhancement associated with this change is 8152237.
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) and java.math.BigInteger.BigInteger(int,byte[],int,int)The enhancement associated with this change is 4026465.
java.math: Update
BigInteger
Serialized Form documentationInaccurate specification for the serialization of java.math.BigInteger was 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 is 8035279.
java.math: Deprecate
BigDecimal
rounding mode integer constantsEight legacy constants and their uses in three
BigDecimal
method signatures were deprecated in favor of java.math.RoundingMode which was added by JSR 176: Java 2 SE 5.0 (Tiger) Release Contents via component JSR-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, and java.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 is 4943627.
java.time: Correct boundaries specified by
ChronoField.EPOCH_DAY
The boundaries specified by java.time.temporal.ChronoField.EPOCH_DAY were corrected to match the epoch day of
LocalDate.MIN.toEpochDay()
andLocalDate.MAX.toEpochDay()
.The bug associated with this change is 8160681.
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 CLDR section 8 was provided. Changes to the class specification of java.time.format.DateTimeFormatter and new methods java.time.format.DateTimeFormatterBuilder.appendGenericZoneText(TextStyle) and java.time.format.DateTimeFormatterBuilder.appendGenericZoneText(TextStyle,Set) were required.The enhancement associated with this change is 8155823.
java.time: Refine computation of time-zone name format
The specification for the computation of the time-zone format was optimized in java.time.format.DateTimeFormatterBuilder.appendZoneText(TextStyle) and java.time.format.DateTimeFormatterBuilder.appendZoneText(TextStyle,Set). If the input temporal is a java.time.chrono.ChronoLocalDateTime and 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 is 8154567.
java.time: Change the definition of pattern letters
'A'
,'n'
, and'N'
The specifications of pattern letters
`A`
,'n'
, and'N'
in java.time.format.DateTimeFormatterBuilder.appendPattern was changed to match the specification in CLDR section 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 is 8148949.
java.time: Add pattern letter
'g'
Pattern letter
`g`
matching the field java.time.temporal.JulianFields.MODIFIED_JULIAN_DAY was added to java.time.format.DateTimeFormatterBuilder.appendPattern. The new pattern letter matches the specification in CLDR section 8.The bug associated with this change is 8148949.
java.time: Add pattern letter
'DD'
Pattern letter
`DD`
was added to java.time.format.DateTimeFormatterBuilder.appendPattern. The new pattern letter matches the CLDR specification.The bug associated with this change is 8079628.
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 is 8030864.
java.time: Specify adjacent value parsing in
DateTimeForamtterBuilder.appendFraction()
The specification of java.time.format.DateTimeFormatterBuilder.appendFraction was 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 is 8031085.
java.time: Specify lenient parsing for offset parsing
The specifications of java.time.format.DateTimeFormatter.ISO_OFFSET_DATE_TIME, java.time.format.DateTimeFormatter.BASIC_ISO_DATE, java.time.format.DateTimeFormatterBuilder.appendOffset, and java.time.format.DateTimeFormatterBuilder.appendOffsetId were 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 is 8032051.
java.time: Support parsing of a single digit hour
The specifications of java.time.format.DateTimeFormatterBuilder.appendOffset was 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 is 8066806.
java.time: Add
Duration.dividedBy()
The method java.time.Duration.dividedBy was 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 is 8032510.
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 is 8054214.
java.time: Modify the return value of
ZoneRulesProvider.getAvailableZoneIds()
The return type of java.time.zone.ZoneRulesProvider.getAvailableZoneIds was modified to return an immutable set to improve the method performance.
The bug associated with this change is 8066291.
java.time: Clarify
DateTimeFormatter
resolutionThe specification of java.time.format.DateTimeFormatter was 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 is 8066982.
java.time: Clarify behaviour of
Chronology.isLeapYear()
outside ofChronology
rangeThe specification of java.time.chrono.Chronology.isLeapYear was clarified to allow either a best guess or
false
for years outside of the range of java.time.chrono.Chronology. The correct result is guaranteed within the range.The bug associated with this change is 8067800.
java.time: Add
Clock.tickMillis()
The method of java.time.Clock.tickMillis was added to return a millisecond clock. This new method follows the existing pattern of the methods java.time.Clock.tickSeconds and java.time.Clock.tickMinutes.
The enhancement associated with this change is 8071919.
java.time: Change the return type of
LocalDate.getEra()
The return type of java.time.LocalDate.getEra was changed from java.time.chrono.Era to the more specific type java.time.chrono.IsoEra which is the correct era type for the calendar system. The method specification was also updated to remove reference to non-existent java.time.chrono.IsoChronology constants.
The bug associated with this change is 8072746.
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 a java.lang.IllegalArgumentException when
getNano()
returns a non-zero value sinceZoneOffsetTransitionRule
does not support sub-second time resolutions.The bug associated with this change is 8079063.
java.time: Add methods
Local{Date,Time}.ofInstant
Two static methods, java.time.LocalDate.ofInstant and java.time.LocalTime.ofInstant were added to ease conversion from java.time.Instant to java.util.Date and java.time.Instant to java.time.LocalDate.
The enhancement associated with this change is 8133079.
java.time: Add methods to retrieve portions of a
Duration
Convenience methods java.time.Duration.toDaysPart, java.time.Duration.toHoursPart, java.time.Duration.toMinutesPart, java.time.Duration.toSecondsPart, java.time.Duration.toMillisPart, and java.time.Duration.toNanosPart were 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 method java.time.Duration.toSeconds was added following the existing method naming convention in this class.
The enhancement associated with this change is 8142936.
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, and java.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 is 8143413.
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), and java.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 is 8146218.
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 is 8148849.
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 the java.util.concurrent.Flow class and its four nested interfaces, java.util.concurrent.Flow.Processor, java.util.concurrent.Flow.Publisher, java.util.concurrent.Flow.Subscriber, and java.util.concurrent.Flow.Subscription. Additional, a utility class, java.util.concurrent.SubmissionPublisher was provided to create custom components.
The enhancement associated with this change is 8134850.
The java.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, and java.util.concurrent.CompletableFuture.orTimeout.
The enhancement associated with this change is 8134851.
The method java.util.concurrent.ForkJoinTask.pollSubmission. was added to define tasks that might sometimes prefer to poll external submissions.
The enhancement associated with this change is 8134852.
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, and java.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 is 8134853.
Additional details may be found in JEP 266 More Concurrency Updates
Concurrency: Specify exceptional conditions for
ThreadPoolExecutor.setCorePoolSize()
The specification of java.util.concurrent.ThreadPoolExecutor.setCorePoolSize was updated to throw a java.lang.IllegalArgumentException if the provided core pool size is not between 0 and the maximum pool size.
The bug associated with this change is 7153400.
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 of java.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), and java.util.concurrent.CompletableFuture.whenCompleteAsync(BiConsumer,Executor).
The bugs associated with this change are 8139927 and 8143089.
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 is 8157523.
The class specification was updated to declare that the default factory for creating worker threads will create threads that have no java.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 is 8056248.
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 is 8172726.
Concurrency: Describe implementation requirements for atomicity guarantee
The class specification of java.util.concurrent.ConcurrentMap was enhanced to describe all required method overrides to maintain atomicity guarantees.
The bug associated with this change is 8078645.
Concurrency: Revise
java.util.concurrent.atomic
to useVarHandles
The package java.util.concurrent.atomic was comprehensively updated to leverage java.lang.invoke.VarHandle specification and methods. Twelve classes were affected.
The enhancement associated with this change is 8080603.
Concurrency: Specify lack of order for
Priority*Queue.spliterator()
The class specifications of java.util.PriorityQueue and java.util.concurrent.PriorityBlockingQueue were 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 is 8132964.
Concurrency: Add
TimeUnit.toChronoUnit()
&TimeUnit.of()
Methods java.util.concurrent.TimeUnit.toChronoUnit and java.util.concurrent.TimeUnit.of were added to convert between java.util.concurrent.TimeUnit and java.time.temporal.ChronoUnit.
The enhancement associated with this change is 8141452.
Concurrency: Deprecate
Atomic*.weakCompareAndSet()
and addAtomic*.weakCompareAndSetPlain()
The convention for methods in java.lang.invoke.VarHandle is 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, and java.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, and java.util.concurrent.atomic.AtomicReferenceArray.weakCompareAndSetPlain.The enhancement associated with this change is 8164814.
Concurrency: Clarify
Semaphore.drainPermits()
The specification of java.util.concurrent.Semaphore.drainPermits was extended to describe the behaviour when the number of permits is negative.
The bug associated with this change is 8169272.
Concurrency: Define access control context for
ThreadPoolExecutor.finalize()
The specification of java.util.concurrent.ThreadPoolExecutor.finalize was 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.newThread was extended to expect a
null
when the request is rejected.The enhancement associated with this change is 8143086.
The following changes have been made in the java.util package, 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, and java.util.Properties.values, are no longer fail-fast; hence, the unchecked exception java.util.ConcurrentModificationException will 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 is 8029891.
java.util: Update Formatter
The following changes were made to java.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 of java.util.Formatter.The bug associated with this change is 8146156.
The class specification for the
%n
conversion was updated to specify existing behaviour to return the platform-specific line separator returned by java.lang.System.lineSeparator.The bug associated with this change is 8080252.
java.util: Deprecate
Observer
&Observable
The java.util.Observer interface and java.util.Observable class were deprecated. Their event model was limited and under specified. Neither has been maintained or enhanced in years. The package java.beans provides a richer event model. Concurrent data structures in java.util.concurrent provides 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 is 8154801.
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), and java.lang.StringIndexOutOfBoundsException.StringIndexOutOfBoundsException(int).The enhancement associated with this change is 8135248.
java.util: Specify exceptional conditions for
Properties.load()
The specification of methods java.util.Properties.load(Reader) and java.util.Properties.load(InputStream) was updated to describe the long-standing behaviour to throw java.lang.NullPointerException when the parameter is
null
.The bug associated with this change is 8073214.
java.util: Clarify mutability of
Properties.stringPropertyNames()
return valueThe specification of method java.util.Properties.stringPropertyNames was updated to declare the long-standing behaviour to return an unmodifiable set of keys.
The bug associated with this change is 8059361.
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 are 8033148 and 8141409.
java.util: Support streams in
Scanner
The following new methods returning streams were added to java.util.Scanner: java.util.Scanner.findAll(String), java.util.Scanner.findAll(Pattern), java.util.Scanner.tokens.
The enhancement associated with this change is 8072722.
java.util: Add stream-returning methods to classes which only have
Enumeration
-returning methodsSeveral classes which only return java.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, and java.sql.DriverManager.drivers.
The specification of java.util.Collections.enumeration was clarified to say that an Iterator derived from an Enumeration does not support removal of elements.
The enhancements associated with this change are 8081678 and 8164815.
java.util: Specify late-binding for streaming methods
The specifications of java.util.BitSet.stream, java.lang.CharSequence.chars, and java.lang.CharSequence.codePoints were enhanced to declare that the source java.util.Spliterator is late-binding.
The bug associated with this change is 8169808.
java.util: Specify argument checking in selected
Scanner
methodsExceptional conditions resulting in a java.lang.IllegalArgumentException when 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 is 8166261.
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 is 8159855.
java.util: Document exceptional conditions in
Preferences
The specifications for all
put*()
,get*()
, andremove()
methods in java.util.prefs.AbstractPreferences and java.util.prefs.Preferences were updated to prohibit the use of any key or value String containing codepointU+000
(the null control character). If this character is detected, a java.lang.IllegalArgumentException is thrown. This affects 15 methods in each class.The class specification of java.util.prefs.AbstractPreferences was 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 are 8038373 and 8075156.
java.util: Update Objects
The following changes were made to java.util.Objects.
Convenience methods java.util.Objects.requireNonNullElse and java.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 are 8138963 and 8141652.
The specifications of java.util.Objects.checkIndex, java.util.Objects.checkFromToIndex and java.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 is 8142493.
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, and java.util.OptionalLong.stream were added to transform a stream into a stream of present values.
The enhancement associated with this change is 8050820.
The parameter of the primitive specialization methods, java.util.OptionalDouble.orElseThrow, java.util.OptionalInt.orElseThrow, and java.util.OptionalLong.orElseThrow, was aligned with java.util.Optional.orElseThrow.
The bug associated with this change is 8059324.
java.util.Optional.ifPresentOrElse, java.util.OptionalDouble.ifPresentOrElse, java.util.OptionalInt.ifPresentOrElse, and java.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 is 8071670.
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 is 8080418.
Wildcards were added to the declaration of java.util.Optional.flatMap.
The bug associated with this change is 8152617.
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 by java.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) and java.lang.System.getLogger(String,ResourceBundle) were added to return an instance of the java.lang.System.LoggerFinder for the caller’s use.
A new java.lang.RuntimePermission, with target name “
loggerFinder
”, was added to protect access to loggers of system classes.Additional details may be found in JEP 264 Platform Logging API & Service.
The enhancements associated with this change are 8140364 and 8148568.
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 is 8029805.
Logging: Add
LogManager.*ConfigurationListener()
New methods java.util.logging.LogManager.addConfigurationListener and java.util.logging.LogManager.removeConfigurationListener were 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 is 8043306.
Logging: Add
LogManager.updateConfiguration()
methodsMethods java.util.logging.LogManager.updateConfiguration and java.util.logging.LogManager.updateConfiguration were added to update the
LogManager
. Unlike java.util.logging.LogManager.readConfiguration these new methods do not invoke java.util.logging.LogManager.reset which always removes and closes handlers on all existing loggers. Adjustments were also made to the class specification, java.util.logging.LogManager and methods java.util.logging.LogManager.readConfiguration(), java.util.logging.LogManager.readConfiguration(InputStream), and java.util.logging.LogManager.reset.The bug associated with this change is 8033661 and 8075810.
Logging: Add
FileHandler
constructorA new method, java.util.logging.FileHandler.FileHandler was added to provide the ability to create logs which are bigger than 2G.
The enhancement associated with this change is 8059767.
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 of java.util.logging.LogManager.The bug associated with this change is 8060132.
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 a java.util.logging.FileHandler. The default value is 100. Complete documentation may be found in the class specification of java.util.logging.FileHandler and the new constructor, java.util.logging.FileHandler.FileHandler.The enhancement associated with this change is 8153955.
Logging: Upgrade to nanosecond event time resolution
The resolution of time stamps in java.util.logging.LogRecord were upgraded from milliseconds to nanoseconds backed by java.time. This change was documented in the java.util.logging.LogRecord.LogRecord. The event instant may be retrieved and set via new methods java.util.logging.LogRecord.getInstant and java.util.logging.LogRecord.setInstant. The specification of existing methods java.util.logging.LogRecord.getMillis and java.util.logging.LogRecord.setMillis was 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 are 8072645 and 8144262.
Logging: Revise the
Formatter.formatMessage()
specificationThe specification of java.util.logging.Formatter.formatMessage was revised to use java.text.MessageFormat if the string contains digits.
The bug associated with this change is 8153666.
Regular Expressions: Add two Perl regular expression constructs
The following new regular expression constructs were added to support Unicode extended grapheme clusters:
'\X'
matches any Unicode extended grapheme cluster'\b{g}'
matches a Unicode extended grapheme cluster boundaryThe enhancement associated with this change is 7071819.
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 method java.lang.Character.codePointOf.
The enhancement associated with this change is 8147531.
Regular Expressions: Add
Matcher.appendReplacement()
andMatcher.appendTail
forStringBuilder
Overload methods java.util.regex.Matcher.appendReplacement and java.util.regex.Matcher.appendTail were added matching the identically named methods with a
StringBuffer
parameter.The enhancement associated with this change is 8039124.
Regular Expressions: Support functional programming
New functional methods java.util.regex.Matcher.replaceAll and java.util.regex.Matcher.replaceFirst were added matching the identically named methods. java.util.regex.Matcher.results was added to return a stream of java.util.regex.MatchResult.
The enhancement associated with this change is 8071479.
These are the changes relating to internationalization support, primarily in the java.util and java.text packages and in java.lang.Character.
Internationalization: Support Unicode 8.0
The supported version of the Unicode standard for java.lang.Character and java.lang.String was 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 to java.lang.Character, 42 constants were added to java.lang.Character.UnicodeBlock, 29 enums were added to java.lang.Character.UnicodeScript, and two ranges were added to java.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 in JEP 227 Unicode 7.0 and JEP 267 Unicode 8.0.
The enhancements associated with this change are 8032446 and 8072600.
Internationalization: Update Locale
The following changes were made to java.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 is 8071929.
In java.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 is 8025547.
The specifications of java.util.Locale.LanguageRange and java.util.Locale.LanguageRange.LanguageRange were updated to throw a java.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 is 8047780.
The method, java.util.Locale.LanguageRange.toString, was added.
The enhancement associated with this change is 8026766.
Internationalization: Use CLDR Locale data by default
The Unicode Consortium’s Common 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 the java.util.spi.LocaleServiceProvider class was updated to make CLDR the default locale provider.
The enhancement associated with this change is 8008577.
In java.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 is 8062006.
In java.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 is 8138613.
Additional details may be found in JEP 252 Use CLDR Locale Data by Default.
.Internationalization: Load
java.{awt.im,text,util}.spi
from the application’s classpathThe SPI implementations for java.awt.im.spi, java.text.spi, and java.util.spi were 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 of java.awt.im.spi, were modified to reference this new mechanism.
The bugs associated with this change are 8062588
The constructor java.util.spi.LocaleServiceProvider.LocaleServiceProvider was modified to describe conditions for throwing java.lang.SecurityException and the java.lang.RuntimePermission target name “
localeServiceProvider
” was added.The bugs associated with this change are 8075545.
The target name “
localeServiceProvider
” was added to the permission target table in java.lang.RuntimePermission.The bugs associated with this change are 8079186.
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 in JEP 226 UTF-8 Property Resource Bundles.
The enhancements associated with this change are 8027607 and 8152629.
Internationalization: Load
ResourceBundleControlProvider
implementations from the application’s classpathjava.util.spi.ResourceBundleControlProvider is 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 and java.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 of java.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 use upgradeable 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 are 8172365.
Internationalization: Clarify type of constant in
ResourceBundle.Control
A link under the word “unmodifiable” in the specification of constants java.util.ResourceBundle.Control.FORMAT_CLASS, java.util.ResourceBundle.Control.FORMAT_DEFAULT, and java.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 is 8134373.
Internationalization: Clarify context sensitivity of the month pattern
The specification for the “Letter M” month pattern in the class description of java.text.SimpleDateFormat was enhanced to provide examples of the expected output in various situations.
The bug associated with this change is 8055900.
Internationalization: Specify exceptional condition for
Format.parseObject()
The specification of methods java.text.Format.parseObject(String) and java.text.Format.parseObject(String,ParsePosition) was updated to describe the long-standing behaviour to throw java.lang.NullPointerException when the provided source parameter is
null
. A similar change was required in all subclasses ofFormat
: java.text.DateFormat.parseObject, java.text.MessageFormat.parseObject, and java.text.NumberFormat.parseObject.The bugs associated with this change are 8073211 and 8150702.
Internationalization: Specify exceptional conditions in
Format
The specification of many methods in abstract class java.text.Format and concrete subclasses was inconsistent in declaring java.lang.NullPointerException and java.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, and java.text.SimpleDateFormat.
The bug associated with this change is 8169480.
Internationalization: Add references to
Calendar
constants toDateFormatSymbols
Unlike other methods in java.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, and java.text.DateFormatSymbols.setShortMonths.
The bug associated with this change is 8129555.
Internationalization: Update Currency
The following changes were made to java.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 is 8154295.
Clarify that the phrases “minor units”, “default fraction digits”, and “default number of fraction digits” are equivalent. Also, recommend that java.math.BigDecimal be used for monetary values. Changes were made to java.util.Currency and java.util.Currency.getDefaultFractionDigits.
The bug associated with this change is 8074411.
Modify the description of java.lang.NullPointerException in java.util.Currency.getInstance to remove reference to the country code.
The bug associated with this change is 8075315.
Networking: Preserve operating system’s IP address order
A new token, ‘
system
’, was added to the set of possible values for the system property java.net.preferIPV6Addresses which 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 is 8016521.
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 a java.net.MalformedURLException when 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), and java.net.URL.URL(URL,String,URLStreamHandler).The bug associated with this change is 4906983.
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 constant java.net.SocketOptions.SO_REUSEPORT and java.net.StandardSocketOptions.SO_REUSEPORT were added to identify whether the option is enabled.
- The specification of java.net.MulticastSocket.MulticastSocket was adjusted to reference the new socket option.
The enhancement associated with this change is 6432031.
Networking: Use
ServiceLoader
forURL/URLConnnection
provider lookupThe specification in the java.net package and the java.net.URL.URL constructor describing the how protocol handler implementations are found was updated to use java.util.ServiceLoader instead of the old “
java.protocol.handler.pkgs
” system property. The mechanism locates implementations of a new service type, abstract class java.net.spi.URLStreamHandlerProvider, using the system class loader. A small specification clarification to java.net.URLStreamHandlerFactory.createURLStreamHandler was also required.The location of implementations of java.net.ContentHandlerFactory was changed to use java.util.ServiceLoader as documented in java.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 are 8064924 and 8064925.
Networking: Generify
URL.getContent()
&URLConnection.getContent()
The parameter type of methods java.net.URL.getContent and java.net.URLConnection.getContent was paramaterized with an unbounded wildcard (
<?>
).The enhancement associated with this change is 8031326.
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, and java.net.MulticastSocket.supportedOptions.The enhancement associated with this change is 8036979.
Networking: Update
URLClassLoader.definePackage()
to expect packages to be defined per class loaderThe specification of the protected java.net.URLClassLoader.definePackage method was updated to throw a java.lang.IllegalArgumentException if the package has already been defined by this class loader.
Networking: Add
java.content.handler.pkgs
propertyThe class specification of java.net.ContentHandler was 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 in java.net.URL.URL and java.net.URLConnection.getContent.The enhancement associated with this change is 8039470.
Networking: Ignore userinfo in
URLPermission
The class specification of java.net.URLPermission was 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 is 8029354.
Networking: Document support of
jar:
scheme URLs inURLClassLoader
The specifications for the java.net.URLClassLoader class and the java.net.URLClassLoader.URLClassLoader constructor 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 is 8155770.
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.join were updated to indicate that an java.io.IOException will be thrown if invoked on a platform that does not support multicasting.
The bug associated with this change is 8157166.
Networking: Enable per-protocol setting for
URLConnection
cachingNew methods java.net.URLConnection.getDefaultUseCaches and java.net.URLConnection.setDefaultUseCaches were 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 field java.net.URLConnection.useCaches, and the java.net.URLConnection.setUseCaches, java.net.URLConnection.getDefaultUseCaches, and java.net.URLConnection.setDefaultUseCaches methods.
The bug associated with this change is 8163449.
Networking: Require trailing
':'
in header-namesThe class specification of java.net.URLPermission and the method specification of java.net.URLPermission.getActions differed 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 is 8163482.
Networking: Support multi-release JAR files
The class specification of java.net.URLClassLoader was extended to include support of multi-release JAR files.
The enhancements associated with this change are 8166914 and 8172732.
Networking: Add Authenticator.getDefault()
The java.net.Authenticator.getDefault method was added to retrieve the default authenticator.
The enhancement associated with this change is 8169068.
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 is 8169495.
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 is 8029806.
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 of java.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, and java.util.jar.JarFile.stream.
Additional details may be found in JEP 238 Multi-Release JAR Files.
The enhancements associated with this change are 8132734, 8150680, 8165782, and 8166735.
JAR & ZIP: Support CRC32C
A new class java.util.zip.CRC32C, extending the java.util.zip.Checksum interface was added. Default implementations for new methods java.util.zip.Checksum.update(byte[]) and java.util.zip.Checksum.update(ByteBuffer) were added. Since the interface provides default implementations of these methods, the overrides in java.util.zip.CRC32 and java.util.zip.Adler32 were removed.
The enhancement associated with this change is 6321472.
JAR & ZIP: Define
Attributes
iteration orderThe class specification of java.util.jar.Attributes was enhanced to guarantee that the iteration order is the order of insertion.
The bug associated with this change is 8062194.
JAR & ZIP: Add
ZipEntry.{get,set}TimeLocal()
New methods java.util.zip.ZipEntry.setTimeLocal and java.util.zip.ZipEntry.getTimeLocal were 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 is 8075526.
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 in java.io.ObjectInputFilter and java.io.ObjectInputStream during unmarshalling and before dispatch.
- Two overloaded methods were added to provide the filter: java.rmi.server.UnicastRemoteObject.exportObject(Remote,int,ObjectInputFilter) and java.rmi.server.UnicastRemoteObject.exportObject(Remote,int,RMIClientSocketFactory,RMIServerSocketFactory,ObjectInputFilter)
Additional details may be found in JEP 290 Filter Incoming Serialization Data.
The enhancement associated with this change is 8165261.
RMI: Update
ActivationInstantiator.newInstance()
andUnicastRemoteObject
to describe access requirementsThe specifications of the java.rmi.activation.ActivationInstantiator.newInstance method and the java.rmi.server.UnicastRemoteObject class were updated to stipulate access requirements on packages used by
java.rmi
.The enhancement associated with this change is 8044626.
RMI: Refine
RemoteObjectInvocationHandler.invoke()
The specification of java.rmi.server.RemoteObjectInvocationHandler.invoke was 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 of java.rmi.server.RMISocketFactory.
The enhancement associated with this change is 8066750.
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, and org.omg.CORBA.ORBPackage.InvalidNameHelper. These exception classes extend the serializable java.lang.Exception; hence they require helper classes for marshalling.
The bug associated with this change is 7130985.
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 is 8049376.
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.InputStream and org.omg.CORBA_2_3.portable.OutputStream were moved to an@implNote
.The bug associated with this change is 8077395.
Security: Support DRBG-based SecureRandom implementations
Three Deterministic Random Bit Generator (DRBG) mechanisms described in NIST 800-90Ar1 were implemented. The following changes were applied:
- New methods were added to java.security.SecureRandom to support additional input for seeding, reseeding, and random-bit generation as described by NIST 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), and java.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, and java.security.SecureRandom.generateSeed.
- A new constructor and several new methods were added to java.security.SecureRandomSpi to support the new methods in java.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, and java.security.SecureRandomSpi.toString.
- The specifications of an existing constructor and a few methods in java.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, and java.security.SecureRandomSpi.engineNextBytes.
- A new marker interface, java.security.SecureRandomParameters, which is used to identify parameters in java.security.SecureRandom was added
- A new class java.security.DrbgParameters implementing java.security.SecureRandomParameters which specifies DRBG parameters was added.
Additional details may be found in JEP 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, to PKCS12 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[]) and java.security.KeyStore.getInstance(File,KeyStore.LoadStoreParameter) load keystore object of the appropriate keystore type. java.security.KeyStore.Builder.newInstance returns a new java.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 of java.security.KeyStore was updated to encourage applications to use the new APIs when opening existing keystores.
Additional details may be found in JEP 229 Create PKCS12 Keystores by Default.
The enhancements associated with this change are 8044445 and 8130800.
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 and RFC 6347 was defined with the following changes in package javax.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, and javax.net.ssl.SSLContextSpi.engineGetServerSocketFactory were updated throw a java.lang.UnsupportedOperationException since
SocketFactory
andServerSocketFactory
may not be supported by the underlying DTLS implementation.- In class javax.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 class javax.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, and javax.net.ssl.X509ExtendedTrustManager.
Additional details may be found in JEP 219 Datagram Transport Layer Security (DTLS).
The enhancements associated with this change are 8043758 and 8130461.
Security: Clarify that enabled protocols may never be used
The specifications of methods javax.net.ssl.SSLSocket.getEnabledProtocols, javax.net.ssl.SSLEngine.getEnabledProtocols, and javax.net.ssl.SSLServerSocket.getEnabledProtocols were 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
The javax.net.ssl package was enhanced to support the TLS Application 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, and javax.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, and javax.net.ssl.SSLSocket.getHandshakeApplicationProtocolSelector.
Additional details may be found in JEP 244 TLS Application-Layer Protocol Negotiation Extension
The enhancements associated with this change are 8051498, 8171443, and 8170282.
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. The javax.net.ssl.ExtendedSSLSession.getStatusResponses method was added to provide support for this approach.
Additional details may be found in JEP 249 OCSP Stapling for TLS
The enhancement associated with this change is 8046321.
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.engineLoad must be overridden.The bug associated with this change is 8130850.
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 Specification RFC 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 of RFC 4120.
- Several methods in javax.security.auth.kerberos.KerberosKey were modified to throw a java.lang.IllegalStateException, if the key is destroyed.
- The specification of javax.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 is 8043071.
Security: Generify
javax.xml.crypto
The parameters and return types in javax.xml.crypto package and subpackages were paramaterized. This change was motivated by a desire to reduce build warnings. During generification, the javax.xml.crypto.NodeSetData interface was changed to implement java.lang.Iterable to support use in for-each loops.
The enhancement associated with this change is 8046949.
Security: Allow
yes
&no
inkerb5.conf
The specification of the
krb5.conf
configuration file format in package javax.security.auth.kerberos was 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 is 8029995.
Security: Clarify behaviour of
null
location inCodeSource
The specification of the following constructors and methods in java.security.CodeSource was 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, and java.security.CodeSource.getCodeSigners.The bug associated with this change is 8129972.
Security: Use
ServiceLoader
for JCE provider lookupThe class specification of java.security.Provider was updated to describe how Service provider implementations are found using java.util.ServiceLoader and 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 is 7191662.
Security: Describe how permissions may be implied
The javax.security.auth.kerberos.ServicePermission.implies and javax.security.auth.kerberos.DelegationPermission.implies methods were modified to describe how one permission implies another.
The enhancement associated with this change is 8129789.
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, and javax.xml.crypto.dsig.keyinfo.The enhancement associated with this change is 8133151.
Security: Remove
ExemptionMechanism.finalize()
overrideThe protected override method javax.crypto.ExemptionMechanism.finalize was removed since its presence hurts performance and it does not do anything beyond the default finalizer.
The enhancement associated with this change is 8159009.
Security: Replace references to RFC 3280 with RFC 5280
All references to RFC 3280 Internet X.509 Public Key Infrastructure Certificate were replaced with the updated RFC 5280 Internet X.509 Public Key Infrastructure Certificate. This affected java.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, and javax.security.auth.x500.
The bug associated with this change is 8037550.
Security: Specify behaviour for
null
algorithm name ingetInstance()
methodsThere are 21
getInstance()
methods scattered across the java.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.NullPointerException when passed
null
as an algorithm name.The bug associated with this change is 4985694.
Security: Specify behaviour of
Subject
fornull
parametersThe specification of constructors javax.security.auth.Subject.Subject() and javax.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 a java.lang.NullPointerException.The bug associated with this change is 8015081.
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 are 8015388 and 8172869.
Security: Remove references to the
sun.security.acl
packageThe class specification of java.security.acl.Acl was modified to remove references to the
sun.security.acl
implementation package.The bug associated with this change is 8072663.
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 is 8038084.
Security: Enhance parameter checking during
CertificateRevokedException
constructionThe specification of constructor java.security.cert.CertificateRevokedException.CertificateRevokedException was enhanced to throw a java.lang.ClassCastException if the provided
Map
contains entries which have incorrect keys ore values.Security: Enhance parameter checking in
Signature.{update,sign}()
The specification of methods java.security.Signature.update and java.security.Signature.sign was enhanced to throw a java.lang.IllegalAccessException if 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. and java.security.spec.X509EncodedKeySpec.X509EncodedKeySpec. This algorithm may be retrieved using the new java.security.spec.EncodedKeySpec.getAlgorithm method.The enhancement associated with this change is 8047223.
Security: Enhance specification for
DrbgParameters
of strength< 1
The specifications of java.security.DrbgParameters.instantiation and java.security.DrbgParameters.nextBytes was modified to declare that a java.lang.IllegalArgumentException. is thrown if the provided
strength
is less than one.The bug associated with this change is 8158534.
Security: Enhance Kerberos interactions when a
SecurityManager
is presentA few changes were made to how Kerberos requests are processed when a java.lang.SecurityManager is present. The following adjustments were required:
- The specifications of the
KerberosPrincipal
constructors, javax.security.auth.kerberos.KerberosPrincipal.KerberosPrincipal(String) and javax.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 a javax.security.auth.kerberos.ServicePermission if conditions were not met.- The specification for the org.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.Policy was 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 is 8075706.
Security: Update
MessageDigest.isEqual()
The specification of java.security.MessageDigest.isEqual was 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 is 8136459.
Scripting: Use
ServiceLoader
for Engine discoveryThe specifications for javax.script.ScriptEngineFactory and the javax.script describing the Engine discovery mechanism were updated to replace reference to
META-INF/services
configuration files with use of the service-provider loading facility defined by java.util.ServiceLoader.The bug associated with this change is 8068398.
Scripting: Specify behaviour on
null
argument forScriptEngineFactory.getProgram()
The specification of javax.script.ScriptEngineFactory.getProgram was updated to describe the long-standing behaviour to throw java.lang.NullPointerException when the
arguments
array or any of its elements isnull
.The bug associated with this change is 8071588.
Scripting: Specify exceptional conditions for
ScriptContext.setAttribute()
The specification of javax.script.ScriptContext.setAttribute was updated to describe the long-standing no-op behaviour if javax.script.ScriptContext.GLOBAL_SCOPE is used and there is no associated global bindings.
The bug associated with this change is 8071678.
JNDI: Use
ServiceLoader
for provider lookupThe specification of javax.naming.spi.NamingManager.getInitialContext describing 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 is 8044627.
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, and javax.naming.spi.NamingManager were updated to remove references to the applet mechanism.
The bug associated with this change is 8051422.
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 is 8167178.
JMX: Specify behaviour for unresolvable localhost
The specifications of the
host
parameter of javax.management.remote.JMXServiceURL.JMXServiceURL(String,String,int) and javax.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.
2D: Update TextLayout.equals() specification
The specification of java.awt.font.TextLayout.equals was modified to indicate that it obeys the general contract of java.lang.Object.equals, the long-standing behaviour. Explicit overrides of java.awt.font.TextLayout.equals and java.awt.font.TextLayout.hashCode were removed since they added no value.
The bug associated with this change is 4497648.
2D: Specify SecurityException thrown by
PrinterJob.getUserName()
The specification for java.awt.print.PrinterJob.getUserName was modified to describe conditions for the long-standing behaviour to throw a java.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 methods java.awt.Font.createFonts(InputStream) and java.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 is 8055463.
2D: Allow for platform limitations during font rendering
The specification for java.awt.Font was augmented to state that platforms limitations may prevent glyphs from being rendered with the requested properties.
The bug associated with this change is 8166034.
2D: Specify
Windows.setIconImages()
behaviour for multi-resolution imagesThe specification of java.awt.Window.setIconImages was enhanced to described how multi-resolution images are processed when an image is added to the icons list.
The bug associated with this change is 8149371.
2D: Add
serialVersionUID
field to serializable types in thejavax.print.*
packagesSome serializable types in packages javax.print and javax.print.attribute did 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, and javax.print.attribute.UnmodifiableSetException.The bug associated with this change is 8034050.
2D: Generify
javax.print.*
packagesThe return type of methods javax.print.AttributeException.getUnsupportedAttributes and javax.print.attribute.standard.DialogTypeSelection.getCategory were paramaterized. This change was motivated by a desire to reduce build warnings.
The bug associated with this change is 8042864.
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 is 8146324.
2D: Provide explicit specification for methods in
AbstractMultiResolutionImage
The specification describing the long-standing behaviour of five methods in java.awt.image.AbstractMultiResolutionImage was 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, and java.awt.image.AbstractMultiResolutionImage.getProperty.
The bug associated with this change is 8138771.
2D: Update value of
OpenType.TAG_OPBD
The value of constant java.awt.font.OpenType.TAG_OPBD was incorrectly assigned to the same value as java.awt.font.OpenType.TAG_MORT. The correct value,
0x6F70626UL
, is now used.The bug associated with this change is 8077584.
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 interface java.awt.image.MultiResolutionImage defines basic operations for a set of images at various resolutions. The classes java.awt.image.AbstractMultiResolutionImage and java.awt.image.BaseMultiResolutionImage enable 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, and java.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 are 8029339 and 8151787.
2D: Add
ColorModel*.{equals,hashCode}()
java.awt.image.ColorModel and its subclasses either did not override
equals()
and/orhashCode()
or provided incomplete specification. These deficiencies were remedied as follows:
- In java.awt.image.ColorModel, java.awt.image.ColorModel.equals, and java.awt.image.ColorModel.hashCode, overrides were added.
- In java.awt.image.IndexColorModel, java.awt.image.IndexColorModel.equals, and java.awt.image.IndexColorModel.hashCode, overrides were added.
- In java.awt.image.PackedColorModel, an override of java.awt.image.PackedColorModel.hashCode was added.
- In java.awt.image.ComponentColorModel, the specification of java.awt.image.ComponentColorModel.equals was updated and an override of java.awt.image.ComponentColorModel.hashCode was added.
The bug associated with this change is 7107905.
2D: Specify ImageIO behaviour for failure to create streams
The conditions under which a java.io.IOException may be thrown were extended to include failure to create the required javax.imageio.spi.ImageInputStreamSpi or javax.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 is 8044289.
2D: Update
ImageReader.getRawImageType()
The specification of method javax.imageio.ImageReader.getRawImageType, was updated to describe the return value when a close match is not available.
The bug associated with this change is 8143562.
2D: Generify
javax.imageio.spi
The return types of methods in javax.imageio.spi.ImageReaderSpi and javax.imageio.spi.ImageWriterSpi were paramaterized. This change was motivated by a desire to reduce build warnings.
The enhancement associated with this change is 8035487.
2D: Add
serialVersionUID
field to serializable types in thejavax.imageio.*
packagesSome serializable types in javax.imageio, javax.imageio.metadata, and javax.imageio.spi did 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, and javax.imageio.metadata.IIOMetadataNode.The bug associated with this change is 8033616.
2D: Enhance Accessibility API to use service provider mechanism
The specification of java.awt.Toolkit.getDefaultToolkit was 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: 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 package java.awt.desktop contains a series of classes and interfaces which may be used to detect and process events. For instance, the java.awt.desktop.AppForegroundListener interface contains methods which are invoked when the application moves to and from the foreground and events of type java.awt.desktop.AppForegroundEvent are sent. This package replaces internal APIs originally defined in the
com.apple.{eawt,eio}
packages.- The new class java.awt.Desktop and the type-safe enum java.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 class java.awt.Taskbar and type-safe enums java.awt.Taskbar.Feature, and java.awt.Taskbar.State, support interactions with the platform-specific system task area.
Additional details may be found in JEP 272 Platform-Specific Desktop Features.
The enhancements associated with this change are 8143227, 8164536, and 8166594.
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 custom java.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 is 8130478.
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 (see 8133453). 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 is 8133453.
AWT: Deprecate JDK 1.0 era constants in
java.awt.event
The java.awt.event.InputEvent contained 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, and java.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 is 8143077.
AWT: Improve HeadlessException specification
The specification for java.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 is 8016313.
AWT: Resolve
Toolkit.isDynamicLayoutActive()
contradictionThe specification for java.awt.Toolkit.isDynamicLayoutActive was updated to describe the relationship between this method and java.awt.Toolkit.isDynamicLayoutSet.
The bug associated with this change is 8027324.
AWT: Generify
ParameterBlock.getParamClasses
The return type of method java.awt.image.renderable.ParameterBlock.getParamClasses was paramaterized with an unbounded wildcard (
<?>
). This change was motivated by a desire to reduce build warnings.The bug associated with this change is 8039109.
AWT: Add missing specification in
java.awt
packageA number of
@param
,@return
, and@throws
declarations were missing from many methods in the java.awt package. 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 is 8043967.
AWT: Add
Component.setMixingCutoutShape()
The method java.awt.Component.setMixingCutoutShape was added to to set a ‘mixing-cutout’ shape for lightweight components only.
The bug associated with this change is 8173409.
AWT: Remove references to implementation-specific configuration files
The specification of method java.awt.Toolkit.getSystemClipboard was 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 of JEP 162 Prepare for Modularization.The enhancement associated with this change is 8047336.
AWT: Specify behaviour of
null
input forCanvas
constructorThe constructor specification of java.awt.Canvas.Canvas was refined to describe long-standing behaviour on
null
. When invoked withnull
, the default java.awt.GraphicsConfiguration will be used to construct the new java.awt.Canvas.The bug associated with this change is 4703110.
AWT: Specify when
null
will be returned byComponent.create*Image()
The specifications for the return value of java.awt.Component.createImage, java.awt.Component.createVolatileImage(int,int), and java.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 is 6815345.
AWT: Extend
FocusEvent
to include a “cause”The java.awt.event.FocusEvent class 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 in java.awt.Component: java.awt.Component.requestFocus(FocusEvent.Cause) java.awt.Component.requestFocus(Boolean,FocusEventCause) java.awt.Component.requestFocusInWindow.
The enhancements associated with this change are 8080395 and 8154434.
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), and java.awt.TrayIcon.setToolTip was updated to reflect this long-standing platform-dependent behaviour.
The bug associated with this change is 8117886.
AWT: Declare platform-dependence of
FileDialog
titleThe display of a user-specified title in a java.awt.FileDialog may 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), and java.awt.FileDialog.setTitle.
AWT: Extend
Component.FlipBufferStrategy
to support appletsWhen applets requested a flip buffer strategy using the java.awt.Component.FlipBufferStrategy nested class, a java.lang.ClassCastException was thrown because applets were not supported. Changes to the specification for the class and constructor were required.
The bug associated with this change is 8130390.
AWT: Remove
BorderLayout
reference to historical releaseThe class specification of java.awt.BorderLayout referenced 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 is 8153184.
AWT: Define new line handling in
TextField
The specifications of java.awt.TextField.TextField(String), java.awt.TextField.TextField(String,int), and java.awt.TextField.setText were updated to document the long-standing behaviour of replacing all EOL and LF characters with a space.
The bugs associated with this change are 8145284 and 8160056.
AWT: Add
serialVersionUID
field to serializable types in thejava.awt.*
packagesSome serializable types in java.awt.color, java.awt.geom, java.awt.image, and java.awt.print did 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, and java.awt.print.PrinterException.The bug associated with this change is 8033526.
2D: Enhance the specification for
ServiceUI.printDialog()
parametersThe specifications of the
x
andy
parameters of javax.print.ServiceUI.printDialog were enhanced to declare that the screen coordinates are relative to the origin of the provided java.awt.GraphicsConfiguration.The bug associated with this change is 6212751.
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, and javax.swing.text.InternationalFormatter.getMaximum.
The bugs associated with this change are 8043549 and 8055059.
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, and javax.swing.tree.DefaultMutableTreeNode.pathFromAncestorEnumeration.
The bugs associated with this change are 8043550, 8054360, and 8055254.
Swing: Generify
javax.swing.*
packagesMethods in packages javax.swing.text, javax.swing.plaf, javax.swing.plaf.basic, javax.swing.plaf.metal, javax.swing.plaf.multi, javax.swing.plaf.nimbus, and javax.swing.plaf.synth were paramaterized. This change was motivated by a desire to reduce build warnings.
The bug associated with this change is 8043548.
Swing: Add
JComponent.getUI()
Method javax.swing.JComponent.getUI was added to return the look and feel delegate that renders the component. The declaration includes the java.beans.Transient annotation indicating that this method may be ignored by all subclasses of java.beans.Encoder.
The enhancements associated with this change are 4339584 and 8131754.
Swing: Add
JTableHeader.getPreferredSize()
Override method javax.swing.table.JTableHeader.getPreferredSize was 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 is 4473075.
Swing: Revise
TableColumn.addPropertyChangeListener()
The specification of javax.swing.table.TableColumn.addPropertyChangeListener was re-written to document existing behaviour and remove references to invalid APIs.
The bug associated with this change is 4849595.
Swing: Define behavior for
null
parameter inJInternalFrame.setLayer()
The specification of method javax.swing.JInternalFrame.setLayer was updated to match the long-standing behaviour to throw a java.lang.NullPointerException when the provider parameter is
null
.The bug associated with this change is 6206439.
Swing: Provide missing specification for methods in
javax.swing.*
packagesThe specifications of 45 methods in javax.swing.border package and classes javax.swing.colorchooser.AbstractColorChooserPanel, javax.swing.filechooser.FileFilter, javax.swing.filechooser.FileSystemView, and javax.swing.filechooser.FileView were enhanced with the addition of
@param
and@return
tags to describe the methods expected parameters and return value.The bugs associated with this change are 8039966 and 8040893.
Swing: Add
{JLayer,LayerUI}.imageUpdate()
New method javax.swing.JLayer.imageUpdate was added to the final
JLayer
class. It delegate to javax.swing.plaf.LayerUI.imageUpdate which 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.setColorTransparencySelectionEnabled and javax.swing.colorchooser.AbstractColorChooserPanel.isColorTransparencySelectionEnabled which set and query the controls respectively, constant javax.swing.colorchooser.AbstractColorChooserPanel.TRANSPARENCY_ENABLED_PROPERTY which indicates that the color transparency may be selected, and method override javax.swing.JColorChooser.showDialog which shows the modal color-chooser dialog with color transparency selection optionally enabled.
The enhancement associated with this change is 8051548.
Swing: Redesign
JLayer.{get,set}Border()
The javax.swing.JLayer.setBorder and javax.swing.JLayer.getBorder methods were redesigned to delegate to the
JLayer
’s view component. Prior to this change, they always threw java.lang.IllegalArgumentException.Swing: Add missing specification to
javax.swing.text.html
The specification of over 200 methods and fields in javax.swing.text.html was 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, and javax.swing.text.html.StyleSheet.
The bug associated with this change is 8046446.
Swing: Add missing specification to
javax.swing.plaf.basic
The specification of over 100 methods and fields in javax.swing.plaf.basic was 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, and javax.swing.plaf.basic.BasicTableUI.
The bug associated with this change is 8049704.
Sound: Add
serialVersionUID
field to serializable types in thejavax.imageio.*
packagesSome serializable types in javax.sound.midi and javax.sound.sampled did 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, and javax.sound.sampled.UnsupportedAudioFileException.The bug associated with this change is 8034046.
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 throw java.lang.NullPointerException when 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, and javax.sound.midi.spi.MidiDeviceProvider.getDevice.The bug associated with this change is 8143909.
Sound: Specify behaviour on
null
argument for methods in packagejavax.sound.sampled
The specification of methods in javax.sound.sampled and javax.sound.sampled.spi was updated to consistently throw java.lang.NullPointerException when passed
null
. The only exception to this is javax.sound.sampled.spi.MixerProvider.getMixer which 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, and javax.sound.sampled.spi.MixerProvider.getMixer.The bug associated with this change is 8135100.
Sound: Enhance
AudioInputStream.skip()
The specification for javax.sound.sampled.AudioInputStream.skip was 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 is 8132782.
XML Parsing: Support XML Catalog
A standard XML Catalog API that supports OASIS XML Catalogs standard, v1.1 was 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.catalog package 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 interface javax.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), and javax.xml.transform.URIResolver (Schema Validation and Transform).
- The class javax.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 class javax.xml.catalog.CatalogFeatures.Builder which is used to build a javax.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 constant javax.xml.XMLConstants.USE_CATALOG.
Additional details may be found in JEP 268 XML Catalogs.
The enhancements associated with this change are 8081248, 8144966, 8163232, 8171243, and 8158084.
XML Parsing: Specify behaviour of XPath for
null
contextThe class specification for javax.xml.xpath.XPath was aligned with the specification for javax.xml.xpath.XPath.evaluate which defines the long-standing behaviour for a
null
context.The bug associated with this change is 6211561.
XML Parsing: Deprecate
XMLReaderFactory
The class org.xml.sax.helpers.XMLReaderFactory including both of its static methods, org.xml.sax.helpers.XMLReaderFactory.createXMLReader() and org.xml.sax.helpers.XMLReaderFactory.createXMLReader(String), were deprecated in favor of javax.xml.parsers.SAXParserFactory which 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 is 8152912.
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, and javax.xml.xpath.XPathFactory.The enhancement associated with this change is 8049378.
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, and org.xml.sax.InputSource.isEmpty.The enhancement associated with this change is 8144967.
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 is 8169778.
XML Parsing: Support complete DOM API
Two packages from JSR 206: Java API for XML Processing (JAXP) were added, thus providing support for all DOM APIs. The org.w3c.dom.ranges package contains interfaces supporting dynamic document traversal and identification of a content’s range. The org.w3c.dom.traversal package contains interfaces supporting document node traversal.
The enhancement associated with this change is 8023276.
XML Parsing: Add
ElementTraversal
The new interface, org.w3c.dom.ElementTraversal, defined by the W3C Element Traversal Specification was added It provides a set of read-only attributes which allow navigation between document elements.
The enhancement associated with this change is 8135283.
XML Parsing: Generify
javax.xml*
packagesMethods in packages javax.xml.stream, javax.xml.stream.events, and javax.xml.stream.util were paramaterized. This change was motivated by a desire to reduce build warnings.
The bug associated with this change is 8170556.
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 the org.w3c.dom package specification.
The bug associated with this change is 8037948.
XML Parsing: Support any data type
The javax.xml.xpath package was extended to support any data type in addition to previously defined explicit types. Several changes were necessary:
- The new interface javax.xml.xpath.XPathEvaluationResult and the type-safe enum javax.xml.xpath.XPathEvaluationResult.XPathResultType were defined to represent the result of an evaluation an XPath expression when the return type is unknown.
- The new interface javax.xml.xpath.XPathNodes was introduced to represent a set of nodes selected by a location path.
- In javax.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), and javax.xml.xpath.XPath.evaluateExpression(String,InputSource,Class).
- In javax.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), and javax.xml.xpath.XPathExpression.evaluateExpression(InputSource,Class).
The bug associated with this change is 8054196.
XML Parsing: Specify exceptional conditions for
XPath
The class specification of javax.xml.xpath.XPath was updated to describe the long-standing behaviour to throw a javax.xml.xpath.XPathExpressionException when the value is
null
and the operation has no dependency on the context.The bug associated with this change is 6211561.
STaX: Update
XML{Event,Stream}?Reader
conditions forSTART_DOCUMENT
returnThe class specification for javax.xml.stream.XMLStreamReader was updated to return
START_DOCUMENT
whenever XML document processing begins without an XML declaration. Further adjustments were necessary for javax.xml.stream.XMLStreamReader.getEventType and javax.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, and javax.xml.stream.XMLEventReader.nextTag.The bug associated with this change is 8069098.
java.lang.instrument: Specify class loader for agent JAR files
The java.lang.instrument package 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 define java.lang.instrument.Instrumentation.appendToSystemClassLoaderSearch for the agent to be loaded at start-up.
The bug associated with this change is 8160950.