diff --git a/make/com/sun/nio/sctp/FILES_java.gmk b/make/com/sun/nio/sctp/FILES_java.gmk index 9d9c1a98e91b7a39322873936f90a2393896e157..725131e7280a882ded08ecf6b155ac15c302bf63 100644 --- a/make/com/sun/nio/sctp/FILES_java.gmk +++ b/make/com/sun/nio/sctp/FILES_java.gmk @@ -38,7 +38,7 @@ FILES_java = \ com/sun/nio/sctp/SctpMultiChannel.java \ com/sun/nio/sctp/SctpServerChannel.java \ com/sun/nio/sctp/SctpSocketOption.java \ - com/sun/nio/sctp/SctpStandardSocketOption.java \ + com/sun/nio/sctp/SctpStandardSocketOptions.java \ com/sun/nio/sctp/SendFailedNotification.java \ com/sun/nio/sctp/ShutdownNotification.java \ \ diff --git a/make/java/management/mapfile-vers b/make/java/management/mapfile-vers index 1fb36b78c496141e0ec96f67fafb66d8f213daaa..21b92d45f9e3e2c612664f0c5ebaed822c6938ea 100644 --- a/make/java/management/mapfile-vers +++ b/make/java/management/mapfile-vers @@ -49,6 +49,7 @@ SUNWprivate_1.1 { Java_sun_management_Flag_setStringValue; Java_sun_management_GarbageCollectorImpl_getCollectionCount; Java_sun_management_GarbageCollectorImpl_getCollectionTime; + Java_sun_management_GarbageCollectorImpl_setNotificationEnabled; Java_sun_management_GcInfoBuilder_fillGcAttributeInfo; Java_sun_management_GcInfoBuilder_getLastGcInfo0; Java_sun_management_GcInfoBuilder_getNumGcExtAttributes; diff --git a/make/java/nio/FILES_java.gmk b/make/java/nio/FILES_java.gmk index d09a966db3802d72e9eb34c67cc06fca8a0772ec..41397cacdc0dd408144108ab0ca7f9c8c7d905ee 100644 --- a/make/java/nio/FILES_java.gmk +++ b/make/java/nio/FILES_java.gmk @@ -71,7 +71,7 @@ FILES_src = \ java/nio/charset/CoderMalfunctionError.java \ java/nio/charset/CodingErrorAction.java \ java/nio/charset/MalformedInputException.java \ - java/nio/charset/StandardCharset.java \ + java/nio/charset/StandardCharsets.java \ java/nio/charset/UnmappableCharacterException.java \ \ java/nio/charset/spi/CharsetProvider.java \ @@ -116,7 +116,7 @@ FILES_src = \ java/nio/file/SimpleFileVisitor.java \ java/nio/file/StandardCopyOption.java \ java/nio/file/StandardOpenOption.java \ - java/nio/file/StandardWatchEventKind.java \ + java/nio/file/StandardWatchEventKinds.java \ java/nio/file/TempFileHelper.java \ java/nio/file/WatchEvent.java \ java/nio/file/WatchKey.java \ diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers index 096bfe553264856292e9587fc67e9bb6b81f6398..8a12b69c31494a3c55a960a83f52e49c5371ab16 100644 --- a/make/sun/xawt/mapfile-vers +++ b/make/sun/xawt/mapfile-vers @@ -158,7 +158,6 @@ SUNWprivate_1.1 { Java_sun_awt_X11_XRobotPeer_mouseReleaseImpl; Java_sun_awt_X11_XRobotPeer_mouseWheelImpl; Java_sun_awt_X11_XRobotPeer_setup; - Java_sun_awt_X11_XRobotPeer__1dispose; Java_sun_awt_X11_XToolkit_getNumberOfButtonsImpl; Java_java_awt_Component_initIDs; Java_java_awt_Container_initIDs; diff --git a/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java b/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java new file mode 100644 index 0000000000000000000000000000000000000000..64fb94b3fb82f68baf46f829981206e4e2904db1 --- /dev/null +++ b/src/share/classes/com/sun/management/GarbageCollectionNotificationInfo.java @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2011, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.management; + +import javax.management.Notification; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.CompositeDataView; +import javax.management.openmbean.CompositeType; +import java.util.Collection; +import java.util.Collections; +import sun.management.GarbageCollectionNotifInfoCompositeData; + +/** + * The information about a garbage collection + * + *
+ * A garbage collection notification is emitted by {@link GarbageCollectorMXBean}
+ * when the Java virtual machine completes a garbage collection action
+ * The notification emitted will contain the garbage collection notification
+ * information about the status of the memory:
+ *
+ * A {@link CompositeData CompositeData} representing + * the {@code GarbageCollectionNotificationInfo} object + * is stored in the + * {@linkplain javax.management.Notification#setUserData userdata} + * of a {@linkplain javax.management.Notification notification}. + * The {@link #from from} method is provided to convert from + * a {@code CompositeData} to a {@code GarbageCollectionNotificationInfo} + * object. For example: + * + *
+ * Notification notif;
+ *
+ * // receive the notification emitted by a GarbageCollectorMXBean and set to notif
+ * ...
+ *
+ * String notifType = notif.getType();
+ * if (notifType.equals(GarbageCollectionNotificationInfo.GARBAGE_COLLECTION_NOTIFICATION)) {
+ * // retrieve the garbage collection notification information
+ * CompositeData cd = (CompositeData) notif.getUserData();
+ * GarbageCollectionNotificationInfo info = GarbageCollectionNotificationInfo.from(cd);
+ * ....
+ * }
+ *
+ *
+ * + * The type of the notification emitted by a {@code GarbageCollectorMXBean} is: + *
+ *+ * + * @param cd {@code CompositeData} representing a + * {@code GarbageCollectionNotificationInfo} + * + * @throws IllegalArgumentException if {@code cd} does not + * represent a {@code GarbaageCollectionNotificationInfo} object. + * + * @return a {@code GarbageCollectionNotificationInfo} object represented + * by {@code cd} if {@code cd} is not {@code null}; + * {@code null} otherwise. + */ + public static GarbageCollectionNotificationInfo from(CompositeData cd) { + if (cd == null) { + return null; + } + + if (cd instanceof GarbageCollectionNotifInfoCompositeData) { + return ((GarbageCollectionNotifInfoCompositeData) cd).getGarbageCollectionNotifInfo(); + } else { + return new GarbageCollectionNotificationInfo(cd); + } + } + + public CompositeData toCompositeData(CompositeType ct) { + return cdata; + } + +} diff --git a/src/share/classes/com/sun/nio/sctp/MessageInfo.java b/src/share/classes/com/sun/nio/sctp/MessageInfo.java index ca3e13fc47aaacb15613f26e5aeae8b13dcdc20b..b851b77ac4301149303381041eb3a51d037b7c16 100644 --- a/src/share/classes/com/sun/nio/sctp/MessageInfo.java +++ b/src/share/classes/com/sun/nio/sctp/MessageInfo.java @@ -179,7 +179,7 @@ public abstract class MessageInfo { * completely received. For messages being sent {@code true} indicates that * the message is complete, {@code false} indicates that the message is not * complete. How the send channel interprets this value depends on the value - * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE + * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE * SCTP_EXPLICIT_COMPLETE} socket option. * * @return {@code true} if, and only if, the message is complete @@ -192,7 +192,7 @@ public abstract class MessageInfo { *+ *
+ *+ * + *Attribute Name + *Type + *+ * + *gcName + *{@code java.lang.String} + *+ * + *gcAction + *{@code java.lang.String} + *+ * + *gcCause + *{@code java.lang.String} + *+ * + *gcInfo + *{@code javax.management.openmbean.CompositeData} + *
For messages being sent {@code true} indicates that * the message is complete, {@code false} indicates that the message is not * complete. How the send channel interprets this value depends on the value - * of its {@link SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE + * of its {@link SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE * SCTP_EXPLICIT_COMPLETE} socket option. * * @param complete diff --git a/src/share/classes/com/sun/nio/sctp/SctpChannel.java b/src/share/classes/com/sun/nio/sctp/SctpChannel.java index 8e0472ef1fa2b94c05235654b990d669be69205d..d040a7a07ea2af92e4d5cd37f380fd30320b32d2 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpChannel.java +++ b/src/share/classes/com/sun/nio/sctp/SctpChannel.java @@ -65,55 +65,55 @@ import java.nio.channels.SelectionKey; *
This is a convience method and is equivalent to evaluating the * following expression: *
- * setOption(SctpStandardSocketOption.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
+ * setOption(SctpStandardSocketOptions.SCTP_INIT_MAXSTREAMS, SctpStandardSocketOption.InitMaxStreams.create(maxInStreams, maxOutStreams))
* .connect(remote);
*
*
@@ -651,7 +651,7 @@ public abstract class SctpChannel
* @throws IOException
* If an I/O error occurs
*
- * @see SctpStandardSocketOption
+ * @see SctpStandardSocketOptions
*/
public abstract The message is transferred from the byte buffer as if by a regular diff --git a/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java b/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java index b2f0378064fb39b06a576bb49583f8afa190ddba..229d18ec039378132233e64252a160a48a795f95 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java +++ b/src/share/classes/com/sun/nio/sctp/SctpMultiChannel.java @@ -69,55 +69,55 @@ import java.nio.channels.SelectionKey; *
If this channel is in non-blocking mode, there is sufficient room * in the underlying output buffer, and an implicit association setup is * required, then the remaining bytes in the given byte buffer are * transmitted as a single message, subject to {@link - * SctpStandardSocketOption#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}. + * SctpStandardSocketOptions#SCTP_EXPLICIT_COMPLETE SCTP_EXPLICIT_COMPLETE}. * If for any reason the message cannot * be delivered an {@link AssociationChangeNotification association * changed} notification is put on the SCTP stack with its {@code event} parameter set diff --git a/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java b/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java index 5c762edfe3585d4bb2cd4dba62b99a9cc92e6d62..3867fc9ca347cc1836d65b22cf31dcad3bbc97ef 100644 --- a/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java +++ b/src/share/classes/com/sun/nio/sctp/SctpServerChannel.java @@ -53,7 +53,7 @@ import java.nio.channels.spi.AbstractSelectableChannel; *
The value of this socket option is an {@link
- * SctpStandardSocketOption.InitMaxStreams InitMaxStreams}, that represents
+ * SctpStandardSocketOptions.InitMaxStreams InitMaxStreams}, that represents
* the maximum number of inbound and outbound streams that an association
* on the channel is prepared to support.
*
@@ -157,9 +157,9 @@ public class SctpStandardSocketOption {
* the endpoints default value.
*/
public static final SctpSocketOption
-
- * All the ancestors of this component up to the nearest validate root are
- * marked invalid also. If there is no a validate root container for this
- * component, all of its ancestors up to the root of the hierarchy are
- * marked invalid as well. Marking a container invalid indicates
- * that the container needs to be laid out.
+ * By default, all the ancestors of the component up to the top-most
+ * container of the hierarchy are marked invalid. If the {@code
+ * java.awt.smartInvalidate} system property is set to {@code true},
+ * invalidation stops on the nearest validate root of this component.
+ * Marking a container invalid indicates that the container needs to
+ * be laid out.
*
* This method is called automatically when any layout-related information
* changes (e.g. setting the bounds of the component, or adding the
diff --git a/src/share/classes/java/awt/Container.java b/src/share/classes/java/awt/Container.java
index 88f0865b187128a72ef555892d04799f5189e423..c59aa90bc5f238f14ee02d9e7267366e5f4831dc 100644
--- a/src/share/classes/java/awt/Container.java
+++ b/src/share/classes/java/awt/Container.java
@@ -41,6 +41,8 @@ import java.io.ObjectStreamField;
import java.io.PrintStream;
import java.io.PrintWriter;
+import java.security.AccessController;
+
import java.util.Arrays;
import java.util.EventListener;
import java.util.HashSet;
@@ -60,6 +62,8 @@ import sun.awt.dnd.SunDropTargetEvent;
import sun.java2d.pipe.Region;
+import sun.security.action.GetBooleanAction;
+
/**
* A generic Abstract Window Toolkit(AWT) container object is a component
* that can contain other AWT components.
@@ -1506,12 +1510,18 @@ public class Container extends Component {
* Layout-related changes, such as bounds of the validate root descendants,
* do not affect the layout of the validate root parent. This peculiarity
* enables the {@code invalidate()} method to stop invalidating the
- * component hierarchy when the method encounters a validate root.
+ * component hierarchy when the method encounters a validate root. However,
+ * to preserve backward compatibility this new optimized behavior is
+ * enabled only when the {@code java.awt.smartInvalidate} system property
+ * value is set to {@code true}.
*
- * If a component hierarchy contains validate roots, the {@code validate()}
- * method must be invoked on the validate root of a previously invalidated
- * component, rather than on the top-level container (such as a {@code
- * Frame} object) to restore the validity of the hierarchy later.
+ * If a component hierarchy contains validate roots and the new optimized
+ * {@code invalidate()} behavior is enabled, the {@code validate()} method
+ * must be invoked on the validate root of a previously invalidated
+ * component to restore the validity of the hierarchy later. Otherwise,
+ * calling the {@code validate()} method on the top-level container (such
+ * as a {@code Frame} object) should be used to restore the validity of the
+ * component hierarchy.
*
* The {@code Window} class and the {@code Applet} class are the validate
* roots in AWT. Swing introduces more validate roots.
@@ -1527,13 +1537,20 @@ public class Container extends Component {
return false;
}
+ private static final boolean isJavaAwtSmartInvalidate;
+ static {
+ // Don't lazy-read because every app uses invalidate()
+ isJavaAwtSmartInvalidate = AccessController.doPrivileged(
+ new GetBooleanAction("java.awt.smartInvalidate"));
+ }
+
/**
* Invalidates the parent of the container unless the container
* is a validate root.
*/
@Override
void invalidateParent() {
- if (!isValidateRoot()) {
+ if (!isJavaAwtSmartInvalidate || !isValidateRoot()) {
super.invalidateParent();
}
}
@@ -1572,9 +1589,8 @@ public class Container extends Component {
* automatically. Note that the ancestors of the container may be
* invalidated also (see {@link Component#invalidate} for details.)
* Therefore, to restore the validity of the hierarchy, the {@code
- * validate()} method should be invoked on a validate root of an
- * invalidated component, or on the top-most container if the hierarchy
- * does not contain validate roots.
+ * validate()} method should be invoked on the top-most invalid
+ * container of the hierarchy.
*
* Validating the container may be a quite time-consuming operation. For
* performance reasons a developer may postpone the validation of the
diff --git a/src/share/classes/java/awt/Toolkit.java b/src/share/classes/java/awt/Toolkit.java
index 6e00e6afdbf260aba46d82a34b09e98b0be903f1..3ac2714dcef892da3bb4d97a96f61fa2123715bb 100644
--- a/src/share/classes/java/awt/Toolkit.java
+++ b/src/share/classes/java/awt/Toolkit.java
@@ -466,10 +466,7 @@ public abstract class Toolkit {
*/
protected void loadSystemColors(int[] systemColors)
throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
-
+ GraphicsEnvironment.checkHeadless();
}
/**
@@ -504,10 +501,7 @@ public abstract class Toolkit {
*/
public void setDynamicLayout(boolean dynamic)
throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
-
+ GraphicsEnvironment.checkHeadless();
}
/**
@@ -531,9 +525,8 @@ public abstract class Toolkit {
*/
protected boolean isDynamicLayoutSet()
throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().isDynamicLayoutSet();
} else {
@@ -569,9 +562,8 @@ public abstract class Toolkit {
*/
public boolean isDynamicLayoutActive()
throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().isDynamicLayoutActive();
} else {
@@ -615,9 +607,7 @@ public abstract class Toolkit {
*/
public Insets getScreenInsets(GraphicsConfiguration gc)
throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getScreenInsets(gc);
} else {
@@ -1200,10 +1190,7 @@ public abstract class Toolkit {
* security manager's Future versions of the platform may mandate compiler errors for
* such unsafe operations.
diff --git a/src/share/classes/java/lang/Throwable.java b/src/share/classes/java/lang/Throwable.java
index d70fe26841ab8e6e86d7c95314aa7a86d54e92bc..2319aafd00fa2fab3f70b889a2f879da451f473b 100644
--- a/src/share/classes/java/lang/Throwable.java
+++ b/src/share/classes/java/lang/Throwable.java
@@ -336,7 +336,10 @@ public class Throwable implements Serializable {
* Disabling of suppression should only occur in exceptional
* circumstances where special requirements exist, such as a
* virtual machine reusing exception objects under low-memory
- * situations.
+ * situations. Circumstances where a given exception object is
+ * repeatedly caught and rethrown, such as to implement control
+ * flow between two sub-systems, is another situation where
+ * immutable throwable objects would be appropriate.
*
* @param message the detail message.
* @param cause the cause. (A {@code null} value is permitted,
@@ -423,6 +426,18 @@ public class Throwable implements Serializable {
* {@link #Throwable(String,Throwable)}, this method cannot be called
* even once.
*
+ * An example of using this method on a legacy throwable type
+ * without other support for setting the cause is:
+ *
+ * The suppression behavior is enabled unless disabled
* {@linkplain #Throwable(String, Throwable, boolean, boolean) via
@@ -1043,7 +1062,9 @@ public class Throwable implements Serializable {
*
* If no exceptions were suppressed or {@linkplain
* #Throwable(String, Throwable, boolean, boolean) suppression is
- * disabled}, an empty array is returned.
+ * disabled}, an empty array is returned. This method is
+ * thread-safe. Writes to the returned array do not affect future
+ * calls to this method.
*
* @return an array containing all of the exceptions that were
* suppressed to deliver this exception.
diff --git a/src/share/classes/java/net/SocketOption.java b/src/share/classes/java/net/SocketOption.java
index 65dfe3c5a6b80bedc7afb5f5db51c43917fd429a..d3c5972ee0212b806bc2d3ee887d3a82f4deb029 100644
--- a/src/share/classes/java/net/SocketOption.java
+++ b/src/share/classes/java/net/SocketOption.java
@@ -38,7 +38,7 @@ package java.net;
*
* @since 1.7
*
- * @see StandardSocketOption
+ * @see StandardSocketOptions
*/
public interface SocketOptioncheckPermission method with a
* RuntimePermission("queuePrintJob") permission.
*
- * @param frame the parent of the print dialog. May be null if and only
- * if jobAttributes is not null and jobAttributes.getDialog()
- * returns JobAttributes.DialogType.NONE or
- * JobAttributes.DialogType.COMMON.
+ * @param frame the parent of the print dialog. May not be null.
* @param jobtitle the title of the PrintJob. A null title is equivalent
* to "".
* @param jobAttributes a set of job attributes which will control the
@@ -1359,9 +1346,8 @@ public abstract class Toolkit {
* @since 1.4
*/
public Clipboard getSystemSelection() throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getSystemSelection();
} else {
@@ -1391,9 +1377,7 @@ public abstract class Toolkit {
* @since JDK1.1
*/
public int getMenuShortcutKeyMask() throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
return Event.CTRL_MASK;
}
@@ -1418,7 +1402,10 @@ public abstract class Toolkit {
* @since 1.3
*/
public boolean getLockingKeyState(int keyCode)
- throws UnsupportedOperationException {
+ throws UnsupportedOperationException
+ {
+ GraphicsEnvironment.checkHeadless();
+
if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK ||
keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) {
throw new IllegalArgumentException("invalid key for Toolkit.getLockingKeyState");
@@ -1449,7 +1436,10 @@ public abstract class Toolkit {
* @since 1.3
*/
public void setLockingKeyState(int keyCode, boolean on)
- throws UnsupportedOperationException {
+ throws UnsupportedOperationException
+ {
+ GraphicsEnvironment.checkHeadless();
+
if (! (keyCode == KeyEvent.VK_CAPS_LOCK || keyCode == KeyEvent.VK_NUM_LOCK ||
keyCode == KeyEvent.VK_SCROLL_LOCK || keyCode == KeyEvent.VK_KANA_LOCK)) {
throw new IllegalArgumentException("invalid key for Toolkit.setLockingKeyState");
@@ -1523,9 +1513,8 @@ public abstract class Toolkit {
*/
public Dimension getBestCursorSize(int preferredWidth,
int preferredHeight) throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
// Override to implement custom cursor support.
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().
@@ -1553,9 +1542,8 @@ public abstract class Toolkit {
* @since 1.2
*/
public int getMaximumCursorColors() throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
// Override to implement custom cursor support.
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().getMaximumCursorColors();
@@ -1605,9 +1593,8 @@ public abstract class Toolkit {
public boolean isFrameStateSupported(int state)
throws HeadlessException
{
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
if (this != Toolkit.getDefaultToolkit()) {
return Toolkit.getDefaultToolkit().
isFrameStateSupported(state);
@@ -2614,9 +2601,8 @@ public abstract class Toolkit {
* @since 1.7
*/
public boolean areExtraMouseButtonsEnabled() throws HeadlessException {
- if (GraphicsEnvironment.isHeadless()){
- throw new HeadlessException();
- }
+ GraphicsEnvironment.checkHeadless();
+
return Toolkit.getDefaultToolkit().areExtraMouseButtonsEnabled();
}
}
diff --git a/src/share/classes/java/lang/SafeVarargs.java b/src/share/classes/java/lang/SafeVarargs.java
index b0c03a9162b18510adfb2d537f584dafc2c2f768..818ea21bafb56369e965e95b550e55d86f8bc988 100644
--- a/src/share/classes/java/lang/SafeVarargs.java
+++ b/src/share/classes/java/lang/SafeVarargs.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, 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
@@ -32,7 +32,7 @@ import java.lang.annotation.*;
* constructor does not perform potentially unsafe operations on its
* varargs parameter. Applying this annotation to a method or
* constructor suppresses unchecked warnings about a
- * non-reifiable variable-arity (vararg) type and suppresses
+ * non-reifiable variable arity (vararg) type and suppresses
* unchecked warnings about parameterized array creation at call
* sites.
*
@@ -41,11 +41,10 @@ import java.lang.annotation.*;
* additional usage restrictions on this annotation type; it is a
* compile-time error if a method or constructor declaration is
* annotated with a {@code @SafeVarargs} annotation, and either:
-
*
- *
@@ -55,15 +54,28 @@ import java.lang.annotation.*;
*
*
*
- *
+ *
+ * leads to a {@code ClassCastException} at runtime.
*
*
+ * @SafeVarargs // Not actually safe!
+ * static void m(List<String>... stringLists) {
+ * Object[] array = stringLists;
+ * List<Integer> tmpList = Arrays.asList(42);
+ * array[0] = tmpList; // Semantically invalid, but compiles without warnings
+ * String s = stringLists[0].get(0); // Oh no, ClassCastException at runtime!
+ * }
+ *
+ * try {
+ * lowLevelOp();
+ * } catch (LowLevelException le) {
+ * throw (HighLevelException)
+ * new HighLevelException().initCause(le); // Legacy constructor
+ * }
+ *
+ *
* @param cause the cause (which is saved for later retrieval by the
* {@link #getCause()} method). (A {@code null} value is
* permitted, and indicates that the cause is nonexistent or
@@ -762,7 +777,8 @@ public class Throwable implements Serializable {
* @see java.lang.Throwable#printStackTrace()
*/
public synchronized Throwable fillInStackTrace() {
- if (stackTrace != null) {
+ if (stackTrace != null ||
+ backtrace != null /* Out of protocol state */ ) {
fillInStackTrace(0);
stackTrace = UNASSIGNED_STACK;
}
@@ -788,7 +804,8 @@ public class Throwable implements Serializable {
* this throwable is permitted to return a zero-length array from this
* method. Generally speaking, the array returned by this method will
* contain one element for every frame that would be printed by
- * {@code printStackTrace}.
+ * {@code printStackTrace}. Writes to the returned array do not
+ * affect future calls to this method.
*
* @return an array of stack trace elements representing the stack trace
* pertaining to this throwable.
@@ -801,7 +818,8 @@ public class Throwable implements Serializable {
private synchronized StackTraceElement[] getOurStackTrace() {
// Initialize stack trace field with information from
// backtrace if this is the first call to this method
- if (stackTrace == UNASSIGNED_STACK) {
+ if (stackTrace == UNASSIGNED_STACK ||
+ (stackTrace == null && backtrace != null) /* Out of protocol state */) {
int depth = getStackTraceDepth();
stackTrace = new StackTraceElement[depth];
for (int i=0; i < depth; i++)
@@ -849,7 +867,8 @@ public class Throwable implements Serializable {
}
synchronized (this) {
- if (this.stackTrace == null) // Immutable stack
+ if (this.stackTrace == null && // Immutable stack
+ backtrace == null) // Test for out of protocol state
return;
this.stackTrace = defensiveCopy;
}
@@ -971,8 +990,8 @@ public class Throwable implements Serializable {
/**
* Appends the specified exception to the exceptions that were
* suppressed in order to deliver this exception. This method is
- * typically called (automatically and implicitly) by the {@code
- * try}-with-resources statement.
+ * thread-safe and typically called (automatically and implicitly)
+ * by the {@code try}-with-resources statement.
*
* Description
*
The {@link StandardSocketOption#SO_REUSEADDR SO_REUSEADDR} option should be + *
The {@link StandardSocketOptions#SO_REUSEADDR SO_REUSEADDR} option should be * enabled prior to {@link NetworkChannel#bind binding} the socket. This is * required to allow multiple members of the group to bind to the same * address.
The {@link StandardCharset} class defines constants for each of the + *
The {@link StandardCharsets} class defines constants for each of the * standard charsets. * *
* Path path = FileSystems.getDefault().getPath("logs", "access.log");
- * BufferReader reader = Files.newBufferedReader(path, StandardCharset.UTF_8);
+ * BufferReader reader = Files.newBufferedReader(path, StandardCharsets.UTF_8);
*
*
* The set of events may include additional implementation specific - * event that are not defined by the enum {@link StandardWatchEventKind} + * event that are not defined by the enum {@link StandardWatchEventKinds} * *
The {@code modifiers} parameter specifies modifiers that
* qualify how the directory is registered. This release does not define any
diff --git a/src/share/classes/java/nio/file/StandardWatchEventKind.java b/src/share/classes/java/nio/file/StandardWatchEventKinds.java
similarity index 94%
rename from src/share/classes/java/nio/file/StandardWatchEventKind.java
rename to src/share/classes/java/nio/file/StandardWatchEventKinds.java
index 6064d75a7fa0d335c9138736e7a323359164dfd8..ef111e2bf7d15b439ac6c6d9c6a471ca0f0a56af 100644
--- a/src/share/classes/java/nio/file/StandardWatchEventKind.java
+++ b/src/share/classes/java/nio/file/StandardWatchEventKinds.java
@@ -31,8 +31,8 @@ package java.nio.file;
* @since 1.7
*/
-public final class StandardWatchEventKind {
- private StandardWatchEventKind() { }
+public final class StandardWatchEventKinds {
+ private StandardWatchEventKinds() { }
/**
* A special event to indicate that events may have been lost or
@@ -44,8 +44,8 @@ public final class StandardWatchEventKind {
*
* @see WatchService
*/
- public static final WatchEvent.Kind