This commit is contained in:
Jesper Wilhelmsson 2017-11-07 08:47:47 +01:00
commit 3c76c33dba
313 changed files with 8110 additions and 11952 deletions

View file

@ -698,7 +698,7 @@ public final class FilePermission extends Permission implements Serializable {
if (p2.equals(EMPTY_PATH)) {
return 0;
} else if (p2.getName(0).equals(DOTDOT_PATH)) {
// "." contains p2 iif p2 has no "..". Since a
// "." contains p2 iff p2 has no "..". Since
// a normalized path can only have 0 or more
// ".." at the beginning. We only need to look
// at the head.
@ -711,7 +711,7 @@ public final class FilePermission extends Permission implements Serializable {
} else if (p2.equals(EMPTY_PATH)) {
int c1 = p1.getNameCount();
if (!p1.getName(c1 - 1).equals(DOTDOT_PATH)) {
// "." is inside p1 iif p1 is 1 or more "..".
// "." is inside p1 iff p1 is 1 or more "..".
// For the same reason above, we only need to
// look at the tail.
return -1;

View file

@ -57,8 +57,6 @@ import java.util.stream.Stream;
import jdk.internal.loader.BuiltinClassLoader;
import jdk.internal.loader.BootLoader;
import jdk.internal.loader.ClassLoaders;
import jdk.internal.misc.JavaLangAccess;
import jdk.internal.misc.SharedSecrets;
import jdk.internal.module.IllegalAccessLogger;
import jdk.internal.module.ModuleLoaderMap;
import jdk.internal.module.ServicesCatalog;
@ -68,6 +66,7 @@ import jdk.internal.org.objectweb.asm.Attribute;
import jdk.internal.org.objectweb.asm.ClassReader;
import jdk.internal.org.objectweb.asm.ClassVisitor;
import jdk.internal.org.objectweb.asm.ClassWriter;
import jdk.internal.org.objectweb.asm.ModuleVisitor;
import jdk.internal.org.objectweb.asm.Opcodes;
import jdk.internal.reflect.CallerSensitive;
import jdk.internal.reflect.Reflection;
@ -1432,7 +1431,7 @@ public final class Module implements AnnotatedElement {
ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS
+ ClassWriter.COMPUTE_FRAMES);
ClassVisitor cv = new ClassVisitor(Opcodes.ASM5, cw) {
ClassVisitor cv = new ClassVisitor(Opcodes.ASM6, cw) {
@Override
public void visit(int version,
int access,
@ -1458,6 +1457,11 @@ public final class Module implements AnnotatedElement {
public void visitAttribute(Attribute attr) {
// drop non-annotation attributes
}
@Override
public ModuleVisitor visitModule(String name, int flags, String version) {
// drop Module attribute
return null;
}
};
ClassReader cr = new ClassReader(in);

View file

@ -1937,7 +1937,7 @@ public final class System {
// initialization. So make sure the "props" is available at the
// very beginning of the initialization and all system properties to
// be put into it directly.
props = new Properties();
props = new Properties(84);
initProperties(props); // initialized by the VM
// There are certain system configurations that may be controlled by

View file

@ -765,7 +765,7 @@ public abstract class MethodHandle {
* In every other case, all conversions are applied <em>pairwise</em>,
* which means that each argument or return value is converted to
* exactly one argument or return value (or no return value).
* The applied conversions are defined by consulting the
* The applied conversions are defined by consulting
* the corresponding component types of the old and new
* method handle types.
* <p>

View file

@ -194,7 +194,7 @@ public final class StringConcatFactory {
static {
// In case we need to double-back onto the StringConcatFactory during this
// static initialization, make sure we have the reasonable defaults to complete
// the static initialization properly. After that, actual users would use the
// the static initialization properly. After that, actual users would use
// the proper values we have read from the properties.
STRATEGY = DEFAULT_STRATEGY;
// CACHE_ENABLE = false; // implied

View file

@ -205,7 +205,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
* and {@code double} on 32-bit platforms.
*
* <p>Access modes will override any memory ordering effects specified at
* the declaration site of a variable. For example, a VarHandle accessing a
* the declaration site of a variable. For example, a VarHandle accessing
* a field using the {@code get} access mode will access the field as
* specified <em>by its access mode</em> even if that field is declared
* {@code volatile}. When mixed access is performed extreme care should be
@ -423,7 +423,7 @@ import static java.lang.invoke.MethodHandleStatics.newInternalError;
* {@link java.lang.invoke.MethodHandles#varHandleInvoker}.
*
* <h1>Interoperation between VarHandles and Java generics</h1>
* A VarHandle can be obtained for a variable, such as a a field, which is
* A VarHandle can be obtained for a variable, such as a field, which is
* declared with Java generic types. As with the Core Reflection API, the
* VarHandle's variable type will be constructed from the erasure of the
* source-level type. When a VarHandle access mode method is invoked, the

View file

@ -988,7 +988,7 @@ class DatagramSocket implements java.io.Closeable {
/**
* Sets the SO_RCVBUF option to the specified value for this
* {@code DatagramSocket}. The SO_RCVBUF option is used by the
* {@code DatagramSocket}. The SO_RCVBUF option is used by
* the network implementation as a hint to size the underlying
* network I/O buffers. The SO_RCVBUF setting may also be used
* by the network implementation to determine the maximum size

View file

@ -143,7 +143,7 @@ class Inet4Address extends InetAddress {
/**
* Prior to 1.4 an InetAddress was created with a family
* based on the platform AF_INET value (usually 2).
* For compatibility reasons we must therefore write the
* For compatibility reasons we must therefore write
* the InetAddress with this family.
*/
inet.holder().family = 2;

View file

@ -333,7 +333,7 @@ public abstract class SocketImpl implements SocketOptions {
* latency, and low latency above short connection time, then it could
* invoke this method with the values {@code (0, 1, 2)}.
*
* By default, this method does nothing, unless it is overridden in a
* By default, this method does nothing, unless it is overridden in
* a sub-class.
*
* @param connectionTime

View file

@ -657,7 +657,7 @@ class SocksSocketImpl extends PlainSocketImpl implements SocksConsts {
/**
* Sends the Bind request to the SOCKS proxy. In the SOCKS protocol, bind
* means "accept incoming connection from", so the SocketAddress is the
* means "accept incoming connection from", so the SocketAddress is
* the one of the host we do accept connection from.
*
* @param saddr the Socket address of the remote host.

View file

@ -785,7 +785,7 @@ public abstract class URLConnection {
* required to make the connection. By default, this method
* returns {@code java.security.AllPermission}. Subclasses
* should override this method and return the permission
* that best represents the permission required to make a
* that best represents the permission required to make
* a connection to the URL. For example, a {@code URLConnection}
* representing a {@code file:} URL would return a
* {@code java.io.FilePermission} object.

View file

@ -165,7 +165,7 @@ public abstract class AsynchronousFileChannel
* <tr>
* <th scope="row" > {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} </th>
* <td> When this option is present then the implementation makes a
* <em>best effort</em> attempt to delete the file when closed by the
* <em>best effort</em> attempt to delete the file when closed by
* the {@link #close close} method. If the {@code close} method is not
* invoked then a <em>best effort</em> attempt is made to delete the file
* when the Java virtual machine terminates. </td>

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -368,6 +368,10 @@ public final class Channels {
@Override
public int read(ByteBuffer dst) throws IOException {
if (!isOpen()) {
throw new ClosedChannelException();
}
int len = dst.remaining();
int totalRead = 0;
int bytesRead = 0;
@ -442,6 +446,10 @@ public final class Channels {
@Override
public int write(ByteBuffer src) throws IOException {
if (!isOpen()) {
throw new ClosedChannelException();
}
int len = src.remaining();
int totalWritten = 0;
synchronized (writeLock) {

View file

@ -216,7 +216,7 @@ public abstract class FileChannel
* <tr>
* <th scope="row" > {@link StandardOpenOption#DELETE_ON_CLOSE DELETE_ON_CLOSE} </th>
* <td> When this option is present then the implementation makes a
* <em>best effort</em> attempt to delete the file when closed by the
* <em>best effort</em> attempt to delete the file when closed by
* the {@link #close close} method. If the {@code close} method is not
* invoked then a <em>best effort</em> attempt is made to delete the file
* when the Java virtual machine terminates. </td>

View file

@ -2401,7 +2401,7 @@ public final class Files {
*
* <p> Note that the result of this method is immediately outdated. If this
* method indicates the file exists then there is no guarantee that a
* subsequence access will succeed. Care should be taken when using this
* subsequent access will succeed. Care should be taken when using this
* method in security sensitive applications.
*
* @param path
@ -2458,7 +2458,7 @@ public final class Files {
* or not then both methods return {@code false}. As with the {@code exists}
* method, the result of this method is immediately outdated. If this
* method indicates the file does exist then there is no guarantee that a
* subsequence attempt to create the file will succeed. Care should be taken
* subsequent attempt to create the file will succeed. Care should be taken
* when using this method in security sensitive applications.
*
* @param path
@ -3301,7 +3301,7 @@ public final class Files {
}
/**
* Writes bytes to a file. The {@code options} parameter specifies how the
* Writes bytes to a file. The {@code options} parameter specifies how
* the file is created or opened. If no options are present then this method
* works as if the {@link StandardOpenOption#CREATE CREATE}, {@link
* StandardOpenOption#TRUNCATE_EXISTING TRUNCATE_EXISTING}, and {@link

View file

@ -84,7 +84,7 @@ import sun.security.util.Debug;
* exists (e.g., so-called <i>community parameters</i> in DSA), there are two
* {@link #initialize(java.security.spec.AlgorithmParameterSpec)
* initialize} methods that have an {@code AlgorithmParameterSpec}
* argument. One also has a {@code SecureRandom} argument, while the
* argument. One also has a {@code SecureRandom} argument, while
* the other uses the {@code SecureRandom}
* implementation of the highest-priority installed provider as the source
* of randomness. (If none of the installed providers supply an implementation

View file

@ -4775,7 +4775,7 @@ public final class DateTimeFormatterBuilder {
//-----------------------------------------------------------------------
/**
* Prints or parses a localized pattern from a localized field.
* The specific formatter and parameters is not selected until the
* The specific formatter and parameters is not selected until
* the field is to be printed or parsed.
* The locale is needed to select the proper WeekFields from which
* the field for day-of-week, week-of-month, or week-of-year is selected.

View file

@ -311,7 +311,7 @@ public final class WeekFields implements Serializable {
* the new month or year.
* <p>
* WeekFields instances are singletons; for each unique combination
* of {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek} the
* of {@code firstDayOfWeek} and {@code minimalDaysInFirstWeek}
* the same instance will be returned.
*
* @param firstDayOfWeek the first day of the week, not null

View file

@ -56,7 +56,7 @@ import java.nio.charset.StandardCharsets;
* base64 alphabet.</p></li>
*
* <li><a id="mime"><b>MIME</b></a>
* <p> Uses the "The Base64 Alphabet" as specified in Table 1 of
* <p> Uses "The Base64 Alphabet" as specified in Table 1 of
* RFC 2045 for encoding and decoding operation. The encoded output
* must be represented in lines of no more than 76 characters each
* and uses a carriage return {@code '\r'} followed immediately by

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,6 +26,7 @@ package java.util;
import java.util.function.DoubleConsumer;
import java.util.stream.Collector;
import java.util.stream.DoubleStream;
/**
* A state object for collecting statistics such as count, min, max, sum, and
@ -69,12 +70,65 @@ public class DoubleSummaryStatistics implements DoubleConsumer {
private double max = Double.NEGATIVE_INFINITY;
/**
* Construct an empty instance with zero count, zero sum,
* Constructs an empty instance with zero count, zero sum,
* {@code Double.POSITIVE_INFINITY} min, {@code Double.NEGATIVE_INFINITY}
* max and zero average.
*/
public DoubleSummaryStatistics() { }
/**
* Constructs a non-empty instance with the specified {@code count},
* {@code min}, {@code max}, and {@code sum}.
*
* <p>If {@code count} is zero then the remaining arguments are ignored and
* an empty instance is constructed.
*
* <p>If the arguments are inconsistent then an {@code IllegalArgumentException}
* is thrown. The necessary consistent argument conditions are:
* <ul>
* <li>{@code count >= 0}</li>
* <li>{@code (min <= max && !isNaN(sum)) || (isNaN(min) && isNaN(max) && isNaN(sum))}</li>
* </ul>
* @apiNote
* The enforcement of argument correctness means that the retrieved set of
* recorded values obtained from a {@code DoubleSummaryStatistics} source
* instance may not be a legal set of arguments for this constructor due to
* arithmetic overflow of the source's recorded count of values.
* The consistent argument conditions are not sufficient to prevent the
* creation of an internally inconsistent instance. An example of such a
* state would be an instance with: {@code count} = 2, {@code min} = 1,
* {@code max} = 2, and {@code sum} = 0.
*
* @param count the count of values
* @param min the minimum value
* @param max the maximum value
* @param sum the sum of all values
* @throws IllegalArgumentException if the arguments are inconsistent
* @since 10
*/
public DoubleSummaryStatistics(long count, double min, double max, double sum)
throws IllegalArgumentException {
if (count < 0L) {
throw new IllegalArgumentException("Negative count value");
} else if (count > 0L) {
if (min > max)
throw new IllegalArgumentException("Minimum greater than maximum");
// All NaN or non NaN
var ncount = DoubleStream.of(min, max, sum).filter(Double::isNaN).count();
if (ncount > 0 && ncount < 3)
throw new IllegalArgumentException("Some, not all, of the minimum, maximum, or sum is NaN");
this.count = count;
this.sum = sum;
this.simpleSum = sum;
this.sumCompensation = 0.0d;
this.min = min;
this.max = max;
}
// Use default field values if count == 0
}
/**
* Records another value into the summary information.
*

View file

@ -43,13 +43,13 @@ public class EventObject implements java.io.Serializable {
/**
* The object on which the Event initially occurred.
*/
protected transient Object source;
protected transient Object source;
/**
* Constructs a prototypical Event.
*
* @param source The object on which the Event initially occurred.
* @exception IllegalArgumentException if source is null.
* @param source the object on which the Event initially occurred
* @throws IllegalArgumentException if source is null
*/
public EventObject(Object source) {
if (source == null)
@ -61,7 +61,7 @@ public class EventObject implements java.io.Serializable {
/**
* The object on which the Event initially occurred.
*
* @return The object on which the Event initially occurred.
* @return the object on which the Event initially occurred
*/
public Object getSource() {
return source;
@ -70,7 +70,7 @@ public class EventObject implements java.io.Serializable {
/**
* Returns a String representation of this EventObject.
*
* @return A a String representation of this EventObject.
* @return a String representation of this EventObject
*/
public String toString() {
return getClass().getName() + "[source=" + source + "]";

View file

@ -26,7 +26,7 @@
package java.util;
/**
* FomattableFlags are passed to the {@link Formattable#formatTo
* FormattableFlags are passed to the {@link Formattable#formatTo
* Formattable.formatTo()} method and modify the output format for {@linkplain
* Formattable Formattables}. Implementations of {@link Formattable} are
* responsible for interpreting and validating any flags.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -69,12 +69,57 @@ public class IntSummaryStatistics implements IntConsumer {
private int max = Integer.MIN_VALUE;
/**
* Construct an empty instance with zero count, zero sum,
* Constructs an empty instance with zero count, zero sum,
* {@code Integer.MAX_VALUE} min, {@code Integer.MIN_VALUE} max and zero
* average.
*/
public IntSummaryStatistics() { }
/**
* Constructs a non-empty instance with the specified {@code count},
* {@code min}, {@code max}, and {@code sum}.
*
* <p>If {@code count} is zero then the remaining arguments are ignored and
* an empty instance is constructed.
*
* <p>If the arguments are inconsistent then an {@code IllegalArgumentException}
* is thrown. The necessary consistent argument conditions are:
* <ul>
* <li>{@code count >= 0}</li>
* <li>{@code min <= max}</li>
* </ul>
* @apiNote
* The enforcement of argument correctness means that the retrieved set of
* recorded values obtained from a {@code IntSummaryStatistics} source
* instance may not be a legal set of arguments for this constructor due to
* arithmetic overflow of the source's recorded count of values.
* The consistent argument conditions are not sufficient to prevent the
* creation of an internally inconsistent instance. An example of such a
* state would be an instance with: {@code count} = 2, {@code min} = 1,
* {@code max} = 2, and {@code sum} = 0.
*
* @param count the count of values
* @param min the minimum value
* @param max the maximum value
* @param sum the sum of all values
* @throws IllegalArgumentException if the arguments are inconsistent
* @since 10
*/
public IntSummaryStatistics(long count, int min, int max, long sum)
throws IllegalArgumentException {
if (count < 0L) {
throw new IllegalArgumentException("Negative count value");
} else if (count > 0L) {
if (min > max) throw new IllegalArgumentException("Minimum greater than maximum");
this.count = count;
this.sum = sum;
this.min = min;
this.max = max;
}
// Use default field values if count == 0
}
/**
* Records a new value into the summary information
*

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -70,12 +70,57 @@ public class LongSummaryStatistics implements LongConsumer, IntConsumer {
private long max = Long.MIN_VALUE;
/**
* Construct an empty instance with zero count, zero sum,
* Constructs an empty instance with zero count, zero sum,
* {@code Long.MAX_VALUE} min, {@code Long.MIN_VALUE} max and zero
* average.
*/
public LongSummaryStatistics() { }
/**
* Constructs a non-empty instance with the specified {@code count},
* {@code min}, {@code max}, and {@code sum}.
*
* <p>If {@code count} is zero then the remaining arguments are ignored and
* an empty instance is constructed.
*
* <p>If the arguments are inconsistent then an {@code IllegalArgumentException}
* is thrown. The necessary consistent argument conditions are:
* <ul>
* <li>{@code count >= 0}</li>
* <li>{@code min <= max}</li>
* </ul>
* @apiNote
* The enforcement of argument correctness means that the retrieved set of
* recorded values obtained from a {@code LongSummaryStatistics} source
* instance may not be a legal set of arguments for this constructor due to
* arithmetic overflow of the source's recorded count of values.
* The consistent argument conditions are not sufficient to prevent the
* creation of an internally inconsistent instance. An example of such a
* state would be an instance with: {@code count} = 2, {@code min} = 1,
* {@code max} = 2, and {@code sum} = 0.
*
* @param count the count of values
* @param min the minimum value
* @param max the maximum value
* @param sum the sum of all values
* @throws IllegalArgumentException if the arguments are inconsistent
* @since 10
*/
public LongSummaryStatistics(long count, long min, long max, long sum)
throws IllegalArgumentException {
if (count < 0L) {
throw new IllegalArgumentException("Negative count value");
} else if (count > 0L) {
if (min > max) throw new IllegalArgumentException("Minimum greater than maximum");
this.count = count;
this.sum = sum;
this.min = min;
this.max = max;
}
// Use default field values if count == 0
}
/**
* Records a new {@code int} value into the summary information.
*

View file

@ -122,6 +122,10 @@ import jdk.internal.util.xml.PropertiesDefaultHandler;
* <p>This class is thread-safe: multiple threads can share a single
* {@code Properties} object without the need for external synchronization.
*
* @apiNote
* The {@code Properties} class does not inherit the concept of a load factor
* from its superclass, {@code Hashtable}.
*
* @author Arthur van Hoff
* @author Michael McCloskey
* @author Xueming Shen
@ -148,25 +152,49 @@ class Properties extends Hashtable<Object,Object> {
* simple read operations. Writes and bulk operations remain synchronized,
* as in Hashtable.
*/
private transient ConcurrentHashMap<Object, Object> map =
new ConcurrentHashMap<>(8);
private transient ConcurrentHashMap<Object, Object> map;
/**
* Creates an empty property list with no default values.
*
* @implNote The initial capacity of a {@code Properties} object created
* with this constructor is unspecified.
*/
public Properties() {
this(null);
this(null, 8);
}
/**
* Creates an empty property list with no default values, and with an
* initial size accommodating the specified number of elements without the
* need to dynamically resize.
*
* @param initialCapacity the {@code Properties} will be sized to
* accommodate this many elements
* @throws IllegalArgumentException if the initial capacity is less than
* zero.
*/
public Properties(int initialCapacity) {
this(null, initialCapacity);
}
/**
* Creates an empty property list with the specified defaults.
*
* @implNote The initial capacity of a {@code Properties} object created
* with this constructor is unspecified.
*
* @param defaults the defaults.
*/
public Properties(Properties defaults) {
this(defaults, 8);
}
private Properties(Properties defaults, int initialCapacity) {
// use package-private constructor to
// initialize unused fields with dummy values
super((Void) null);
map = new ConcurrentHashMap<>(initialCapacity);
this.defaults = defaults;
}

View file

@ -2743,7 +2743,7 @@ public abstract class ResourceBundle {
* of multiple subtags separated by underscore, generate candidate
* <code>Locale</code>s by omitting the variant subtags one by one, then
* insert them after every occurrence of <code> Locale</code>s with the
* full variant value in the original list. For example, if the
* full variant value in the original list. For example, if
* the variant consists of two subtags <em>V1</em> and <em>V2</em>:
*
* <ul>