Merge
diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index a829876..537bff1 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -255,3 +255,4 @@
1e5fe865491300cd0c63261ecf8d34e621e1345c jdk8-b129
cc868070f1959b849c8c3b867771fbdb07b9ba05 jdk8u20-b02
6a3d3b7feab4d4a8252c63b4ce7d0fab106cf2f7 jdk8u20-b03
+7e1b01df280fb065c5953c48f54ac9d619ecbf1c jdk8u20-b04
diff --git a/corba/.hgtags b/corba/.hgtags
index 614857f..319f258 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -255,3 +255,4 @@
5c72d74c6805d1b4f6192f7a3550d126acf37005 jdk8-b129
bfafb13aac1c8b2d9184d59ec510b45d965b7667 jdk8u20-b02
9059a1c857044ad5ce7564ddb71a064364f8fcf5 jdk8u20-b03
+abe5b0157c367a72f9059269ca633ecfe15732d2 jdk8u20-b04
diff --git a/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java b/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
index 91a691e..2927e1b 100644
--- a/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
+++ b/corba/src/share/classes/com/sun/corba/se/spi/orb/ORB.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -170,6 +170,12 @@
// representing LogDomain and ExceptionGroup.
private Map wrapperMap ;
+ static class Holder {
+ static final PresentationManager defaultPresentationManager =
+ setupPresentationManager();
+ }
+ private static final Object pmLock = new Object();
+
private static Map staticWrapperMap = new ConcurrentHashMap();
protected MonitoringManager monitoringManager;
@@ -235,13 +241,24 @@
*/
public static PresentationManager getPresentationManager()
{
- AppContext ac = AppContext.getAppContext();
- PresentationManager pm = (PresentationManager) ac.get(PresentationManager.class);
- if (pm == null) {
- pm = setupPresentationManager();
- ac.put(PresentationManager.class, pm);
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null && AppContext.getAppContexts().size() > 0) {
+ AppContext ac = AppContext.getAppContext();
+ if (ac != null) {
+ synchronized (pmLock) {
+ PresentationManager pm =
+ (PresentationManager) ac.get(PresentationManager.class);
+ if (pm == null) {
+ pm = setupPresentationManager();
+ ac.put(PresentationManager.class, pm);
+ }
+ return pm;
+ }
+ }
}
- return pm;
+
+ // No security manager or AppContext
+ return Holder.defaultPresentationManager;
}
/** Get the appropriate StubFactoryFactory. This
diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 66982fc..7308ed1 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -428,3 +428,4 @@
ecf3678d5736a645aea893b525a9eb5fa1a8e072 hs25.20-b04
51e1bb81df8680bd237630323de5e0704fb25607 jdk8u20-b03
54436d3b2a915ff50a8d6b34f61d5afb45be7bb6 hs25.20-b05
+d4e18f0633c662588cc0875be7759721c7d85af4 jdk8u20-b04
diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 0772bc5..e232c93 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -255,3 +255,4 @@
b7752cea7c813fb8b1d3bf2e05e8f93331cc7f1d jdk8-b129
de9ec1246a0c5c0b32ce3818386019fd4a6fceaa jdk8u20-b02
47cdfe271b1e97e5906eb1b96cd7d15f0717a118 jdk8u20-b03
+f6742d0cf71201f1ffd0584c1f2990df343bc5eb jdk8u20-b04
diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 56b8b6f..fd7343f 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -255,3 +255,4 @@
aabc90596123d4eb7e576ecb0e7a843a9415d8eb jdk8-b129
ba061957b8bdb5f04e58154b27405fbf6fe3c71f jdk8u20-b02
337a3a4086235e926e1d684bf4d0b2add70d6f55 jdk8u20-b03
+579caba2483ee3c9e32d87b31ab46e86f1aa9cd3 jdk8u20-b04
diff --git a/jdk/.hgtags b/jdk/.hgtags
index 7fb44bb..f002823 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -255,3 +255,4 @@
80568a19aab7300bc92baf2dc225be929f5b03ed jdk8-b129
9543b632ab87368c887d8b29b21157ebb44228d0 jdk8u20-b02
5a9f04957f826ce23639479c9791c7d8fd282b01 jdk8u20-b03
+c347889445c1153f11aaa56092d44a911e497454 jdk8u20-b04
diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers
index d2d8067..e6fd0f5 100644
--- a/jdk/make/mapfiles/libjava/mapfile-vers
+++ b/jdk/make/mapfiles/libjava/mapfile-vers
@@ -79,7 +79,7 @@
Java_java_io_FileInputStream_close0;
Java_java_io_FileInputStream_initIDs;
Java_java_io_FileInputStream_open;
- Java_java_io_FileInputStream_read;
+ Java_java_io_FileInputStream_read0;
Java_java_io_FileInputStream_readBytes;
Java_java_io_FileInputStream_skip;
Java_java_io_FileOutputStream_close0;
@@ -98,11 +98,11 @@
Java_java_io_RandomAccessFile_initIDs;
Java_java_io_RandomAccessFile_length;
Java_java_io_RandomAccessFile_open;
- Java_java_io_RandomAccessFile_read;
+ Java_java_io_RandomAccessFile_read0;
Java_java_io_RandomAccessFile_readBytes;
Java_java_io_RandomAccessFile_seek0;
Java_java_io_RandomAccessFile_setLength;
- Java_java_io_RandomAccessFile_write;
+ Java_java_io_RandomAccessFile_write0;
Java_java_io_RandomAccessFile_writeBytes;
Java_java_io_UnixFileSystem_canonicalize0;
Java_java_io_UnixFileSystem_checkAccess;
diff --git a/jdk/make/mapfiles/libjfr/mapfile-vers b/jdk/make/mapfiles/libjfr/mapfile-vers
index 8031edc..dea13dd 100644
--- a/jdk/make/mapfiles/libjfr/mapfile-vers
+++ b/jdk/make/mapfiles/libjfr/mapfile-vers
@@ -34,6 +34,7 @@
Java_oracle_jrockit_jfr_VMJFR_getPeriod;
Java_oracle_jrockit_jfr_VMJFR_descriptors;
Java_oracle_jrockit_jfr_VMJFR_redefineClass0;
+ Java_oracle_jrockit_jfr_VMJFR_retransformClasses0;
JNI_OnLoad;
local:
*;
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java
index 7343ae3..5451abd 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaImageFactory.java
@@ -48,6 +48,7 @@
import com.apple.laf.AquaUtils.RecyclableSingleton;
import java.util.Arrays;
import java.util.List;
+import sun.awt.image.MultiResolutionBufferedImage;
import sun.awt.image.MultiResolutionImage;
public class AquaImageFactory {
@@ -230,7 +231,7 @@
@Override
protected Image getInstance() {
- return Toolkit.getDefaultToolkit().getImage("NSImage://" + namedImage);
+ return getNSIcon(namedImage);
}
}
@@ -294,11 +295,27 @@
}
public static Icon getMenuItemCheckIcon() {
- return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuItemSelection"), 25));
+ return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+ getNSIcon("NSMenuItemSelection"), 25));
}
public static Icon getMenuItemDashIcon() {
- return new InvertableImageIcon(AquaUtils.generateLightenedImage(Toolkit.getDefaultToolkit().getImage("NSImage://NSMenuMixedState"), 25));
+ return new InvertableImageIcon(AquaUtils.generateLightenedImage(
+ getNSIcon("NSMenuMixedState"), 25));
+ }
+
+ private static Image getNSIcon(String imageName) {
+ Image icon = Toolkit.getDefaultToolkit()
+ .getImage("NSImage://" + imageName);
+
+ if (icon instanceof MultiResolutionImage) {
+ return icon;
+ }
+
+ Image icon2x = AquaUtils.getCImageCreator().createImageFromName(
+ imageName, 2 * icon.getWidth(null), 2 * icon.getHeight(null));
+ return new MultiResolutionBufferedImage(
+ BufferedImage.TYPE_INT_ARGB_PRE, 0, icon, icon2x);
}
public static class NineSliceMetrics {
diff --git a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java
index a5f5501..6a52283 100644
--- a/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaUtils.java
@@ -48,6 +48,7 @@
import sun.swing.SwingUtilities2;
import com.apple.laf.AquaImageFactory.SlicedImageControl;
+import sun.awt.image.MultiResolutionBufferedImage;
final class AquaUtils {
@@ -123,6 +124,13 @@
static Image generateLightenedImage(final Image image, final int percent) {
final GrayFilter filter = new GrayFilter(true, percent);
+ return (image instanceof MultiResolutionBufferedImage)
+ ? ((MultiResolutionBufferedImage) image).map(
+ rv -> generateLightenedImage(rv, filter))
+ : generateLightenedImage(image, filter);
+ }
+
+ static Image generateLightenedImage(Image image, ImageFilter filter) {
final ImageProducer prod = new FilteredImageSource(image.getSource(), filter);
return Toolkit.getDefaultToolkit().createImage(prod);
}
diff --git a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
index f0eebfc..50703d4 100644
--- a/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
+++ b/jdk/src/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -583,7 +583,12 @@
// setVisible could have changed the native maximized state
deliverZoom(true);
} else {
- switch (((Frame)target).getExtendedState()) {
+ int frameState = ((Frame)target).getExtendedState();
+ if ((frameState & Frame.ICONIFIED) != 0) {
+ // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+ frameState = Frame.ICONIFIED;
+ }
+ switch (frameState) {
case Frame.ICONIFIED:
CWrapper.NSWindow.miniaturize(nsWindowPtr);
break;
@@ -788,6 +793,10 @@
if (prevWindowState == windowState) return;
final long nsWindowPtr = getNSWindowPtr();
+ if ((windowState & Frame.ICONIFIED) != 0) {
+ // Treat all state bit masks with ICONIFIED bit as ICONIFIED state.
+ windowState = Frame.ICONIFIED;
+ }
switch (windowState) {
case Frame.ICONIFIED:
if (prevWindowState == Frame.MAXIMIZED_BOTH) {
diff --git a/jdk/src/macosx/native/sun/awt/CDataTransferer.m b/jdk/src/macosx/native/sun/awt/CDataTransferer.m
index 5e997bf..09a7e5c 100644
--- a/jdk/src/macosx/native/sun/awt/CDataTransferer.m
+++ b/jdk/src/macosx/native/sun/awt/CDataTransferer.m
@@ -28,6 +28,7 @@
#import <AppKit/AppKit.h>
#import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import "jni_util.h"
#include "ThreadUtilities.h"
@@ -172,7 +173,9 @@
NSData *tiffImage = [imageRep TIFFRepresentation];
jsize tiffSize = (jsize)[tiffImage length]; // #warning 64-bit: -length returns NSUInteger, but NewByteArray takes jsize
returnValue = (*env)->NewByteArray(env, tiffSize);
+ CHECK_NULL_RETURN(returnValue, nil);
jbyte *tiffData = (jbyte *)(*env)->GetPrimitiveArrayCritical(env, returnValue, 0);
+ CHECK_NULL_RETURN(tiffData, nil);
[tiffImage getBytes:tiffData];
(*env)->ReleasePrimitiveArrayCritical(env, returnValue, tiffData, 0); // Do not use JNI_COMMIT, as that will not free the buffer copy when +ProtectJavaHeap is on.
[imageRep release];
@@ -184,12 +187,13 @@
static jobject getImageForByteStream(JNIEnv *env, jbyteArray sourceData)
{
- if (sourceData == NULL) return NULL;
+ CHECK_NULL_RETURN(sourceData, NULL);
jsize sourceSize = (*env)->GetArrayLength(env, sourceData);
if (sourceSize == 0) return NULL;
jbyte *sourceBytes = (*env)->GetPrimitiveArrayCritical(env, sourceData, NULL);
+ CHECK_NULL_RETURN(sourceBytes, NULL);
NSData *rawData = [NSData dataWithBytes:sourceBytes length:sourceSize];
NSImage *newImage = [[NSImage alloc] initWithData:rawData];
@@ -197,8 +201,7 @@
[newImage release];
(*env)->ReleasePrimitiveArrayCritical(env, sourceData, sourceBytes, JNI_ABORT);
-
- if (newImage == nil) return NULL;
+ CHECK_NULL_RETURN(newImage, NULL);
// The ownership of the NSImage is passed to the new CImage jobject. No need to release it.
static JNF_CLASS_CACHE(jc_CImage, "sun/lwawt/macosx/CImage");
@@ -231,7 +234,8 @@
if (filenameCount == 0) return nil;
// Get the java.lang.String class object:
- jclass stringClazz = (*env)->FindClass(env, "java/lang/String"); // can't be null
+ jclass stringClazz = (*env)->FindClass(env, "java/lang/String");
+ CHECK_NULL_RETURN(stringClazz, nil);
jobject jfilenameArray = (*env)->NewObjectArray(env, filenameCount, stringClazz, NULL); // AWT_THREADING Safe (known object)
if ((*env)->ExceptionOccurred(env)) {
(*env)->ExceptionDescribe(env);
diff --git a/jdk/src/macosx/native/sun/awt/LWCToolkit.m b/jdk/src/macosx/native/sun/awt/LWCToolkit.m
index 3300e2d..5e2dd6c 100644
--- a/jdk/src/macosx/native/sun/awt/LWCToolkit.m
+++ b/jdk/src/macosx/native/sun/awt/LWCToolkit.m
@@ -200,13 +200,17 @@
gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
+ CHECK_NULL(inputEventClazz);
jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
+ CHECK_NULL(getButtonDownMasksID);
jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
+ CHECK_NULL(tmp);
gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
if (gButtonDownMasks == NULL) {
gNumberOfButtons = 0;
+ (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
JNU_ThrowOutOfMemoryError(env, NULL);
return;
}
@@ -240,7 +244,7 @@
return ((ia & 0xFF) << 24) | ((ir & 0xFF) << 16) | ((ig & 0xFF) << 8) | ((ib & 0xFF) << 0);
}
-void doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
+BOOL doLoadNativeColors(JNIEnv *env, jintArray jColors, BOOL useAppleColors) {
jint len = (*env)->GetArrayLength(env, jColors);
UInt32 colorsArray[len];
@@ -254,8 +258,12 @@
}];
jint *_colors = (*env)->GetPrimitiveArrayCritical(env, jColors, 0);
+ if (_colors == NULL) {
+ return NO;
+ }
memcpy(_colors, colors, len * sizeof(UInt32));
(*env)->ReleasePrimitiveArrayCritical(env, jColors, _colors, 0);
+ return YES;
}
/**
@@ -267,8 +275,9 @@
(JNIEnv *env, jobject peer, jintArray jSystemColors, jintArray jAppleColors)
{
JNF_COCOA_ENTER(env);
- doLoadNativeColors(env, jSystemColors, NO);
- doLoadNativeColors(env, jAppleColors, YES);
+ if (doLoadNativeColors(env, jSystemColors, NO)) {
+ doLoadNativeColors(env, jAppleColors, YES);
+ }
JNF_COCOA_EXIT(env);
}
diff --git a/jdk/src/share/classes/java/io/FileInputStream.java b/jdk/src/share/classes/java/io/FileInputStream.java
index 3e67fb8..cc6710e 100644
--- a/jdk/src/share/classes/java/io/FileInputStream.java
+++ b/jdk/src/share/classes/java/io/FileInputStream.java
@@ -51,6 +51,12 @@
/* File Descriptor - handle to the open file */
private final FileDescriptor fd;
+ /**
+ * The path of the referenced file
+ * (null if the stream is created with a file descriptor)
+ */
+ private final String path;
+
private FileChannel channel = null;
private final Object closeLock = new Object();
@@ -128,6 +134,7 @@
}
fd = new FileDescriptor();
fd.attach(this);
+ path = name;
open(name);
}
@@ -164,6 +171,7 @@
security.checkRead(fdObj);
}
fd = fdObj;
+ path = null;
/*
* FileDescriptor is being shared by streams.
@@ -186,7 +194,11 @@
* file is reached.
* @exception IOException if an I/O error occurs.
*/
- public native int read() throws IOException;
+ public int read() throws IOException {
+ return read0();
+ }
+
+ private native int read0() throws IOException;
/**
* Reads a subarray as a sequence of bytes.
@@ -345,7 +357,7 @@
public FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
- channel = FileChannelImpl.open(fd, true, false, this);
+ channel = FileChannelImpl.open(fd, path, true, false, this);
}
return channel;
}
diff --git a/jdk/src/share/classes/java/io/FileOutputStream.java b/jdk/src/share/classes/java/io/FileOutputStream.java
index 44f4728..8377261 100644
--- a/jdk/src/share/classes/java/io/FileOutputStream.java
+++ b/jdk/src/share/classes/java/io/FileOutputStream.java
@@ -67,6 +67,12 @@
*/
private FileChannel channel;
+ /**
+ * The path of the referenced file
+ * (null if the stream is created with a file descriptor)
+ */
+ private final String path;
+
private final Object closeLock = new Object();
private volatile boolean closed = false;
@@ -202,6 +208,7 @@
this.fd = new FileDescriptor();
fd.attach(this);
this.append = append;
+ this.path = name;
open(name, append);
}
@@ -239,6 +246,7 @@
}
this.fd = fdObj;
this.append = false;
+ this.path = null;
fd.attach(this);
}
@@ -376,7 +384,7 @@
public FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
- channel = FileChannelImpl.open(fd, false, true, append, this);
+ channel = FileChannelImpl.open(fd, path, false, true, append, this);
}
return channel;
}
diff --git a/jdk/src/share/classes/java/io/RandomAccessFile.java b/jdk/src/share/classes/java/io/RandomAccessFile.java
index c48aa99..58d8c89 100644
--- a/jdk/src/share/classes/java/io/RandomAccessFile.java
+++ b/jdk/src/share/classes/java/io/RandomAccessFile.java
@@ -62,6 +62,12 @@
private FileChannel channel = null;
private boolean rw;
+ /**
+ * The path of the referenced file
+ * (null if the stream is created with a file descriptor)
+ */
+ private final String path;
+
private Object closeLock = new Object();
private volatile boolean closed = false;
@@ -233,6 +239,7 @@
}
fd = new FileDescriptor();
fd.attach(this);
+ path = name;
open(name, imode);
}
@@ -272,7 +279,7 @@
public final FileChannel getChannel() {
synchronized (this) {
if (channel == null) {
- channel = FileChannelImpl.open(fd, true, rw, this);
+ channel = FileChannelImpl.open(fd, path, true, rw, this);
}
return channel;
}
@@ -309,7 +316,11 @@
* @exception IOException if an I/O error occurs. Not thrown if
* end-of-file has been reached.
*/
- public native int read() throws IOException;
+ public int read() throws IOException {
+ return read0();
+ }
+
+ private native int read0() throws IOException;
/**
* Reads a sub array as a sequence of bytes.
@@ -457,7 +468,11 @@
* @param b the {@code byte} to be written.
* @exception IOException if an I/O error occurs.
*/
- public native void write(int b) throws IOException;
+ public void write(int b) throws IOException {
+ write0(b);
+ }
+
+ private native void write0(int b) throws IOException;
/**
* Writes a sub array as a sequence of bytes.
diff --git a/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java b/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
new file mode 100644
index 0000000..79f7a3b
--- /dev/null
+++ b/jdk/src/share/classes/sun/awt/image/MultiResolutionBufferedImage.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, 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 sun.awt.image;
+
+import java.awt.Image;
+import java.awt.Graphics;
+import java.awt.image.BufferedImage;
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.Function;
+
+public class MultiResolutionBufferedImage extends BufferedImage
+ implements MultiResolutionImage {
+
+ Image[] resolutionVariants;
+ int baseIndex;
+
+ public MultiResolutionBufferedImage(int imageType, int baseIndex, Image... images) {
+ super(images[baseIndex].getWidth(null), images[baseIndex].getHeight(null),
+ imageType);
+ this.baseIndex = baseIndex;
+ this.resolutionVariants = images;
+ Graphics g = getGraphics();
+ g.drawImage(images[baseIndex], 0, 0, null);
+ g.dispose();
+ images[baseIndex] = this;
+ }
+
+ @Override
+ public Image getResolutionVariant(int width, int height) {
+ for (Image image : resolutionVariants) {
+ if (width <= image.getWidth(null) && height <= image.getHeight(null)) {
+ return image;
+ }
+ }
+ return this;
+ }
+
+ @Override
+ public List<Image> getResolutionVariants() {
+ return Arrays.asList(resolutionVariants);
+ }
+
+ public MultiResolutionBufferedImage map(Function<Image, Image> mapper) {
+ return new MultiResolutionBufferedImage(getType(), baseIndex,
+ Arrays.stream(resolutionVariants).map(mapper)
+ .toArray(length -> new Image[length]));
+ }
+}
diff --git a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java
index 703f598..bb127e8 100644
--- a/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/FileChannelImpl.java
@@ -29,10 +29,20 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.MappedByteBuffer;
-import java.nio.channels.*;
+import java.nio.channels.ClosedByInterruptException;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.FileChannel;
+import java.nio.channels.FileLock;
+import java.nio.channels.FileLockInterruptionException;
+import java.nio.channels.NonReadableChannelException;
+import java.nio.channels.NonWritableChannelException;
+import java.nio.channels.OverlappingFileLockException;
+import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.WritableByteChannel;
+import java.security.AccessController;
import java.util.ArrayList;
import java.util.List;
-import java.security.AccessController;
+
import sun.misc.Cleaner;
import sun.security.action.GetPropertyAction;
@@ -56,13 +66,17 @@
// Required to prevent finalization of creating stream (immutable)
private final Object parent;
+ // The path of the referenced file
+ // (null if the parent stream is created with a file descriptor)
+ private final String path;
+
// Thread-safe set of IDs of native threads, for signalling
private final NativeThreadSet threads = new NativeThreadSet(2);
// Lock for operations involving position and size
private final Object positionLock = new Object();
- private FileChannelImpl(FileDescriptor fd, boolean readable,
+ private FileChannelImpl(FileDescriptor fd, String path, boolean readable,
boolean writable, boolean append, Object parent)
{
this.fd = fd;
@@ -70,23 +84,24 @@
this.writable = writable;
this.append = append;
this.parent = parent;
+ this.path = path;
this.nd = new FileDispatcherImpl(append);
}
// Used by FileInputStream.getChannel() and RandomAccessFile.getChannel()
- public static FileChannel open(FileDescriptor fd,
+ public static FileChannel open(FileDescriptor fd, String path,
boolean readable, boolean writable,
Object parent)
{
- return new FileChannelImpl(fd, readable, writable, false, parent);
+ return new FileChannelImpl(fd, path, readable, writable, false, parent);
}
// Used by FileOutputStream.getChannel
- public static FileChannel open(FileDescriptor fd,
+ public static FileChannel open(FileDescriptor fd, String path,
boolean readable, boolean writable,
boolean append, Object parent)
{
- return new FileChannelImpl(fd, readable, writable, append, parent);
+ return new FileChannelImpl(fd, path, readable, writable, append, parent);
}
private void ensureOpen() throws IOException {
@@ -110,7 +125,7 @@
}
}
- nd.preClose(fd);
+ // signal any threads blocked on this channel
threads.signalAndWait();
if (parent != null) {
diff --git a/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java b/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java
index d6d4c5c..5eb90af 100644
--- a/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java
+++ b/jdk/src/share/classes/sun/nio/ch/NativeThreadSet.java
@@ -82,8 +82,9 @@
// Signals all threads in this set.
//
- void signalAndWait() {
- synchronized (this) {
+ synchronized void signalAndWait() {
+ boolean interrupted = false;
+ while (used > 0) {
int u = used;
int n = elts.length;
for (int i = 0; i < n; i++) {
@@ -96,16 +97,15 @@
break;
}
waitingToEmpty = true;
- boolean interrupted = false;
- while (used > 0) {
- try {
- wait();
- } catch (InterruptedException e) {
- interrupted = true;
- }
+ try {
+ wait(50);
+ } catch (InterruptedException e) {
+ interrupted = true;
+ } finally {
+ waitingToEmpty = false;
}
- if (interrupted)
- Thread.currentThread().interrupt();
}
+ if (interrupted)
+ Thread.currentThread().interrupt();
}
}
diff --git a/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java b/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
index d081339..5658480 100644
--- a/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
+++ b/jdk/src/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java
@@ -88,7 +88,6 @@
invalidateAllLocks();
// signal any threads blocked on this channel
- nd.preClose(fdObj);
threads.signalAndWait();
// wait until all async I/O operations have completely gracefully
diff --git a/jdk/src/share/instrument/Reentrancy.c b/jdk/src/share/instrument/Reentrancy.c
index 58cbfdd..0b526c1 100644
--- a/jdk/src/share/instrument/Reentrancy.c
+++ b/jdk/src/share/instrument/Reentrancy.c
@@ -130,6 +130,7 @@
error = confirmingTLSSet ( jvmtienv,
thread,
JPLIS_CURRENTLY_INSIDE_TOKEN);
+ check_phase_ret_false(error);
jplis_assert(error == JVMTI_ERROR_NONE);
if ( error != JVMTI_ERROR_NONE ) {
result = JNI_FALSE;
@@ -158,6 +159,7 @@
error = confirmingTLSSet( jvmtienv,
thread,
JPLIS_CURRENTLY_OUTSIDE_TOKEN);
+ check_phase_ret(error);
jplis_assert(error == JVMTI_ERROR_NONE);
}
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp b/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp
index 6cedfd8..66ecc1b 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/coding.cpp
@@ -32,6 +32,8 @@
#include <stdlib.h>
#include <stdarg.h>
+#include "jni_util.h"
+
#include "defines.h"
#include "bytes.h"
#include "utils.h"
@@ -147,7 +149,7 @@
break;
}
coding* ptr = NEW(coding, 1);
- CHECK_NULL_0(ptr);
+ CHECK_NULL_RETURN(ptr, 0);
coding* c = ptr->initFrom(spec);
if (c == null) {
mtrace('f', ptr, 0);
diff --git a/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h b/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
index b202892..644b9ca 100644
--- a/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
+++ b/jdk/src/share/native/com/sun/java/util/jar/pack/defines.h
@@ -158,10 +158,6 @@
#define CHECK_(y) _CHECK_DO(aborting(), return y)
#define CHECK_0 _CHECK_DO(aborting(), return 0)
-#define CHECK_NULL(p) _CHECK_DO((p)==null, return)
-#define CHECK_NULL_(y,p) _CHECK_DO((p)==null, return y)
-#define CHECK_NULL_0(p) _CHECK_DO((p)==null, return 0)
-
#define CHECK_COUNT(t) if (t < 0){abort("bad value count");} CHECK
#define STR_TRUE "true"
diff --git a/jdk/src/share/native/common/jni_util.h b/jdk/src/share/native/common/jni_util.h
index b8d23cd..0242d71 100644
--- a/jdk/src/share/native/common/jni_util.h
+++ b/jdk/src/share/native/common/jni_util.h
@@ -297,6 +297,21 @@
} \
} while (0) \
+#ifdef __cplusplus
+#define JNU_CHECK_EXCEPTION(env) \
+ do { \
+ if ((env)->ExceptionCheck()) { \
+ return; \
+ } \
+ } while (0) \
+
+#define JNU_CHECK_EXCEPTION_RETURN(env, y) \
+ do { \
+ if ((env)->ExceptionCheck()) { \
+ return (y); \
+ } \
+ } while (0)
+#else
#define JNU_CHECK_EXCEPTION(env) \
do { \
if ((*env)->ExceptionCheck(env)) { \
@@ -310,7 +325,7 @@
return (y); \
} \
} while (0)
-
+#endif /* __cplusplus */
/************************************************************************
* Debugging utilities
*/
diff --git a/jdk/src/share/native/java/io/FileInputStream.c b/jdk/src/share/native/java/io/FileInputStream.c
index 52e2cdd..092ddbf 100644
--- a/jdk/src/share/native/java/io/FileInputStream.c
+++ b/jdk/src/share/native/java/io/FileInputStream.c
@@ -62,7 +62,7 @@
}
JNIEXPORT jint JNICALL
-Java_java_io_FileInputStream_read(JNIEnv *env, jobject this) {
+Java_java_io_FileInputStream_read0(JNIEnv *env, jobject this) {
return readSingle(env, this, fis_fd);
}
diff --git a/jdk/src/share/native/java/io/RandomAccessFile.c b/jdk/src/share/native/java/io/RandomAccessFile.c
index 3251db8..53b5f1a 100644
--- a/jdk/src/share/native/java/io/RandomAccessFile.c
+++ b/jdk/src/share/native/java/io/RandomAccessFile.c
@@ -64,7 +64,7 @@
}
JNIEXPORT jint JNICALL
-Java_java_io_RandomAccessFile_read(JNIEnv *env, jobject this) {
+Java_java_io_RandomAccessFile_read0(JNIEnv *env, jobject this) {
return readSingle(env, this, raf_fd);
}
@@ -75,7 +75,7 @@
}
JNIEXPORT void JNICALL
-Java_java_io_RandomAccessFile_write(JNIEnv *env, jobject this, jint byte) {
+Java_java_io_RandomAccessFile_write0(JNIEnv *env, jobject this, jint byte) {
writeSingle(env, this, byte, JNI_FALSE, raf_fd);
}
diff --git a/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java b/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
index e8e756c..d5edf3f 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/SolarisUserDefinedFileAttributeView.java
@@ -149,7 +149,7 @@
int afd = openat(fd, nameAsBytes(file,name), (O_RDONLY|O_XATTR), 0);
// wrap with channel
- FileChannel fc = UnixChannelFactory.newFileChannel(afd, true, false);
+ FileChannel fc = UnixChannelFactory.newFileChannel(afd, file.toString(), true, false);
// read to EOF (nothing we can do if I/O error occurs)
try {
@@ -190,7 +190,7 @@
UnixFileModeAttribute.ALL_PERMISSIONS);
// wrap with channel
- FileChannel fc = UnixChannelFactory.newFileChannel(afd, false, true);
+ FileChannel fc = UnixChannelFactory.newFileChannel(afd, file.toString(), false, true);
// write value (nothing we can do if I/O error occurs)
try {
diff --git a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
index d18a466..c6f074e 100644
--- a/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
+++ b/jdk/src/solaris/classes/sun/nio/fs/UnixChannelFactory.java
@@ -100,10 +100,10 @@
/**
* Constructs a file channel from an existing (open) file descriptor
*/
- static FileChannel newFileChannel(int fd, boolean reading, boolean writing) {
+ static FileChannel newFileChannel(int fd, String path, boolean reading, boolean writing) {
FileDescriptor fdObj = new FileDescriptor();
fdAccess.set(fdObj, fd);
- return FileChannelImpl.open(fdObj, reading, writing, null);
+ return FileChannelImpl.open(fdObj, path, reading, writing, null);
}
/**
@@ -134,7 +134,7 @@
throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
FileDescriptor fdObj = open(dfd, path, pathForPermissionCheck, flags, mode);
- return FileChannelImpl.open(fdObj, flags.read, flags.write, flags.append, null);
+ return FileChannelImpl.open(fdObj, path.toString(), flags.read, flags.write, flags.append, null);
}
/**
diff --git a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
index 3568756..86c3a70 100644
--- a/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainDatagramSocketImpl.c
@@ -517,6 +517,8 @@
} else if (ret == JVM_IO_ERR) {
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+ } else if (errno == ENOMEM) {
+ JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Peek failed");
}
@@ -617,15 +619,18 @@
"Receive timed out");
return -1;
} else if (ret == JVM_IO_ERR) {
+ if (errno == ENOMEM) {
+ JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
#ifdef __linux__
- if (errno == EBADF) {
+ } else if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
- }
#else
- JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+ } else {
+ JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
#endif
+ }
return -1;
} else if (ret == JVM_IO_INTR) {
JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException",
@@ -835,15 +840,18 @@
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
"Receive timed out");
} else if (ret == JVM_IO_ERR) {
+ if (errno == ENOMEM) {
+ JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
#ifdef __linux__
- if (errno == EBADF) {
+ } else if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Receive failed");
- }
#else
- JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+ } else {
+ JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
#endif
+ }
} else if (ret == JVM_IO_INTR) {
JNU_ThrowByName(env, JNU_JAVAIOPKG "InterruptedIOException",
"operation interrupted");
diff --git a/jdk/src/solaris/native/java/net/PlainSocketImpl.c b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
index b6f78b9..5fed070 100644
--- a/jdk/src/solaris/native/java/net/PlainSocketImpl.c
+++ b/jdk/src/solaris/native/java/net/PlainSocketImpl.c
@@ -708,7 +708,6 @@
} else {
ret = NET_Timeout(fd, timeout);
}
-
if (ret == 0) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketTimeoutException",
"Accept timed out");
@@ -716,6 +715,8 @@
} else if (ret == JVM_IO_ERR) {
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+ } else if (errno == ENOMEM) {
+ JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException", "Accept failed");
}
diff --git a/jdk/src/solaris/native/java/net/SocketInputStream.c b/jdk/src/solaris/native/java/net/SocketInputStream.c
index ccee03c..8643262 100644
--- a/jdk/src/solaris/native/java/net/SocketInputStream.c
+++ b/jdk/src/solaris/native/java/net/SocketInputStream.c
@@ -108,6 +108,8 @@
} else if (nread == JVM_IO_ERR) {
if (errno == EBADF) {
JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", "Socket closed");
+ } else if (errno == ENOMEM) {
+ JNU_ThrowOutOfMemoryError(env, "NET_Timeout native heap allocation failed");
} else {
NET_ThrowByNameWithLastError(env, JNU_JAVANETPKG "SocketException",
"select/poll failed");
diff --git a/jdk/src/solaris/native/java/net/bsd_close.c b/jdk/src/solaris/native/java/net/bsd_close.c
index f314357..5ec3bea 100644
--- a/jdk/src/solaris/native/java/net/bsd_close.c
+++ b/jdk/src/solaris/native/java/net/bsd_close.c
@@ -25,6 +25,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <sys/param.h>
#include <signal.h>
#include <pthread.h>
#include <sys/types.h>
@@ -35,7 +36,6 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
-
#include <sys/poll.h>
/*
@@ -347,6 +347,10 @@
int NET_Timeout(int s, long timeout) {
long prevtime = 0, newtime;
struct timeval t, *tp = &t;
+ fd_set fds;
+ fd_set* fdsp = NULL;
+ int allocated = 0;
+ threadEntry_t self;
fdEntry_t *fdEntry = getFdEntry(s);
/*
@@ -376,20 +380,29 @@
t.tv_usec = 0;
}
+ if (s < FD_SETSIZE) {
+ fdsp = &fds;
+ FD_ZERO(fdsp);
+ } else {
+ int length = (howmany(s+1, NFDBITS)) * sizeof(int);
+ fdsp = (fd_set *) calloc(1, length);
+ if (fdsp == NULL) {
+ return -1; // errno will be set to ENOMEM
+ }
+ allocated = 1;
+ }
+ FD_SET(s, fdsp);
+
for(;;) {
- fd_set rfds;
int rv;
- threadEntry_t self;
/*
* call select on the fd. If interrupted by our wakeup signal
* errno will be set to EBADF.
*/
- FD_ZERO(&rfds);
- FD_SET(s, &rfds);
startOp(fdEntry, &self);
- rv = select(s+1, &rfds, 0, 0, tp);
+ rv = select(s+1, fdsp, 0, 0, tp);
endOp(fdEntry, &self);
/*
@@ -403,6 +416,8 @@
newtime = now.tv_sec * 1000 + now.tv_usec / 1000;
timeout -= newtime - prevtime;
if (timeout <= 0) {
+ if (allocated != 0)
+ free(fdsp);
return 0;
}
prevtime = newtime;
@@ -410,6 +425,8 @@
t.tv_usec = (timeout % 1000) * 1000;
}
} else {
+ if (allocated != 0)
+ free(fdsp);
return rv;
}
diff --git a/jdk/src/solaris/native/java/net/linux_close.c b/jdk/src/solaris/native/java/net/linux_close.c
index 38d9986..2d3dfe2 100644
--- a/jdk/src/solaris/native/java/net/linux_close.c
+++ b/jdk/src/solaris/native/java/net/linux_close.c
@@ -34,7 +34,6 @@
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
-
#include <sys/poll.h>
/*
diff --git a/jdk/src/solaris/native/sun/awt/gtk2_interface.c b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
index efe0797..cfcef70 100644
--- a/jdk/src/solaris/native/sun/awt/gtk2_interface.c
+++ b/jdk/src/solaris/native/sun/awt/gtk2_interface.c
@@ -32,6 +32,7 @@
#include "java_awt_Transparency.h"
#include "jvm_md.h"
#include "sizecalc.h"
+#include <jni_util.h>
#define GTK2_LIB_VERSIONED VERSIONED_JNI_LIB_NAME("gtk-x11-2.0", "0")
#define GTK2_LIB JNI_LIB_NAME("gtk-x11-2.0")
@@ -456,13 +457,19 @@
const gchar * const * schemes = NULL;
jclass cls_action = (*env)->FindClass(env, "java/awt/Desktop$Action");
+ CHECK_NULL(cls_action);
jclass cls_xDesktopPeer = (*env)->FindClass(env, "sun/awt/X11/XDesktopPeer");
+ CHECK_NULL(cls_xDesktopPeer);
jfieldID fld_supportedActions = (*env)->GetStaticFieldID(env, cls_xDesktopPeer, "supportedActions", "Ljava/util/List;");
+ CHECK_NULL(fld_supportedActions);
jobject supportedActions = (*env)->GetStaticObjectField(env, cls_xDesktopPeer, fld_supportedActions);
jclass cls_arrayList = (*env)->FindClass(env, "java/util/ArrayList");
+ CHECK_NULL(cls_arrayList);
jmethodID mid_arrayListAdd = (*env)->GetMethodID(env, cls_arrayList, "add", "(Ljava/lang/Object;)Z");
+ CHECK_NULL(mid_arrayListAdd);
jmethodID mid_arrayListClear = (*env)->GetMethodID(env, cls_arrayList, "clear", "()V");
+ CHECK_NULL(mid_arrayListClear);
(*env)->CallVoidMethod(env, supportedActions, mid_arrayListClear);
diff --git a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
index 79a91a0..5e2a78b 100644
--- a/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
+++ b/jdk/src/solaris/native/sun/nio/ch/NativeThread.c
@@ -32,27 +32,32 @@
#include "sun_nio_ch_NativeThread.h"
#include "nio_util.h"
-
#ifdef __linux__
-#include <pthread.h>
-#include <sys/signal.h>
-
-/* Also defined in src/solaris/native/java/net/linux_close.c */
-#define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+ #include <pthread.h>
+ #include <sys/signal.h>
+ /* Also defined in net/linux_close.c */
+ #define INTERRUPT_SIGNAL (__SIGRTMAX - 2)
+#elif __solaris__
+ #include <thread.h>
+ #include <signal.h>
+ #define INTERRUPT_SIGNAL (SIGRTMAX - 2)
+#elif _ALLBSD_SOURCE
+ #include <pthread.h>
+ #include <signal.h>
+ /* Also defined in net/bsd_close.c */
+ #define INTERRUPT_SIGNAL SIGIO
+#else
+ #error "missing platform-specific definition here"
+#endif
static void
nullHandler(int sig)
{
}
-#endif
-
-
JNIEXPORT void JNICALL
Java_sun_nio_ch_NativeThread_init(JNIEnv *env, jclass cl)
{
-#ifdef __linux__
-
/* Install the null handler for INTERRUPT_SIGNAL. This might overwrite the
* handler previously installed by java/net/linux_close.c, but that's okay
* since neither handler actually does anything. We install our own
@@ -67,25 +72,27 @@
sigemptyset(&sa.sa_mask);
if (sigaction(INTERRUPT_SIGNAL, &sa, &osa) < 0)
JNU_ThrowIOExceptionWithLastError(env, "sigaction");
-
-#endif
}
JNIEXPORT jlong JNICALL
Java_sun_nio_ch_NativeThread_current(JNIEnv *env, jclass cl)
{
-#ifdef __linux__
- return (long)pthread_self();
+#ifdef __solaris__
+ return (jlong)thr_self();
#else
- return -1;
+ return (jlong)pthread_self();
#endif
}
JNIEXPORT void JNICALL
Java_sun_nio_ch_NativeThread_signal(JNIEnv *env, jclass cl, jlong thread)
{
-#ifdef __linux__
- if (pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL))
- JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
+ int ret;
+#ifdef __solaris__
+ ret = thr_kill((thread_t)thread, INTERRUPT_SIGNAL);
+#else
+ ret = pthread_kill((pthread_t)thread, INTERRUPT_SIGNAL);
#endif
+ if (ret != 0)
+ JNU_ThrowIOExceptionWithLastError(env, "Thread signal failed");
}
diff --git a/jdk/src/windows/classes/sun/nio/fs/WindowsChannelFactory.java b/jdk/src/windows/classes/sun/nio/fs/WindowsChannelFactory.java
index d9b1489..46d063c 100644
--- a/jdk/src/windows/classes/sun/nio/fs/WindowsChannelFactory.java
+++ b/jdk/src/windows/classes/sun/nio/fs/WindowsChannelFactory.java
@@ -25,19 +25,22 @@
package sun.nio.fs;
-import java.nio.file.*;
-import java.nio.channels.*;
import java.io.FileDescriptor;
import java.io.IOException;
-import java.util.*;
+import java.nio.channels.AsynchronousFileChannel;
+import java.nio.channels.FileChannel;
+import java.nio.file.LinkOption;
+import java.nio.file.OpenOption;
+import java.nio.file.StandardOpenOption;
+import java.util.Set;
import com.sun.nio.file.ExtendedOpenOption;
+import sun.misc.JavaIOFileDescriptorAccess;
+import sun.misc.SharedSecrets;
import sun.nio.ch.FileChannelImpl;
import sun.nio.ch.ThreadPool;
import sun.nio.ch.WindowsAsynchronousFileChannelImpl;
-import sun.misc.SharedSecrets;
-import sun.misc.JavaIOFileDescriptorAccess;
import static sun.nio.fs.WindowsNativeDispatcher.*;
import static sun.nio.fs.WindowsConstants.*;
@@ -157,7 +160,7 @@
throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
FileDescriptor fdObj = open(pathForWindows, pathToCheck, flags, pSecurityDescriptor);
- return FileChannelImpl.open(fdObj, flags.read, flags.write, flags.append, null);
+ return FileChannelImpl.open(fdObj, pathForWindows, flags.read, flags.write, flags.append, null);
}
/**
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index e7c3ecd..1d9efbc 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -183,11 +183,6 @@
# 6963118
java/nio/channels/Selector/Wakeup.java windows-all
-# 7133499, 7133497
-java/nio/channels/AsyncCloseAndInterrupt.java macosx-all
-java/nio/channels/AsynchronousFileChannel/Lock.java macosx-all
-java/nio/channels/FileChannel/Transfer.java macosx-all
-
# 7141822
java/nio/channels/DatagramChannel/ChangingAddress.java macosx-all
diff --git a/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
new file mode 100644
index 0000000..b0f3c63
--- /dev/null
+++ b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+/* @test
+ @bug 8032078
+ @summary Frame.setExtendedState throws RuntimeException, if
+ windowState=ICONIFIED|MAXIMIZED_BOTH, on OS X
+ @author Anton Litvinov
+*/
+
+import java.awt.*;
+
+import sun.awt.SunToolkit;
+
+public class ExceptionOnSetExtendedStateTest {
+ private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
+ private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+
+ private static boolean validatePlatform() {
+ String osName = System.getProperty("os.name");
+ if (osName == null) {
+ throw new RuntimeException("Name of the current OS could not be retrieved.");
+ }
+ return osName.startsWith("Mac");
+ }
+
+ private static void testStateChange(int oldState, int newState, boolean decoratedFrame) {
+ System.out.println(String.format(
+ "testStateChange: oldState='%d', newState='%d', decoratedFrame='%b'",
+ oldState, newState, decoratedFrame));
+
+ Frame frame = new Frame("ExceptionOnSetExtendedStateTest");
+ frame.setSize(200, 200);
+ frame.setUndecorated(!decoratedFrame);
+ frame.setVisible(true);
+ toolkit.realSync();
+
+ frame.setExtendedState(oldState);
+ sleep(1000);
+ frame.setExtendedState(newState);
+
+ boolean stateWasNotChanged = true;
+ int currentState = 0;
+ for (int i = 0; (i < 3) && stateWasNotChanged; i++) {
+ sleep(1000);
+ currentState = frame.getExtendedState();
+ if ((currentState == newState) ||
+ (((newState & Frame.ICONIFIED) != 0) && ((currentState & Frame.ICONIFIED) != 0))) {
+ stateWasNotChanged = false;
+ }
+ }
+ frame.dispose();
+
+ if (stateWasNotChanged) {
+ throw new RuntimeException(String.format(
+ "Frame state was not changed. currentState='%d'", currentState));
+ }
+ }
+
+ private static void sleep(int millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) {
+ if (!validatePlatform()) {
+ System.out.println("This test is only for OS X.");
+ return;
+ }
+
+ // Verify that changing states of decorated/undecorated frame to/from supported states
+ // and the state bit mask ICONIFIED | MAXIMIZED_BOTH does not raise RuntimeException.
+ for (int i = 0; i < frameStates.length; i++) {
+ testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, true);
+ testStateChange(frameStates[i], Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, false);
+ testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], true);
+ testStateChange(Frame.ICONIFIED | Frame.MAXIMIZED_BOTH, frameStates[i], false);
+ }
+ }
+}
diff --git a/jdk/test/java/lang/instrument/DaemonThread/DummyAgent.java b/jdk/test/java/lang/instrument/DaemonThread/DummyAgent.java
new file mode 100644
index 0000000..64b4d59
--- /dev/null
+++ b/jdk/test/java/lang/instrument/DaemonThread/DummyAgent.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+import java.lang.instrument.ClassFileTransformer;
+import java.lang.instrument.IllegalClassFormatException;
+import java.lang.instrument.Instrumentation;
+import java.security.ProtectionDomain;
+
+public class DummyAgent implements ClassFileTransformer {
+ @Override
+ public byte[] transform(ClassLoader loader, String className,
+ Class<?> classBeingRedefined, ProtectionDomain protectionDomain,
+ byte[] classfileBuffer) throws IllegalClassFormatException {
+
+ /* The Daemon Thread bug is timing dependent and you want the transform method
+ * to return ASAP - so just return the buffer will be fine
+ */
+ return classfileBuffer;
+ }
+
+ public static void premain(String agentArgs, Instrumentation inst) {
+ inst.addTransformer(new DummyAgent(), false);
+ }
+
+}
diff --git a/jdk/test/java/lang/instrument/DaemonThread/DummyClass.java b/jdk/test/java/lang/instrument/DaemonThread/DummyClass.java
new file mode 100644
index 0000000..18d671a
--- /dev/null
+++ b/jdk/test/java/lang/instrument/DaemonThread/DummyClass.java
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+/* Just a dummy class for loading */
+public class DummyClass {
+}
diff --git a/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java
new file mode 100644
index 0000000..20c9077
--- /dev/null
+++ b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThread.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+/* @test
+ * @bug 7142035
+ * @summary Assert in java.lang.instrument agents during shutdown when classloading occurs after shutdown
+ * @library /lib/testlibrary
+ *
+ * @build DummyAgent DummyClass TestDaemonThreadLauncher TestDaemonThread
+ * @run shell ../MakeJAR3.sh DummyAgent
+ * @run main TestDaemonThreadLauncher /timeout=240
+ *
+ */
+import java.io.File;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+public class TestDaemonThread implements Runnable{
+ File classpath;
+
+ public TestDaemonThread(File classpath) {
+ this.classpath = classpath;
+ }
+
+ @Override
+ public void run() {
+
+
+ try {
+ URL u = this.getClass().getClassLoader().getResource("DummyClass.class");
+ String path = u.getPath();
+ String parent = u.getPath().substring(0, path.lastIndexOf('/')+1);
+ URL parentURL = new URL(u, parent);
+ System.out.println(parentURL);
+ /* Load lots of class by creating multiple classloaders */
+ for(;;) {
+ ClassLoader cl = new URLClassLoader(new URL[] {parentURL}, null);
+ cl.loadClass("DummyClass");
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ Thread t = new Thread(new TestDaemonThread(new File(args[0])));
+ /* The important part of the bug is that a Daemon thread can continue to load classes after shutdown */
+ t.setDaemon(true);
+ t.start();
+ Thread.sleep(200);
+ }
+}
diff --git a/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java
new file mode 100644
index 0000000..9660bbf
--- /dev/null
+++ b/jdk/test/java/lang/instrument/DaemonThread/TestDaemonThreadLauncher.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2014 Goldman Sachs.
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Path;
+
+public class TestDaemonThreadLauncher {
+
+ private static ProcessBuilder processBuilder = new ProcessBuilder();
+
+ public static void main(String args[]) throws Exception {
+ for(int i=0; i<50; i++) {
+ ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-javaagent:DummyAgent.jar", "TestDaemonThread", ".");
+ OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+ analyzer.shouldNotContain("ASSERTION FAILED");
+ }
+ }
+}
diff --git a/jdk/test/java/net/ServerSocket/AnotherSelectFdsLimit.java b/jdk/test/java/net/ServerSocket/AnotherSelectFdsLimit.java
new file mode 100644
index 0000000..391c5fb
--- /dev/null
+++ b/jdk/test/java/net/ServerSocket/AnotherSelectFdsLimit.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8035897
+ * @summary FD_SETSIZE should be set on macosx
+ * @run main/othervm AnotherSelectFdsLimit 1023
+ * @run main/othervm AnotherSelectFdsLimit 1024
+ * @run main/othervm AnotherSelectFdsLimit 1025
+ * @run main/othervm AnotherSelectFdsLimit 1600
+ */
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.SocketTimeoutException;
+import java.util.ArrayList;
+import java.util.List;
+
+public class AnotherSelectFdsLimit {
+ static final int DEFAULT_FDS_TO_USE = 1600;
+
+ public static void main(String [] args) throws Exception {
+ if (!System.getProperty("os.name").contains("OS X")) {
+ System.out.println("Test only run on MAC. Exiting.");
+ return;
+ }
+
+ int fdsToUse = DEFAULT_FDS_TO_USE;
+ if (args.length == 1)
+ fdsToUse = Integer.parseInt(args[0]);
+
+ System.out.println("Using " + fdsToUse + " fds.");
+
+ List<Thread> threads = new ArrayList<>();
+ for (int i=0; i<fdsToUse; i++)
+ threads.add(new WorkerThread());
+
+ for (Thread t : threads)
+ t.start();
+
+ for (Thread t : threads)
+ t.join();
+ }
+
+ static class WorkerThread extends Thread {
+ public void run() {
+ try (ServerSocket ss = new ServerSocket(0)) {
+ ss.setSoTimeout(2000);
+ ss.accept();
+ } catch (SocketTimeoutException x) {
+ // expected
+ } catch (IOException x) {
+ throw new java.io.UncheckedIOException(x);
+ }
+ }
+ }
+}
diff --git a/jdk/test/java/nio/channels/Selector/ByteServer.java b/jdk/test/java/nio/channels/Selector/ByteServer.java
index eefd1fb..40d8adf 100644
--- a/jdk/test/java/nio/channels/Selector/ByteServer.java
+++ b/jdk/test/java/nio/channels/Selector/ByteServer.java
@@ -22,52 +22,54 @@
*/
/**
- *
- * Utility class for tests. A simple server, which waits for a connection,
- * writes out n bytes and waits.
+ * Utility class for tests. A simple "in-thread" server to accept connections
+ * and write bytes.
* @author kladko
*/
import java.net.Socket;
import java.net.ServerSocket;
+import java.net.SocketAddress;
+import java.net.InetSocketAddress;
+import java.io.IOException;
+import java.io.Closeable;
-public class ByteServer {
+public class ByteServer implements Closeable {
- public static final String LOCALHOST = "localhost";
- private int bytecount;
- private Socket socket;
- private ServerSocket serversocket;
- private Thread serverthread;
- volatile Exception savedException;
+ private final ServerSocket ss;
+ private Socket s;
- public ByteServer(int bytecount) throws Exception{
- this.bytecount = bytecount;
- serversocket = new ServerSocket(0);
+ ByteServer() throws IOException {
+ this.ss = new ServerSocket(0);
}
- public int port() {
- return serversocket.getLocalPort();
+ SocketAddress address() {
+ return new InetSocketAddress(ss.getInetAddress(), ss.getLocalPort());
}
- public void start() {
- serverthread = new Thread() {
- public void run() {
- try {
- socket = serversocket.accept();
- socket.getOutputStream().write(new byte[bytecount]);
- socket.getOutputStream().flush();
- } catch (Exception e) {
- System.err.println("Exception in ByteServer: " + e);
- System.exit(1);
- }
- }
- };
- serverthread.start();
+ void acceptConnection() throws IOException {
+ if (s != null)
+ throw new IllegalStateException("already connected");
+ this.s = ss.accept();
}
- public void exit() throws Exception {
- serverthread.join();
- socket.close();
- serversocket.close();
+ void closeConnection() throws IOException {
+ Socket s = this.s;
+ if (s != null) {
+ this.s = null;
+ s.close();
+ }
+ }
+
+ void write(int count) throws IOException {
+ if (s == null)
+ throw new IllegalStateException("no connection");
+ s.getOutputStream().write(new byte[count]);
+ }
+
+ public void close() throws IOException {
+ if (s != null)
+ s.close();
+ ss.close();
}
}
diff --git a/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java
index e5d0b09..93318fb 100644
--- a/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java
+++ b/jdk/test/java/nio/channels/Selector/ReadAfterConnect.java
@@ -27,27 +27,25 @@
* @author kladko
*/
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
public class ReadAfterConnect {
-
public static void main(String[] argv) throws Exception {
- ByteServer server = new ByteServer(0); // server: accept connection and do nothing
- server.start();
- InetSocketAddress isa = new InetSocketAddress(
- InetAddress.getByName(ByteServer.LOCALHOST), server.port());
- Selector sel = Selector.open();
- SocketChannel sc = SocketChannel.open();
- sc.connect(isa);
- sc.configureBlocking(false);
- sc.register(sel, SelectionKey.OP_READ);
- // Previously channel would get selected here, although there is nothing to read
- if (sel.selectNow() != 0)
- throw new Exception("Select returned nonzero value");
- sc.close();
- server.exit();
+ try (ByteServer server = new ByteServer();
+ SocketChannel sc = SocketChannel.open(server.address())) {
+
+ server.acceptConnection();
+
+ try (Selector sel = Selector.open()) {
+ sc.configureBlocking(false);
+ sc.register(sel, SelectionKey.OP_READ);
+ // Previously channel would get selected here, although there is nothing to read
+ if (sel.selectNow() != 0)
+ throw new Exception("Select returned nonzero value");
+ }
+ }
}
}
diff --git a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java
index fccd9dd..3563146 100644
--- a/jdk/test/java/nio/channels/Selector/SelectAfterRead.java
+++ b/jdk/test/java/nio/channels/Selector/SelectAfterRead.java
@@ -28,60 +28,62 @@
* @author kladko
*/
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
+import java.nio.ByteBuffer;
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
public class SelectAfterRead {
- final static int TIMEOUT = 1000;
+ private static final int TIMEOUT = 1000;
public static void main(String[] argv) throws Exception {
- InetAddress lh = InetAddress.getByName(ByteServer.LOCALHOST);
// server: accept connection and write one byte
- ByteServer server = new ByteServer(1);
- server.start();
- Selector sel = Selector.open();
- SocketChannel sc = SocketChannel.open();
- sc.connect(new InetSocketAddress(lh, server.port()));
- sc.read(ByteBuffer.allocate(1));
- sc.configureBlocking(false);
- sc.register(sel, SelectionKey.OP_READ);
- // previously on Windows select would select channel here, although there was
- // nothing to read
- if (sel.selectNow() != 0)
- throw new Exception("Select returned nonzero value");
- sc.close();
- sel.close();
- server.exit();
+ try (ByteServer server = new ByteServer();
+ SocketChannel sc = SocketChannel.open(server.address())) {
+
+ server.acceptConnection();
+ server.write(1);
+
+ try (Selector sel = Selector.open()) {
+ sc.read(ByteBuffer.allocate(1));
+ sc.configureBlocking(false);
+ sc.register(sel, SelectionKey.OP_READ);
+ // previously on Windows select would select channel here, although there was
+ // nothing to read
+ if (sel.selectNow() != 0)
+ throw new Exception("Select returned nonzero value");
+ }
+ }
// Now we will test a two reads combination
// server: accept connection and write two bytes
- server = new ByteServer(2);
- server.start();
- sc = SocketChannel.open();
- sc.connect(new InetSocketAddress(lh, server.port()));
- sc.configureBlocking(false);
- sel = Selector.open();
- sc.register(sel, SelectionKey.OP_READ);
- if (sel.select(TIMEOUT) != 1)
- throw new Exception("One selected key expected");
- sel.selectedKeys().clear();
- // previously on Windows a channel would get selected only once
- if (sel.selectNow() != 1)
- throw new Exception("One selected key expected");
- // Previously on Windows two consequent reads would cause select()
- // to select a channel, although there was nothing remaining to
- // read in the channel
- if (sc.read(ByteBuffer.allocate(1)) != 1)
- throw new Exception("One byte expected");
- if (sc.read(ByteBuffer.allocate(1)) != 1)
- throw new Exception("One byte expected");
- if (sel.selectNow() != 0)
- throw new Exception("Select returned nonzero value");
- sc.close();
- sel.close();
- server.exit();
+ try (ByteServer server = new ByteServer();
+ SocketChannel sc = SocketChannel.open(server.address())) {
+
+ server.acceptConnection();
+ server.write(2);
+
+ try (Selector sel = Selector.open()) {
+ sc.configureBlocking(false);
+ sc.register(sel, SelectionKey.OP_READ);
+ if (sel.select(TIMEOUT) != 1)
+ throw new Exception("One selected key expected");
+ sel.selectedKeys().clear();
+ // previously on Windows a channel would get selected only once
+ if (sel.selectNow() != 1)
+ throw new Exception("One selected key expected");
+ // Previously on Windows two consequent reads would cause select()
+ // to select a channel, although there was nothing remaining to
+ // read in the channel
+ if (sc.read(ByteBuffer.allocate(1)) != 1)
+ throw new Exception("One byte expected");
+ if (sc.read(ByteBuffer.allocate(1)) != 1)
+ throw new Exception("One byte expected");
+ if (sel.selectNow() != 0)
+ throw new Exception("Select returned nonzero value");
+ }
+ }
}
}
diff --git a/jdk/test/java/nio/channels/Selector/SelectWrite.java b/jdk/test/java/nio/channels/Selector/SelectWrite.java
index 3c2d3d8..ab305ed 100644
--- a/jdk/test/java/nio/channels/Selector/SelectWrite.java
+++ b/jdk/test/java/nio/channels/Selector/SelectWrite.java
@@ -22,36 +22,33 @@
*/
/* @test
- @bug 4645302
- @summary Socket with OP_WRITE would get selected only once
- @author kladko
+ * @bug 4645302
+ * @summary Socket with OP_WRITE would get selected only once
+ * @author kladko
*/
-import java.net.*;
-import java.nio.*;
-import java.nio.channels.*;
-
+import java.nio.channels.Selector;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
public class SelectWrite {
public static void main(String[] argv) throws Exception {
- ByteServer server = new ByteServer(0);
- // server: accept connection and do nothing
- server.start();
- InetSocketAddress isa = new InetSocketAddress(
- InetAddress.getByName(ByteServer.LOCALHOST), server.port());
- Selector sel = Selector.open();
- SocketChannel sc = SocketChannel.open();
- sc.connect(isa);
- sc.configureBlocking(false);
- sc.register(sel, SelectionKey.OP_WRITE);
- sel.select();
- sel.selectedKeys().clear();
- if (sel.select() == 0) {
- throw new Exception("Select returned zero");
+ try (ByteServer server = new ByteServer();
+ SocketChannel sc = SocketChannel.open(server.address())) {
+
+ server.acceptConnection();
+
+ try (Selector sel = Selector.open()) {
+ sc.configureBlocking(false);
+ sc.register(sel, SelectionKey.OP_WRITE);
+ sel.select();
+ sel.selectedKeys().clear();
+ if (sel.select() == 0) {
+ throw new Exception("Select returned zero");
+ }
+ }
}
- sc.close();
- sel.close();
}
}
diff --git a/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.html b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.html
new file mode 100644
index 0000000..b61bbf8
--- /dev/null
+++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.html
@@ -0,0 +1,40 @@
+<!--
+ Copyright (c) 2014, 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.
+
+ 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.
+-->
+
+<html>
+<body>
+
+Verify that high resolution system icons are used JCheckBoxMenuItem
+on HiDPI displays.
+
+If the display does not support HiDPI mode press PASS.
+
+1. Run the test on HiDPI Display.
+2. Press the Menu in the applet
+3. Check that the icon on the JCheckBoxMenuItem is smooth
+If so, press PASS, else press FAIL.
+
+<applet code="bug8031573.class" width=250 height=250></applet>
+
+</body>
+</html>
diff --git a/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java
new file mode 100644
index 0000000..5cb1dc5
--- /dev/null
+++ b/jdk/test/javax/swing/JMenuItem/8031573/bug8031573.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ * 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.
+ */
+import java.awt.FlowLayout;
+import javax.swing.JApplet;
+import javax.swing.JCheckBoxMenuItem;
+import javax.swing.JMenu;
+import javax.swing.JMenuBar;
+import javax.swing.SwingUtilities;
+
+/* @test
+ * @bug 8031573
+ * @summary [macosx] Checkmarks of JCheckBoxMenuItems aren't rendered
+ * in high resolution on Retina
+ * @author Alexander Scherbatiy
+ * @run applet/manual=yesno bug8031573.html
+ */
+public class bug8031573 extends JApplet {
+
+ @Override
+ public void init() {
+ try {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ JMenuBar bar = new JMenuBar();
+ JMenu menu = new JMenu("Menu");
+ JCheckBoxMenuItem checkBoxMenuItem
+ = new JCheckBoxMenuItem("JCheckBoxMenuItem");
+ checkBoxMenuItem.setSelected(true);
+ menu.add(checkBoxMenuItem);
+ bar.add(menu);
+ setJMenuBar(bar);
+ }
+ });
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+ }
+}
diff --git a/jdk/test/javax/xml/jaxp/transform/8004476/TestBase.java b/jdk/test/javax/xml/jaxp/transform/8004476/TestBase.java
index 4b6ea70..11333fa 100644
--- a/jdk/test/javax/xml/jaxp/transform/8004476/TestBase.java
+++ b/jdk/test/javax/xml/jaxp/transform/8004476/TestBase.java
@@ -1,7 +1,26 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
- * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
+ * 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.
+ *
+ * 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.
*/
+
import java.security.Policy;
/**
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
index efe2a31..1d4bbb1 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/LocalManagementTest.java
@@ -32,6 +32,7 @@
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference;
+import jdk.testlibrary.ProcessTools;
/**
* @test
@@ -43,11 +44,9 @@
* both agent properties and jvmstat buffer.
* @build jdk.testlibrary.ProcessTools
* @build TestManager TestApplication
- * @run main/othervm/timeout=300 LocalManagementTest
+ * @run main/othervm/timeout=300 -XX:+UsePerfData LocalManagementTest
*/
-import jdk.testlibrary.ProcessTools;
-
public class LocalManagementTest {
private static final String TEST_CLASSPATH = System.getProperty("test.class.path");
private static final String TEST_JDK = System.getProperty("test.jdk");
@@ -240,4 +239,4 @@
}
}
}
-}
\ No newline at end of file
+}
diff --git a/langtools/.hgtags b/langtools/.hgtags
index e1ccf25..1570b80 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -255,3 +255,4 @@
8fe7202d3c38784f3f14368e3954fc4e0394afa4 jdk8-b129
26b33a6ea08810853af37e81c9b435465b289c98 jdk8u20-b02
a07271bca831cf1bab35a2ffbcebd8e060b2734b jdk8u20-b03
+613c1d9930c9f650e3fc6926215931a85b679c66 jdk8u20-b04
diff --git a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
index dc4fc9d..4271961 100644
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attribute.java
@@ -71,10 +71,6 @@
// defer init of standardAttributeClasses until after options set up
}
- public void setCompat(boolean compat) {
- this.compat = compat;
- }
-
public Attribute createAttribute(ClassReader cr, int name_index, byte[] data)
throws IOException {
if (standardAttributes == null) {
@@ -109,9 +105,10 @@
protected void init() {
standardAttributes = new HashMap<String,Class<? extends Attribute>>();
standardAttributes.put(AnnotationDefault, AnnotationDefault_attribute.class);
- standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
+ standardAttributes.put(BootstrapMethods, BootstrapMethods_attribute.class);
standardAttributes.put(CharacterRangeTable, CharacterRangeTable_attribute.class);
standardAttributes.put(Code, Code_attribute.class);
+ standardAttributes.put(CompilationID, CompilationID_attribute.class);
standardAttributes.put(ConstantValue, ConstantValue_attribute.class);
standardAttributes.put(Deprecated, Deprecated_attribute.class);
standardAttributes.put(EnclosingMethod, EnclosingMethod_attribute.class);
@@ -120,29 +117,23 @@
standardAttributes.put(LineNumberTable, LineNumberTable_attribute.class);
standardAttributes.put(LocalVariableTable, LocalVariableTable_attribute.class);
standardAttributes.put(LocalVariableTypeTable, LocalVariableTypeTable_attribute.class);
-
- if (!compat) { // old javap does not recognize recent attributes
- standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
- standardAttributes.put(CompilationID, CompilationID_attribute.class);
- standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
- standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
- standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
- standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
- standardAttributes.put(Signature, Signature_attribute.class);
- standardAttributes.put(SourceID, SourceID_attribute.class);
- }
-
+ standardAttributes.put(MethodParameters, MethodParameters_attribute.class);
+ standardAttributes.put(RuntimeInvisibleAnnotations, RuntimeInvisibleAnnotations_attribute.class);
+ standardAttributes.put(RuntimeInvisibleParameterAnnotations, RuntimeInvisibleParameterAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleAnnotations, RuntimeVisibleAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleParameterAnnotations, RuntimeVisibleParameterAnnotations_attribute.class);
+ standardAttributes.put(RuntimeVisibleTypeAnnotations, RuntimeVisibleTypeAnnotations_attribute.class);
+ standardAttributes.put(RuntimeInvisibleTypeAnnotations, RuntimeInvisibleTypeAnnotations_attribute.class);
+ standardAttributes.put(Signature, Signature_attribute.class);
standardAttributes.put(SourceDebugExtension, SourceDebugExtension_attribute.class);
standardAttributes.put(SourceFile, SourceFile_attribute.class);
+ standardAttributes.put(SourceID, SourceID_attribute.class);
standardAttributes.put(StackMap, StackMap_attribute.class);
standardAttributes.put(StackMapTable, StackMapTable_attribute.class);
standardAttributes.put(Synthetic, Synthetic_attribute.class);
}
private Map<String,Class<? extends Attribute>> standardAttributes;
- private boolean compat; // don't support recent attrs in compatibility mode
}
public static Attribute read(ClassReader cr) throws IOException {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
index 0d8f282..33fcae7 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/AttributeWriter.java
@@ -226,10 +226,7 @@
}
public Void visitConstantValue(ConstantValue_attribute attr, Void ignore) {
- if (options.compat) // BUG 6622216 javap names some attributes incorrectly
- print("Constant value: ");
- else
- print("ConstantValue: ");
+ print("ConstantValue: ");
constantWriter.write(attr.constantvalue_index);
println();
return null;
@@ -290,20 +287,10 @@
public Void visitInnerClasses(InnerClasses_attribute attr, Void ignore) {
boolean first = true;
- if (options.compat) {
- writeInnerClassHeader();
- first = false;
- }
for (int i = 0 ; i < attr.classes.length; i++) {
InnerClasses_attribute.Info info = attr.classes[i];
//access
AccessFlags access_flags = info.inner_class_access_flags;
- if (options.compat) {
- // BUG 6622215: javap ignores certain relevant access flags
- access_flags = access_flags.ignore(ACC_STATIC | ACC_PROTECTED | ACC_PRIVATE | ACC_INTERFACE | ACC_SYNTHETIC | ACC_ENUM);
- // BUG 6622232: javap gets whitespace confused
- print(" ");
- }
if (options.checkAccess(access_flags)) {
if (first) {
writeInnerClassHeader();
@@ -345,11 +332,7 @@
}
private void writeInnerClassHeader() {
- if (options.compat) // BUG 6622216: javap names some attributes incorrectly
- print("InnerClass");
- else
- print("InnerClasses");
- println(":");
+ println("InnerClasses:");
indent(+1);
}
@@ -703,10 +686,7 @@
}
String toHex(byte b, int w) {
- if (options.compat) // BUG 6622260: javap prints negative bytes incorrectly in hex
- return toHex((int) b, w);
- else
- return toHex(b & 0xff, w);
+ return toHex(b & 0xff, w);
}
static String toHex(int i) {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
index 07e22de..83b8ba8 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/ClassWriter.java
@@ -120,7 +120,7 @@
public void write(ClassFile cf) {
setClassFile(cf);
- if ((options.sysInfo || options.verbose) && !options.compat) {
+ if (options.sysInfo || options.verbose) {
if (uri != null) {
if (uri.getScheme().equals("file"))
println("Classfile " + uri.getPath());
@@ -152,7 +152,7 @@
println("Compiled from \"" + getSourceFile((SourceFile_attribute) sfa) + "\"");
}
- if ((options.sysInfo || options.verbose) && !options.compat) {
+ if (options.sysInfo || options.verbose) {
indent(-1);
}
@@ -205,8 +205,7 @@
attrWriter.write(cf, cf.attributes, constant_pool);
println("minor version: " + cf.minor_version);
println("major version: " + cf.major_version);
- if (!options.compat)
- writeList("flags: ", flags.getClassFlags(), "\n");
+ writeList("flags: ", flags.getClassFlags(), "\n");
indent(-1);
constantWriter.writeConstantPool();
} else {
@@ -372,7 +371,7 @@
}
print(" ");
print(getFieldName(f));
- if (options.showConstants && !options.compat) { // BUG 4111861 print static final field contents
+ if (options.showConstants) {
Attribute a = f.attributes.get(Attribute.ConstantValue);
if (a instanceof ConstantValue_attribute) {
print(" = ");
@@ -390,7 +389,7 @@
if (options.showDescriptors)
println("descriptor: " + getValue(f.descriptor));
- if (options.verbose && !options.compat)
+ if (options.verbose)
writeList("flags: ", flags.getFieldFlags(), "\n");
if (options.showAllAttrs) {
@@ -487,7 +486,7 @@
println("descriptor: " + getValue(m.descriptor));
}
- if (options.verbose && !options.compat) {
+ if (options.verbose) {
writeList("flags: ", flags.getMethodFlags(), "\n");
}
@@ -553,13 +552,11 @@
}
Signature_attribute getSignature(Attributes attributes) {
- if (options.compat) // javap does not recognize recent attributes
- return null;
return (Signature_attribute) attributes.get(Attribute.Signature);
}
String adjustVarargs(AccessFlags flags, String params) {
- if (flags.is(ACC_VARARGS) && !options.compat) {
+ if (flags.is(ACC_VARARGS)) {
int i = params.lastIndexOf("[]");
if (i > 0)
return params.substring(0, i) + "..." + params.substring(i+2);
diff --git a/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java b/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java
index fad08ac..3a0813d 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/ConstantWriter.java
@@ -64,7 +64,7 @@
public Integer visitClass(CONSTANT_Class_info info, Void p) {
print("#" + info.name_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
@@ -76,7 +76,7 @@
public Integer visitFieldref(CONSTANT_Fieldref_info info, Void p) {
print("#" + info.class_index + ".#" + info.name_and_type_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
@@ -93,14 +93,14 @@
public Integer visitInterfaceMethodref(CONSTANT_InterfaceMethodref_info info, Void p) {
print("#" + info.class_index + ".#" + info.name_and_type_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
public Integer visitInvokeDynamic(CONSTANT_InvokeDynamic_info info, Void p) {
print("#" + info.bootstrap_method_attr_index + ":#" + info.name_and_type_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
@@ -112,21 +112,21 @@
public Integer visitNameAndType(CONSTANT_NameAndType_info info, Void p) {
print("#" + info.name_index + ":#" + info.type_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
public Integer visitMethodref(CONSTANT_Methodref_info info, Void p) {
print("#" + info.class_index + ".#" + info.name_and_type_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
public Integer visitMethodHandle(CONSTANT_MethodHandle_info info, Void p) {
print("#" + info.reference_kind.tag + ":#" + info.reference_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
@@ -140,7 +140,7 @@
public Integer visitString(CONSTANT_String_info info, Void p) {
print("#" + info.string_index);
tab();
- println("// " + stringValue(info));
+ println("// " + stringValue(info));
return 1;
}
diff --git a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
index 26e3504..be5c7de 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
@@ -195,48 +195,12 @@
}
},
-// new Option(false, "-all") {
-// void process(JavapTask task, String opt, String arg) {
-// task.options.showAllAttrs = true;
-// }
-// },
-
- new Option(false, "-h") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- throw task.new BadArgs("err.h.not.supported");
- }
- },
-
- new Option(false, "-verify", "-verify-verbose") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- throw task.new BadArgs("err.verify.not.supported");
- }
- },
-
new Option(false, "-sysinfo") {
void process(JavapTask task, String opt, String arg) {
task.options.sysInfo = true;
}
},
- new Option(false, "-Xold") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- task.log.println(task.getMessage("warn.Xold.not.supported"));
- }
- },
-
- new Option(false, "-Xnew") {
- void process(JavapTask task, String opt, String arg) throws BadArgs {
- // ignore: this _is_ the new version
- }
- },
-
- new Option(false, "-XDcompat") {
- void process(JavapTask task, String opt, String arg) {
- task.options.compat = true;
- }
- },
-
new Option(false, "-XDdetails") {
void process(JavapTask task, String opt, String arg) {
task.options.details = EnumSet.allOf(InstructionDetailWriter.Kind.class);
@@ -524,7 +488,7 @@
throw new BadArgs("err.unknown.option", arg).showUsage(true);
}
- if (!options.compat && options.accessOptions.size() > 1) {
+ if (options.accessOptions.size() > 1) {
StringBuilder sb = new StringBuilder();
for (String opt: options.accessOptions) {
if (sb.length() > 0)
@@ -589,8 +553,6 @@
SourceWriter sourceWriter = SourceWriter.instance(context);
sourceWriter.setFileManager(fileManager);
- attributeFactory.setCompat(options.compat);
-
int result = EXIT_OK;
for (String className: classes) {
diff --git a/langtools/src/share/classes/com/sun/tools/javap/Options.java b/langtools/src/share/classes/com/sun/tools/javap/Options.java
index 8ce2a01..76edd81 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/Options.java
+++ b/langtools/src/share/classes/com/sun/tools/javap/Options.java
@@ -88,6 +88,4 @@
public boolean showInnerClasses;
public int indentWidth = 2; // #spaces per indentWidth level; must be > 0
public int tabColumn = 40; // column number for comments; must be > 0
-
- public boolean compat; // bug-for-bug compatibility mode with old javap
}
diff --git a/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties b/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties
index b9132e3..861a676 100644
--- a/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties
+++ b/langtools/src/share/classes/com/sun/tools/javap/resources/javap.properties
@@ -6,7 +6,6 @@
err.crash=A serious internal error has occurred: {0}\nPlease file a bug report, and include the following information:\n{1}
err.end.of.file=unexpected end of file while reading {0}
err.file.not.found=file not found: {0}
-err.h.not.supported=-h is no longer available - use the 'javah' program
err.incompatible.options=bad combination of options: {0}
err.internal.error=internal error: {0} {1} {2}
err.invalid.arg.for.option=invalid argument for option: {0}
@@ -16,11 +15,9 @@
err.not.standard.file.manager=can only specify class files when using a standard file manager
err.invalid.use.of.option=invalid use of option: {0}
err.unknown.option=unknown option: {0}
-err.verify.not.supported=-verify not supported
err.no.SourceFile.attribute=no SourceFile attribute
err.source.file.not.found=source file not found
err.bad.innerclasses.attribute=bad InnerClasses attribute for {0}
-warn.Xold.not.supported=-Xold is no longer available
main.usage.summary=\
Usage: {0} <options> <classes>\n\
diff --git a/langtools/test/tools/javap/InvalidOptions.java b/langtools/test/tools/javap/InvalidOptions.java
index d92f644..95d299d 100644
--- a/langtools/test/tools/javap/InvalidOptions.java
+++ b/langtools/test/tools/javap/InvalidOptions.java
@@ -24,7 +24,7 @@
/*
* @test
* @bug 8027411
- * @summary test invalid options -h and -b
+ * @summary test an invalid option
*/
import java.io.*;
@@ -39,7 +39,6 @@
}
void run() throws Exception {
- test(2, "-h", "Error: -h is no longer available - use the javah program");
test(2, "-b", "Error: unknown option: -b",
"Usage: javap <options> <classes>",
"use -help for a list of possible options");
diff --git a/langtools/test/tools/javap/MethodParameters.java b/langtools/test/tools/javap/MethodParameters.java
index 940724b..d9c4278 100644
--- a/langtools/test/tools/javap/MethodParameters.java
+++ b/langtools/test/tools/javap/MethodParameters.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -44,24 +44,24 @@
static final String Init0_expected =
(" Foo();\n" +
" descriptor: ()V\n" +
- " flags: \n" +
+ " flags:\n" +
" Code:\n" +
" stack=1, locals=1, args_size=1\n" +
- " 0: aload_0 \n" +
+ " 0: aload_0\n" +
" 1: invokespecial #1 // Method java/lang/Object.\"<init>\":()V\n" +
- " 4: return \n" +
+ " 4: return\n" +
" LineNumberTable:\n" +
" line 2: 0").replaceAll(" +", " ");
static final String Init1_expected =
(" Foo(int);\n" +
" descriptor: (I)V\n" +
- " flags: \n" +
+ " flags:\n" +
" Code:\n" +
" stack=1, locals=2, args_size=2\n" +
- " 0: aload_0 \n" +
+ " 0: aload_0\n" +
" 1: invokespecial #1 // Method java/lang/Object.\"<init>\":()V\n" +
- " 4: return \n" +
+ " 4: return\n" +
" LineNumberTable:\n" +
" line 3: 0\n" +
" MethodParameters:\n" +
@@ -71,25 +71,25 @@
static final String foo0_expected =
(" void foo0();\n" +
" descriptor: ()V\n" +
- " flags: \n" +
+ " flags:\n" +
" Code:\n" +
" stack=0, locals=1, args_size=1\n" +
- " 0: return \n" +
+ " 0: return\n" +
" LineNumberTable:\n" +
" line 4: 0").replaceAll(" +", " ");
static final String foo2_expected =
(" void foo2(int, int);\n" +
" descriptor: (II)V\n" +
- " flags: \n" +
+ " flags:\n" +
" Code:\n" +
" stack=0, locals=3, args_size=3\n" +
- " 0: return \n" +
+ " 0: return\n" +
" LineNumberTable:\n" +
" line 5: 0\n" +
" MethodParameters:\n" +
" Name Flags\n" +
- " j \n" +
+ " j\n" +
" k").replaceAll(" +", " ");
static final File classesdir = new File("methodparameters");
diff --git a/langtools/test/tools/javap/T6868539.java b/langtools/test/tools/javap/T6868539.java
index 3971ea0..7040d53 100644
--- a/langtools/test/tools/javap/T6868539.java
+++ b/langtools/test/tools/javap/T6868539.java
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 6868539 6868548
+ * @bug 6868539 6868548 8035364
* @summary javap should use current names for constant pool entries,
* remove spurious ';' from constant pool entries
*/
@@ -41,17 +41,17 @@
void run() {
String output = javap("T6868539");
verify(output, "Utf8 +java/lang/String"); // 1: Utf8
- // 2: currently unused
+ // 2: currently unused
verify(output, "Integer +123456"); // 3: Integer
verify(output, "Float +123456.0f"); // 4: Float
verify(output, "Long +123456l"); // 5: Long
verify(output, "Double +123456.0d"); // 6: Double
- verify(output, "Class +#[0-9]+ +// + T6868539"); // 7: Class
- verify(output, "String +#[0-9]+ +// + not found"); // 8: String
+ verify(output, "Class +#[0-9]+ +// +T6868539"); // 7: Class
+ verify(output, "String +#[0-9]+ +// +not found"); // 8: String
verify(output, "Fieldref +#[0-9]+\\.#[0-9]+ +// +T6868539.errors:I"); // 9: Fieldref
verify(output, "Methodref +#[0-9]+\\.#[0-9]+ +// +T6868539.run:\\(\\)V"); // 10: Methodref
verify(output, "InterfaceMethodref +#[0-9]+\\.#[0-9]+ +// +java/lang/Runnable\\.run:\\(\\)V");
- // 11: InterfaceMethodref
+ // 11: InterfaceMethodref
verify(output, "NameAndType +#[0-9]+:#[0-9]+ +// +run:\\(\\)V"); // 12: NameAndType
if (errors > 0)
throw new Error(errors + " found.");
diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index d23396e5..8bf7895 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -243,3 +243,4 @@
9cc3fd32fbabdd8b06771d11a319c9802e118612 jdk8-b129
43a1183d2ab0ee3dbffd8bc47606e88dbe0c6116 jdk8u20-b02
9d69311869d513deecfebe767cc5f01502c9c01e jdk8u20-b03
+e70dd55986e085185d976f2a78843a7d7eb87afd jdk8u20-b04