This commit is contained in:
Jesper Wilhelmsson 2018-04-06 03:53:28 +02:00
commit 82847e4ec0
812 changed files with 22235 additions and 13150 deletions

View file

@ -129,7 +129,7 @@ public final class Boolean implements java.io.Serializable,
* @since 1.5
*/
public static boolean parseBoolean(String s) {
return ((s != null) && s.equalsIgnoreCase("true"));
return "true".equalsIgnoreCase(s);
}
/**

View file

@ -74,7 +74,7 @@ public interface CharSequence {
* indexing.
*
* <p>If the {@code char} value specified by the index is a
* <a href="{@docRoot}/java/lang/Character.html#unicode">surrogate</a>, the surrogate
* <a href="{@docRoot}/java.base/java/lang/Character.html#unicode">surrogate</a>, the surrogate
* value is returned.
*
* @param index the index of the {@code char} value to be returned
@ -119,7 +119,7 @@ public interface CharSequence {
/**
* Returns a stream of {@code int} zero-extending the {@code char} values
* from this sequence. Any char which maps to a <a
* href="{@docRoot}/java/lang/Character.html#unicode">surrogate code
* href="{@docRoot}/java.base/java/lang/Character.html#unicode">surrogate code
* point</a> is passed through uninterpreted.
*
* <p>The stream binds to this sequence when the terminal stream operation

View file

@ -73,7 +73,7 @@ import sun.security.util.SecurityConstants;
/**
* A class loader is an object that is responsible for loading classes. The
* class {@code ClassLoader} is an abstract class. Given the <a
* href="#name">binary name</a> of a class, a class loader should attempt to
* href="#binary-name">binary name</a> of a class, a class loader should attempt to
* locate or generate data that constitutes a definition for the class. A
* typical strategy is to transform the name into a file name and then read a
* "class file" of that name from a file system.
@ -202,7 +202,7 @@ import sun.security.util.SecurityConstants;
* }
* </pre></blockquote>
*
* <h3> <a id="name">Binary names</a> </h3>
* <h3> <a id="binary-name">Binary names</a> </h3>
*
* <p> Any class name provided as a {@code String} parameter to methods in
* {@code ClassLoader} must be a binary name as defined by
@ -480,7 +480,7 @@ public abstract class ClassLoader {
// -- Class --
/**
* Loads the class with the specified <a href="#name">binary name</a>.
* Loads the class with the specified <a href="#binary-name">binary name</a>.
* This method searches for classes in the same manner as the {@link
* #loadClass(String, boolean)} method. It is invoked by the Java virtual
* machine to resolve class references. Invoking this method is equivalent
@ -488,7 +488,7 @@ public abstract class ClassLoader {
* false)}.
*
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @return The resulting {@code Class} object
*
@ -500,7 +500,7 @@ public abstract class ClassLoader {
}
/**
* Loads the class with the specified <a href="#name">binary name</a>. The
* Loads the class with the specified <a href="#binary-name">binary name</a>. The
* default implementation of this method searches for classes in the
* following order:
*
@ -530,7 +530,7 @@ public abstract class ClassLoader {
* during the entire class loading process.
*
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @param resolve
* If {@code true} then resolve the class
@ -579,7 +579,7 @@ public abstract class ClassLoader {
}
/**
* Loads the class with the specified <a href="#name">binary name</a>
* Loads the class with the specified <a href="#binary-name">binary name</a>
* in a module defined to this class loader. This method returns {@code null}
* if the class could not be found.
*
@ -598,7 +598,7 @@ public abstract class ClassLoader {
* @param module
* The module
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @return The resulting {@code Class} object in a module defined by
* this class loader, or {@code null} if the class could not be found.
@ -674,7 +674,7 @@ public abstract class ClassLoader {
}
/**
* Finds the class with the specified <a href="#name">binary name</a>.
* Finds the class with the specified <a href="#binary-name">binary name</a>.
* This method should be overridden by class loader implementations that
* follow the delegation model for loading classes, and will be invoked by
* the {@link #loadClass loadClass} method after checking the
@ -683,7 +683,7 @@ public abstract class ClassLoader {
* @implSpec The default implementation throws {@code ClassNotFoundException}.
*
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @return The resulting {@code Class} object
*
@ -697,7 +697,7 @@ public abstract class ClassLoader {
}
/**
* Finds the class with the given <a href="#name">binary name</a>
* Finds the class with the given <a href="#binary-name">binary name</a>
* in a module defined to this class loader.
* Class loader implementations that support the loading from modules
* should override this method.
@ -715,7 +715,7 @@ public abstract class ClassLoader {
* class loader
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @return The resulting {@code Class} object, or {@code null}
* if the class could not be found.
@ -737,7 +737,7 @@ public abstract class ClassLoader {
* Converts an array of bytes into an instance of class {@code Class}.
* Before the {@code Class} can be used it must be resolved. This method
* is deprecated in favor of the version that takes a <a
* href="#name">binary name</a> as its first argument, and is more secure.
* href="#binary-name">binary name</a> as its first argument, and is more secure.
*
* @param b
* The bytes that make up the class data. The bytes in positions
@ -804,12 +804,12 @@ public abstract class ClassLoader {
* This method defines a package in this class loader corresponding to the
* package of the {@code Class} (if such a package has not already been defined
* in this class loader). The name of the defined package is derived from
* the <a href="#name">binary name</a> of the class specified by
* the <a href="#binary-name">binary name</a> of the class specified by
* the byte array {@code b}.
* Other properties of the defined package are as specified by {@link Package}.
*
* @param name
* The expected <a href="#name">binary name</a> of the class, or
* The expected <a href="#binary-name">binary name</a> of the class, or
* {@code null} if not known
*
* @param b
@ -923,7 +923,7 @@ public abstract class ClassLoader {
* package must contain the same set of certificates or a
* {@code SecurityException} will be thrown. Note that if
* {@code name} is {@code null}, this check is not performed.
* You should always pass in the <a href="#name">binary name</a> of the
* You should always pass in the <a href="#binary-name">binary name</a> of the
* class you are defining as well as the bytes. This ensures that the
* class you are defining is indeed the class you think it is.
*
@ -931,19 +931,19 @@ public abstract class ClassLoader {
* only be defined by the {@linkplain #getPlatformClassLoader()
* platform class loader} or its ancestors; otherwise {@code SecurityException}
* will be thrown. If {@code name} is not {@code null}, it must be equal to
* the <a href="#name">binary name</a> of the class
* the <a href="#binary-name">binary name</a> of the class
* specified by the byte array {@code b}, otherwise a {@link
* NoClassDefFoundError NoClassDefFoundError} will be thrown.
*
* <p> This method defines a package in this class loader corresponding to the
* package of the {@code Class} (if such a package has not already been defined
* in this class loader). The name of the defined package is derived from
* the <a href="#name">binary name</a> of the class specified by
* the <a href="#binary-name">binary name</a> of the class specified by
* the byte array {@code b}.
* Other properties of the defined package are as specified by {@link Package}.
*
* @param name
* The expected <a href="#name">binary name</a> of the class, or
* The expected <a href="#binary-name">binary name</a> of the class, or
* {@code null} if not known
*
* @param b
@ -969,7 +969,7 @@ public abstract class ClassLoader {
*
* @throws NoClassDefFoundError
* If {@code name} is not {@code null} and not equal to the
* <a href="#name">binary name</a> of the class specified by {@code b}
* <a href="#binary-name">binary name</a> of the class specified by {@code b}
*
* @throws IndexOutOfBoundsException
* If either {@code off} or {@code len} is negative, or if
@ -1027,7 +1027,7 @@ public abstract class ClassLoader {
* </code></p>
*
* @param name
* The expected <a href="#name">binary name</a>. of the class, or
* The expected <a href="#binary-name">binary name</a>. of the class, or
* {@code null} if not known
*
* @param b
@ -1047,7 +1047,7 @@ public abstract class ClassLoader {
*
* @throws NoClassDefFoundError
* If {@code name} is not {@code null} and not equal to the
* <a href="#name">binary name</a> of the class specified by {@code b}
* <a href="#binary-name">binary name</a> of the class specified by {@code b}
*
* @throws SecurityException
* If an attempt is made to add this class to a package that
@ -1198,7 +1198,7 @@ public abstract class ClassLoader {
}
/**
* Finds a class with the specified <a href="#name">binary name</a>,
* Finds a class with the specified <a href="#binary-name">binary name</a>,
* loading it if necessary.
*
* <p> This method loads the class through the system class loader (see
@ -1209,7 +1209,7 @@ public abstract class ClassLoader {
* #findClass(String)}. </p>
*
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @return The {@code Class} object for the specified {@code name}
*
@ -1239,13 +1239,13 @@ public abstract class ClassLoader {
private native Class<?> findBootstrapClass(String name);
/**
* Returns the class with the given <a href="#name">binary name</a> if this
* Returns the class with the given <a href="#binary-name">binary name</a> if this
* loader has been recorded by the Java virtual machine as an initiating
* loader of a class with that <a href="#name">binary name</a>. Otherwise
* loader of a class with that <a href="#binary-name">binary name</a>. Otherwise
* {@code null} is returned.
*
* @param name
* The <a href="#name">binary name</a> of the class
* The <a href="#binary-name">binary name</a> of the class
*
* @return The {@code Class} object, or {@code null} if the class has
* not been loaded
@ -2087,9 +2087,9 @@ public abstract class ClassLoader {
}
/**
* Defines a package by <a href="#name">name</a> in this {@code ClassLoader}.
* Defines a package by <a href="#binary-name">name</a> in this {@code ClassLoader}.
* <p>
* <a href="#name">Package names</a> must be unique within a class loader and
* <a href="#binary-name">Package names</a> must be unique within a class loader and
* cannot be redefined or changed once created.
* <p>
* If a class loader wishes to define a package with specific properties,
@ -2123,7 +2123,7 @@ public abstract class ClassLoader {
* in a named module may be for example sealed with different seal base.
*
* @param name
* The <a href="#name">package name</a>
* The <a href="#binary-name">package name</a>
*
* @param specTitle
* The specification title
@ -2185,10 +2185,10 @@ public abstract class ClassLoader {
}
/**
* Returns a {@code Package} of the given <a href="#name">name</a> that
* Returns a {@code Package} of the given <a href="#binary-name">name</a> that
* has been defined by this class loader.
*
* @param name The <a href="#name">package name</a>
* @param name The <a href="#binary-name">package name</a>
*
* @return The {@code Package} of the given name that has been defined
* by this class loader, or {@code null} if not found
@ -2233,7 +2233,7 @@ public abstract class ClassLoader {
}
/**
* Finds a package by <a href="#name">name</a> in this class loader and its ancestors.
* Finds a package by <a href="#binary-name">name</a> in this class loader and its ancestors.
* <p>
* If this class loader defines a {@code Package} of the given name,
* the {@code Package} is returned. Otherwise, the ancestors of
@ -2247,7 +2247,7 @@ public abstract class ClassLoader {
* class loader.
*
* @param name
* The <a href="#name">package name</a>
* The <a href="#binary-name">package name</a>
*
* @return The {@code Package} of the given name that has been defined by
* this class loader or its ancestors, or {@code null} if not found.

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -84,7 +84,7 @@ import java.util.*;
* {(x, y) such that x.equals(y)}. </pre><p>
*
* This interface is a member of the
* <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
* <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
* Java Collections Framework</a>.
*
* @param <T> the type of objects that this object may be compared to

View file

@ -1574,13 +1574,7 @@ public final class Integer extends Number implements Comparable<Integer> {
* @since 1.5
*/
public static int highestOneBit(int i) {
// HD, Figure 3-1
i |= (i >> 1);
i |= (i >> 2);
i |= (i >> 4);
i |= (i >> 8);
i |= (i >> 16);
return i - (i >>> 1);
return i & (MIN_VALUE >>> numberOfLeadingZeros(i));
}
/**

View file

@ -1719,14 +1719,7 @@ public final class Long extends Number implements Comparable<Long> {
* @since 1.5
*/
public static long highestOneBit(long i) {
// HD, Figure 3-1
i |= (i >> 1);
i |= (i >> 2);
i |= (i >> 4);
i |= (i >> 8);
i |= (i >> 16);
i |= (i >> 32);
return i - (i >>> 1);
return i & (MIN_VALUE >>> numberOfLeadingZeros(i));
}
/**

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -80,7 +80,7 @@ import java.util.stream.Stream;
*
* <p>
* The {@code ProcessHandle} static factory methods return instances that are
* <a href="{@docRoot}/java/lang/doc-files/ValueBased.html">value-based</a>,
* <a href="{@docRoot}/java.base/java/lang/doc-files/ValueBased.html">value-based</a>,
* immutable and thread-safe.
* Use of identity-sensitive operations (including reference equality
* ({@code ==}), identity hash code, or synchronization) on these instances of

View file

@ -1140,7 +1140,7 @@ public class Runtime {
* number is not the major-release number but the feature-release
* counter, incremented for every time-based release. Use the {@link
* #feature()} method in preference to this method. For compatibility,
* this method returns the value of the <a href="FEATURE">feature</a>
* this method returns the value of the <a href="#FEATURE">feature</a>
* element.
*
* @return The value of the feature element
@ -1158,7 +1158,7 @@ public class Runtime {
* number is not the minor-release number but the interim-release
* counter, incremented for every interim release. Use the {@link
* #interim()} method in preference to this method. For compatibility,
* this method returns the value of the <a href="INTERIM">interim</a>
* this method returns the value of the <a href="#INTERIM">interim</a>
* element, or zero if it is absent.
*
* @return The value of the interim element, or zero
@ -1176,7 +1176,7 @@ public class Runtime {
* number is not the security level but the update-release counter,
* incremented for every update release. Use the {@link #update()}
* method in preference to this method. For compatibility, this method
* returns the value of the <a href="UPDATE">update</a> element, or
* returns the value of the <a href="#UPDATE">update</a> element, or
* zero if it is absent.
*
* @return The value of the update element, or zero
@ -1188,9 +1188,9 @@ public class Runtime {
/**
* Returns an unmodifiable {@link java.util.List List} of the integers
* represented in the <a href="#verNum">version number</a>. The {@code
* List} always contains at least one element corresponding to the <a
* href="#feature">feature version number</a>.
* represented in the <a href="#verNum">version number</a>.
* The {@code List} always contains at least one element corresponding to
* the <a href="#FEATURE">feature version number</a>.
*
* @return An unmodifiable list of the integers
* represented in the version number

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1995, 2018, 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
@ -235,19 +235,6 @@ public class SecurityManager {
*/
private boolean initialized = false;
/**
* returns true if the current context has been granted AllPermission
*/
private boolean hasAllPermission() {
try {
checkPermission(SecurityConstants.ALL_PERMISSION);
return true;
} catch (SecurityException se) {
return false;
}
}
/**
* Constructs a new <code>SecurityManager</code>.
*
@ -1080,28 +1067,6 @@ public class SecurityManager {
SecurityConstants.PROPERTY_READ_ACTION));
}
/**
* Returns {@code true} if the calling thread has {@code AllPermission}.
*
* @param window not used except to check if it is {@code null}.
* @return {@code true} if the calling thread has {@code AllPermission}.
* @exception NullPointerException if the {@code window} argument is
* {@code null}.
* @deprecated This method was originally used to check if the calling thread
* was trusted to bring up a top-level window. The method has been
* obsoleted and code should instead use {@link #checkPermission}
* to check {@code AWTPermission("showWindowWithoutWarningBanner")}.
* This method is subject to removal in a future version of Java SE.
* @see #checkPermission(java.security.Permission) checkPermission
*/
@Deprecated(since="1.8", forRemoval=true)
public boolean checkTopLevelWindow(Object window) {
if (window == null) {
throw new NullPointerException("window can't be null");
}
return hasAllPermission();
}
/**
* Throws a <code>SecurityException</code> if the
* calling thread is not allowed to initiate a print job request.
@ -1124,44 +1089,6 @@ public class SecurityManager {
checkPermission(new RuntimePermission("queuePrintJob"));
}
/**
* Throws {@code SecurityException} if the calling thread does
* not have {@code AllPermission}.
*
* @since 1.1
* @exception SecurityException if the calling thread does not have
* {@code AllPermission}
* @deprecated This method was originally used to check if the calling
* thread could access the system clipboard. The method has been
* obsoleted and code should instead use {@link #checkPermission}
* to check {@code AWTPermission("accessClipboard")}.
* This method is subject to removal in a future version of Java SE.
* @see #checkPermission(java.security.Permission) checkPermission
*/
@Deprecated(since="1.8", forRemoval=true)
public void checkSystemClipboardAccess() {
checkPermission(SecurityConstants.ALL_PERMISSION);
}
/**
* Throws {@code SecurityException} if the calling thread does
* not have {@code AllPermission}.
*
* @since 1.1
* @exception SecurityException if the calling thread does not have
* {@code AllPermission}
* @deprecated This method was originally used to check if the calling
* thread could access the AWT event queue. The method has been
* obsoleted and code should instead use {@link #checkPermission}
* to check {@code AWTPermission("accessEventQueue")}.
* This method is subject to removal in a future version of Java SE.
* @see #checkPermission(java.security.Permission) checkPermission
*/
@Deprecated(since="1.8", forRemoval=true)
public void checkAwtEventQueueAccess() {
checkPermission(SecurityConstants.ALL_PERMISSION);
}
/*
* We have an initial invalid bit (initially false) for the class
* variables which tell if the cache is valid. If the underlying
@ -1474,35 +1401,6 @@ public class SecurityManager {
checkPermission(new RuntimePermission("setFactory"));
}
/**
* Throws a {@code SecurityException} if the calling thread does
* not have {@code AllPermission}.
*
* @param clazz the class that reflection is to be performed on.
* @param which type of access, PUBLIC or DECLARED.
* @throws SecurityException if the caller does not have
* {@code AllPermission}
* @throws NullPointerException if the {@code clazz} argument is
* {@code null}
* @deprecated This method was originally used to check if the calling
* thread was allowed to access members. It relied on the
* caller being at a stack depth of 4 which is error-prone and
* cannot be enforced by the runtime. The method has been
* obsoleted and code should instead use
* {@link #checkPermission} to check
* {@code RuntimePermission("accessDeclaredMembers")}. This
* method is subject to removal in a future version of Java SE.
* @since 1.1
* @see #checkPermission(java.security.Permission) checkPermission
*/
@Deprecated(since="1.8", forRemoval=true)
public void checkMemberAccess(Class<?> clazz, int which) {
if (clazz == null) {
throw new NullPointerException("class can't be null");
}
checkPermission(SecurityConstants.ALL_PERMISSION);
}
/**
* Determines whether the permission with the specified permission target
* name should be granted or denied.

View file

@ -2647,7 +2647,7 @@ public final class String
/**
* Returns a stream of {@code int} zero-extending the {@code char} values
* from this sequence. Any char which maps to a <a
* href="{@docRoot}/java/lang/Character.html#unicode">surrogate code
* href="{@docRoot}/java.base/java/lang/Character.html#unicode">surrogate code
* point</a> is passed through uninterpreted.
*
* @return an IntStream of char values from this sequence

View file

@ -52,6 +52,9 @@ import static java.lang.Character.highSurrogate;
import static java.lang.Character.lowSurrogate;
import static java.lang.Character.isSupplementaryCodePoint;
import static java.lang.StringUTF16.putChar;
import static java.nio.charset.StandardCharsets.ISO_8859_1;
import static java.nio.charset.StandardCharsets.US_ASCII;
import static java.nio.charset.StandardCharsets.UTF_8;
/**
* Utility class for string encoding and decoding.
@ -67,10 +70,6 @@ class StringCoding {
private static final ThreadLocal<SoftReference<StringEncoder>> encoder =
new ThreadLocal<>();
private static final Charset ISO_8859_1 = sun.nio.cs.ISO_8859_1.INSTANCE;
private static final Charset US_ASCII = sun.nio.cs.US_ASCII.INSTANCE;
private static final Charset UTF_8 = sun.nio.cs.UTF_8.INSTANCE;
private static <T> T deref(ThreadLocal<SoftReference<T>> tl) {
SoftReference<T> sr = tl.get();
if (sr == null)

View file

@ -146,15 +146,14 @@ class Thread implements Runnable {
}
private volatile String name;
private int priority;
private Thread threadQ;
private long eetop;
private int priority;
/* Whether or not the thread is a daemon thread. */
private boolean daemon = false;
private boolean daemon = false;
/* JVM state */
private boolean stillborn = false;
/* Fields reserved for exclusive use by the JVM */
private boolean stillborn = false;
private long eetop;
/* What will be run. */
private Runnable target;
@ -189,7 +188,7 @@ class Thread implements Runnable {
* not specify a stack size. It is up to the VM to do whatever it
* likes with this number; some VMs will ignore it.
*/
private long stackSize;
private final long stackSize;
/*
* JVM-private state that persists after native thread termination.
@ -199,20 +198,20 @@ class Thread implements Runnable {
/*
* Thread ID
*/
private long tid;
private final long tid;
/* For generating thread ID */
private static long threadSeqNumber;
private static synchronized long nextThreadID() {
return ++threadSeqNumber;
}
/*
* Java thread status for tools, default indicates thread 'not yet started'
*/
private volatile int threadStatus;
private static synchronized long nextThreadID() {
return ++threadSeqNumber;
}
/**
* The argument supplied to the current call to
* java.util.concurrent.locks.LockSupport.park.
@ -377,15 +376,6 @@ class Thread implements Runnable {
@HotSpotIntrinsicCandidate
public static void onSpinWait() {}
/**
* Initializes a Thread with the current AccessControlContext.
* @see #init(ThreadGroup,Runnable,String,long,AccessControlContext,boolean)
*/
private void init(ThreadGroup g, Runnable target, String name,
long stackSize) {
init(g, target, name, stackSize, null, true);
}
/**
* Initializes a Thread.
*
@ -399,9 +389,9 @@ class Thread implements Runnable {
* @param inheritThreadLocals if {@code true}, inherit initial values for
* inheritable thread-locals from the constructing thread
*/
private void init(ThreadGroup g, Runnable target, String name,
long stackSize, AccessControlContext acc,
boolean inheritThreadLocals) {
private Thread(ThreadGroup g, Runnable target, String name,
long stackSize, AccessControlContext acc,
boolean inheritThreadLocals) {
if (name == null) {
throw new NullPointerException("name cannot be null");
}
@ -419,8 +409,8 @@ class Thread implements Runnable {
g = security.getThreadGroup();
}
/* If the security doesn't have a strong opinion of the matter
use the parent thread group. */
/* If the security manager doesn't have a strong opinion
on the matter, use the parent thread group. */
if (g == null) {
g = parent.getThreadGroup();
}
@ -459,7 +449,7 @@ class Thread implements Runnable {
this.stackSize = stackSize;
/* Set thread ID */
tid = nextThreadID();
this.tid = nextThreadID();
}
/**
@ -482,7 +472,7 @@ class Thread implements Runnable {
* {@code "Thread-"+}<i>n</i>, where <i>n</i> is an integer.
*/
public Thread() {
init(null, null, "Thread-" + nextThreadNum(), 0);
this(null, null, "Thread-" + nextThreadNum(), 0);
}
/**
@ -498,7 +488,7 @@ class Thread implements Runnable {
* nothing.
*/
public Thread(Runnable target) {
init(null, target, "Thread-" + nextThreadNum(), 0);
this(null, target, "Thread-" + nextThreadNum(), 0);
}
/**
@ -507,7 +497,7 @@ class Thread implements Runnable {
* This is not a public constructor.
*/
Thread(Runnable target, AccessControlContext acc) {
init(null, target, "Thread-" + nextThreadNum(), 0, acc, false);
this(null, target, "Thread-" + nextThreadNum(), 0, acc, false);
}
/**
@ -534,7 +524,7 @@ class Thread implements Runnable {
* thread group
*/
public Thread(ThreadGroup group, Runnable target) {
init(group, target, "Thread-" + nextThreadNum(), 0);
this(group, target, "Thread-" + nextThreadNum(), 0);
}
/**
@ -546,7 +536,7 @@ class Thread implements Runnable {
* the name of the new thread
*/
public Thread(String name) {
init(null, null, name, 0);
this(null, null, name, 0);
}
/**
@ -570,7 +560,7 @@ class Thread implements Runnable {
* thread group
*/
public Thread(ThreadGroup group, String name) {
init(group, null, name, 0);
this(group, null, name, 0);
}
/**
@ -586,7 +576,7 @@ class Thread implements Runnable {
* the name of the new thread
*/
public Thread(Runnable target, String name) {
init(null, target, name, 0);
this(null, target, name, 0);
}
/**
@ -634,7 +624,7 @@ class Thread implements Runnable {
* thread group or cannot override the context class loader methods.
*/
public Thread(ThreadGroup group, Runnable target, String name) {
init(group, target, name, 0);
this(group, target, name, 0);
}
/**
@ -713,7 +703,7 @@ class Thread implements Runnable {
*/
public Thread(ThreadGroup group, Runnable target, String name,
long stackSize) {
init(group, target, name, stackSize);
this(group, target, name, stackSize, null, true);
}
/**
@ -769,7 +759,7 @@ class Thread implements Runnable {
*/
public Thread(ThreadGroup group, Runnable target, String name,
long stackSize, boolean inheritThreadLocals) {
init(group, target, name, stackSize, null, inheritThreadLocals);
this(group, target, name, stackSize, null, inheritThreadLocals);
}
/**
@ -924,7 +914,7 @@ class Thread implements Runnable {
* for example), the {@code interrupt} method should be used to
* interrupt the wait.
* For more information, see
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
@Deprecated(since="1.2")
@ -957,7 +947,7 @@ class Thread implements Runnable {
* could be used to generate exceptions that the target thread was
* not prepared to handle.
* For more information, see
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
* This method is subject to removal in a future version of Java SE.
*/
@ -1083,7 +1073,7 @@ class Thread implements Runnable {
* If another thread ever attempted to lock this resource, deadlock
* would result. Such deadlocks typically manifest themselves as
* "frozen" processes. For more information, see
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">
* Why are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
* This method is subject to removal in a future version of Java SE.
* @throws NoSuchMethodError always
@ -1123,7 +1113,7 @@ class Thread implements Runnable {
* monitor prior to calling {@code resume}, deadlock results. Such
* deadlocks typically manifest themselves as "frozen" processes.
* For more information, see
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
@Deprecated(since="1.2")
@ -1149,7 +1139,7 @@ class Thread implements Runnable {
* @deprecated This method exists solely for use with {@link #suspend},
* which has been deprecated because it is deadlock-prone.
* For more information, see
* <a href="{@docRoot}/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* <a href="{@docRoot}/java.base/java/lang/doc-files/threadPrimitiveDeprecation.html">Why
* are Thread.stop, Thread.suspend and Thread.resume Deprecated?</a>.
*/
@Deprecated(since="1.2")

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2018, 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
@ -29,7 +29,7 @@ package java.lang;
* Thrown to indicate that the requested operation is not supported.<p>
*
* This class is a member of the
* <a href="{@docRoot}/java/util/package-summary.html#CollectionsFramework">
* <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework">
* Java Collections Framework</a>.
*
* @author Josh Bloch

View file

@ -2035,11 +2035,26 @@ return mh1;
ReflectiveOperationException.class);
}
MemberName resolveOrNull(byte refKind, MemberName member) {
// do this before attempting to resolve
if (!isClassAccessible(member.getDeclaringClass())) {
return null;
}
Objects.requireNonNull(member.getName());
Objects.requireNonNull(member.getType());
return IMPL_NAMES.resolveOrNull(refKind, member, lookupClassOrNull());
}
void checkSymbolicClass(Class<?> refc) throws IllegalAccessException {
if (!isClassAccessible(refc)) {
throw new MemberName(refc).makeAccessException("symbolic reference class is not accessible", this);
}
}
boolean isClassAccessible(Class<?> refc) {
Objects.requireNonNull(refc);
Class<?> caller = lookupClassOrNull();
if (caller != null && !VerifyAccess.isClassAccessible(refc, caller, allowedModes))
throw new MemberName(refc).makeAccessException("symbolic reference class is not accessible", this);
return caller == null || VerifyAccess.isClassAccessible(refc, caller, allowedModes);
}
/** Check name for an illegal leading "&lt;" character. */
@ -2482,10 +2497,13 @@ return mh1;
}
}
try {
MemberName resolved2 = publicLookup().resolveOrFail(refKind,
MemberName resolved2 = publicLookup().resolveOrNull(refKind,
new MemberName(refKind, defc, member.getName(), member.getType()));
if (resolved2 == null) {
return false;
}
checkSecurityManager(defc, resolved2);
} catch (ReflectiveOperationException | SecurityException ex) {
} catch (SecurityException ex) {
return false;
}
return true;

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2018, 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
@ -48,7 +48,7 @@ import jdk.internal.module.ModuleTarget;
/**
* A configuration that is the result of <a href="package-summary.html#resolution">
* resolution</a> or resolution with
* <a href="{@docRoot}/java/lang/module/Configuration.html#service-binding">service binding</a>.
* <a href="{@docRoot}/java.base/java/lang/module/Configuration.html#service-binding">service binding</a>.
*
* <p> A configuration encapsulates the <em>readability graph</em> that is the
* output of resolution. A readability graph is a directed graph whose vertices

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1998, 2018, 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
@ -58,7 +58,7 @@
* represent errors and exceptions.
*
* <a id="charenc"></a>
* <h3>Character Encodings</h3>
* <h2>Character Encodings</h2>
*
* The specification of the {@link java.nio.charset.Charset
* java.nio.charset.Charset} class describes the naming conventions