--- a/jdk/make/lib/Awt2dLibraries.gmk Fri May 23 09:05:24 2014 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk Fri May 23 11:13:54 2014 -0700
@@ -709,21 +709,24 @@
##########################################################################################
+BUILD_LIBJAVAJPEG_DIR := $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
+
ifdef OPENJDK
- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
+ BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers
else
- BUILD_LIBJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
- BUILD_LIBJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
- BUILD_LIBJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJPEG_CLOSED_SRC)
+ BUILD_LIBJAVAJPEG_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjpeg/mapfile-vers-closed
+ BUILD_LIBJAVAJPEG_CLOSED_SRC := $(JDK_TOPDIR)/src/closed/share/native/sun/awt/image/jpeg
+ BUILD_LIBJAVAJPEG_CLOSED_INCLUDES := -I$(BUILD_LIBJAVAJPEG_CLOSED_SRC)
endif
-BUILD_LIBJPEG_REORDER :=
+BUILD_LIBJAVAJPEG_REORDER :=
ifeq ($(OPENJDK_TARGET_OS), solaris)
ifneq ($(OPENJDK_TARGET_CPU), x86_64)
- BUILD_LIBJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
+ BUILD_LIBJAVAJPEG_REORDER := $(JDK_TOPDIR)/make/mapfiles/libjpeg/reorder-$(OPENJDK_TARGET_CPU)
endif
endif
+
# Suppress gcc warnings like "variable might be clobbered by 'longjmp'
# or 'vfork'": this warning indicates that some variable is placed to
# a register by optimized compiler and it's value might be lost on longjmp().
@@ -735,37 +738,50 @@
# $(shell $(EXPR) $(CC_MAJORVER) \> 4 \| \
# \( $(CC_MAJORVER) = 4 \& $(CC_MINORVER) \>= 3 \) )
# ifeq ($(CC_43_OR_NEWER), 1)
-# BUILD_LIBJPEG_CFLAGS_linux += -Wno-clobbered
+# BUILD_LIBJAVAJPEG_CFLAGS_linux += -Wno-clobbered
# endif
#endif
-$(eval $(call SetupNativeCompilation,BUILD_LIBJPEG, \
- LIBRARY := jpeg, \
+ifeq ($(USE_EXTERNAL_LIBJPEG), true)
+ LIBJPEG_LIBS := -ljpeg
+ BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
+ imageIOJPEG.c \
+ jpegdecoder.c
+ BUILD_LIBJAVAJPEG_HEADERS :=
+else
+ LIBJPEG_LIBS :=
+ BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
+ BUILD_LIBJAVAJPEG_HEADERS := -I$(BUILD_LIBJAVAJPEG_DIR)
+endif
+
+$(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
+ LIBRARY := javajpeg, \
OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
- SRC := $(BUILD_LIBJPEG_CLOSED_SRC) \
- $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
+ SRC := $(BUILD_LIBJAVAJPEG_CLOSED_SRC) \
+ $(BUILD_LIBJAVAJPEG_DIR), \
+ INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
LANG := C, \
OPTIMIZATION := HIGHEST, \
CFLAGS := $(CFLAGS_JDKLIB) \
- $(BUILD_LIBJPEG_CLOSED_INCLUDES) \
- -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg, \
- MAPFILE := $(BUILD_LIBJPEG_MAPFILE), \
- LDFLAGS := $(LDFLAGS_JDKLIB) \
+ $(BUILD_LIBJAVAJPEG_CLOSED_INCLUDES) \
+ $(BUILD_LIBJAVAJPEG_HEADERS), \
+ MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
+ LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_windows := $(WIN_JAVA_LIB) jvm.lib, \
LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \
- -D "JDK_FNAME=jpeg.dll" \
- -D "JDK_INTERNAL_NAME=jpeg" \
+ -D "JDK_FNAME=javajpeg.dll" \
+ -D "JDK_INTERNAL_NAME=javajpeg" \
-D "JDK_FTYPE=0x2L", \
- REORDER := $(BUILD_LIBJPEG_REORDER), \
+ REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjpeg, \
DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
-$(BUILD_LIBJPEG): $(BUILD_LIBJAVA)
+$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
-BUILD_LIBRARIES += $(BUILD_LIBJPEG)
+BUILD_LIBRARIES += $(BUILD_LIBJAVAJPEG)
##########################################################################################
@@ -1213,6 +1229,13 @@
GIFLIB_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/giflib
endif
+ ifeq ($(USE_EXTERNAL_LIBJPEG), true)
+ LIBJPEG_LDFLAGS := -ljpeg
+ else
+ LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
+ LIBJPEG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/image/jpeg
+ endif
+
ifeq ($(USE_EXTERNAL_LIBPNG), false)
LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/share/native/sun/awt/libpng
LIBPNG_CFLAGS := -I$(JDK_TOPDIR)/src/share/native/sun/awt/libpng
@@ -1276,12 +1299,12 @@
LANG := C, \
OPTIMIZATION := LOW, \
CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
- $(GIFLIB_CFLAGS) $(PNG_CFLAGS), \
+ $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsplashscreen/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
LDFLAGS_SUFFIX := $(LIBSPLASHSCREEN_LDFLAGS_SUFFIX) $(LIBZ) \
- $(GIFLIB_LDFLAGS) $(PNG_LIBS), \
+ $(GIFLIB_LDFLAGS) $(LIBJPEG_LDFLAGS) $(PNG_LIBS), \
LDFLAGS_SUFFIX_solaris := -lc, \
VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/windows/resource/version.rc, \
RC_FLAGS := $(RC_FLAGS) \
--- a/jdk/make/src/classes/build/tools/generatenimbus/PainterGenerator.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/make/src/classes/build/tools/generatenimbus/PainterGenerator.java Fri May 23 11:13:54 2014 -0700
@@ -57,6 +57,9 @@
* @author Jasper Potts
*/
public class PainterGenerator {
+
+ private static final boolean debug = false;
+
//a handful of counters, incremented whenever the associated object type is encounted.
//These counters form the basis of the field and method suffixes.
//These are all 1 based, because I felt like it :-)
@@ -384,16 +387,24 @@
}
if (Float.isNaN(r)) {
- System.err.println("[Error] Encountered NaN: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ if (debug) {
+ System.err.println("[Error] Encountered NaN: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ }
return 0;
} else if (Float.isInfinite(r)) {
- System.err.println("[Error] Encountered Infinity: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ if (debug) {
+ System.err.println("[Error] Encountered Infinity: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ }
return 0;
} else if (r < 0) {
- System.err.println("[Error] encoded value was less than 0: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ if (debug) {
+ System.err.println("[Error] encoded value was less than 0: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ }
return 0;
} else if (r > 3) {
- System.err.println("[Error] encoded value was greater than 3: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ if (debug) {
+ System.err.println("[Error] encoded value was greater than 3: encode(" + x + ", " + a + ", " + b + ", " + w + ")");
+ }
return 3;
} else {
return r;
--- a/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/macosx/classes/com/apple/laf/AquaComboBoxUI.java Fri May 23 11:13:54 2014 -0700
@@ -522,15 +522,17 @@
};
@SuppressWarnings("serial") // anonymous class
- private static Action hideAction = new AbstractAction() {
+ private final Action hideAction = new AbstractAction() {
@Override
public void actionPerformed(final ActionEvent e) {
final JComboBox comboBox = (JComboBox)e.getSource();
+ comboBox.firePopupMenuCanceled();
+ comboBox.setPopupVisible(false);
+ }
- if (comboBox.isPopupVisible()) {
- comboBox.firePopupMenuCanceled();
- comboBox.setPopupVisible(false);
- }
+ @Override
+ public boolean isEnabled() {
+ return comboBox.isPopupVisible() && super.isEnabled();
}
};
--- a/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/macosx/native/sun/osxapp/ThreadUtilities.m Fri May 23 11:13:54 2014 -0700
@@ -36,7 +36,7 @@
static jobject appkitThreadGroup = NULL;
static BOOL awtEmbedded = NO;
-inline void attachCurrentThread(void** env) {
+static inline void attachCurrentThread(void** env) {
if ([NSThread isMainThread]) {
JavaVMAttachArgs args;
args.version = JNI_VERSION_1_4;
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageReader.java Fri May 23 11:13:54 2014 -0700
@@ -89,7 +89,7 @@
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
- System.loadLibrary("jpeg");
+ System.loadLibrary("javajpeg");
return null;
}
});
--- a/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java Fri May 23 11:13:54 2014 -0700
@@ -179,7 +179,7 @@
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
- System.loadLibrary("jpeg");
+ System.loadLibrary("javajpeg");
return null;
}
});
--- a/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/com/sun/java/swing/SwingUtilities3.java Fri May 23 11:13:54 2014 -0700
@@ -27,6 +27,8 @@
import sun.awt.EventQueueDelegate;
import sun.awt.AppContext;
+import sun.awt.SunToolkit;
+
import java.util.Collections;
import java.util.Map;
import java.util.WeakHashMap;
@@ -117,8 +119,8 @@
public static RepaintManager getDelegateRepaintManager(Component
component) {
RepaintManager delegate = null;
- if (Boolean.TRUE == AppContext.getAppContext().get(
- DELEGATE_REPAINT_MANAGER_KEY)) {
+ if (Boolean.TRUE == SunToolkit.targetToAppContext(component)
+ .get(DELEGATE_REPAINT_MANAGER_KEY)) {
while (delegate == null && component != null) {
while (component != null
&& ! (component instanceof JComponent)) {
--- a/jdk/src/share/classes/java/awt/Component.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/java/awt/Component.java Fri May 23 11:13:54 2014 -0700
@@ -3411,7 +3411,7 @@
(width > 0) && (height > 0)) {
PaintEvent e = new PaintEvent(this, PaintEvent.UPDATE,
new Rectangle(x, y, width, height));
- Toolkit.getEventQueue().postEvent(e);
+ SunToolkit.postEvent(SunToolkit.targetToAppContext(this), e);
}
}
}
--- a/jdk/src/share/classes/javax/print/AttributeException.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/AttributeException.java Fri May 23 11:13:54 2014 -0700
@@ -52,7 +52,7 @@
*
* @return unsupported attribute classes
*/
- public Class[] getUnsupportedAttributes();
+ public Class<?>[] getUnsupportedAttributes();
/**
* Returns the array of printing attributes for which the Print Service
--- a/jdk/src/share/classes/javax/print/DocFlavor.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/DocFlavor.java Fri May 23 11:13:54 2014 -0700
@@ -545,8 +545,7 @@
* @exception NullPointerException if paramName is null.
*/
public String getParameter(String paramName) {
- return
- (String)myMimeType.getParameterMap().get(paramName.toLowerCase());
+ return myMimeType.getParameterMap().get(paramName.toLowerCase());
}
/**
--- a/jdk/src/share/classes/javax/print/MimeType.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/MimeType.java Fri May 23 11:13:54 2014 -0700
@@ -117,18 +117,18 @@
/**
* Parameter map entry.
*/
- private class ParameterMapEntry implements Map.Entry {
+ private class ParameterMapEntry implements Map.Entry<String, String> {
private int myIndex;
public ParameterMapEntry(int theIndex) {
myIndex = theIndex;
}
- public Object getKey(){
+ public String getKey(){
return myPieces[myIndex];
}
- public Object getValue(){
+ public String getValue(){
return myPieces[myIndex+1];
}
- public Object setValue (Object value) {
+ public String setValue (String value) {
throw new UnsupportedOperationException();
}
public boolean equals(Object o) {
@@ -145,12 +145,12 @@
/**
* Parameter map entry set iterator.
*/
- private class ParameterMapEntrySetIterator implements Iterator {
+ private class ParameterMapEntrySetIterator implements Iterator<Map.Entry<String, String>> {
private int myIndex = 2;
public boolean hasNext() {
return myIndex < myPieces.length;
}
- public Object next() {
+ public Map.Entry<String, String> next() {
if (hasNext()) {
ParameterMapEntry result = new ParameterMapEntry (myIndex);
myIndex += 2;
@@ -167,8 +167,8 @@
/**
* Parameter map entry set.
*/
- private class ParameterMapEntrySet extends AbstractSet {
- public Iterator iterator() {
+ private class ParameterMapEntrySet extends AbstractSet<Map.Entry<String, String>> {
+ public Iterator<Map.Entry<String, String>> iterator() {
return new ParameterMapEntrySetIterator();
}
public int size() {
@@ -179,8 +179,8 @@
/**
* Parameter map.
*/
- private class ParameterMap extends AbstractMap {
- public Set entrySet() {
+ private class ParameterMap extends AbstractMap<String, String> {
+ public Set<Map.Entry<String, String>> entrySet() {
if (myEntrySet == null) {
myEntrySet = new ParameterMapEntrySet();
}
@@ -234,7 +234,7 @@
*
* @return Parameter map for this MIME type object.
*/
- public Map getParameterMap() {
+ public Map<String, String> getParameterMap() {
if (myParameterMap == null) {
myParameterMap = new ParameterMap();
}
@@ -548,7 +548,7 @@
}
LexicalAnalyzer theLexer = new LexicalAnalyzer (s);
int theLexemeType;
- Vector thePieces = new Vector();
+ Vector<String> thePieces = new Vector<>();
boolean mediaTypeIsText = false;
boolean parameterNameIsCharset = false;
@@ -623,7 +623,7 @@
// Save the pieces. Parameters are not in ascending order yet.
int n = thePieces.size();
- myPieces = (String[]) thePieces.toArray (new String [n]);
+ myPieces = thePieces.toArray (new String [n]);
// Sort the parameters into ascending order using an insertion sort.
int i, j;
--- a/jdk/src/share/classes/javax/print/PrintServiceLookup.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/PrintServiceLookup.java Fri May 23 11:13:54 2014 -0700
@@ -69,8 +69,8 @@
public abstract class PrintServiceLookup {
static class Services {
- private ArrayList listOfLookupServices = null;
- private ArrayList registeredServices = null;
+ private ArrayList<PrintServiceLookup> listOfLookupServices = null;
+ private ArrayList<PrintService> registeredServices = null;
}
private static Services getServicesForContext() {
@@ -83,23 +83,23 @@
return services;
}
- private static ArrayList getListOfLookupServices() {
+ private static ArrayList<PrintServiceLookup> getListOfLookupServices() {
return getServicesForContext().listOfLookupServices;
}
- private static ArrayList initListOfLookupServices() {
- ArrayList listOfLookupServices = new ArrayList();
+ private static ArrayList<PrintServiceLookup> initListOfLookupServices() {
+ ArrayList<PrintServiceLookup> listOfLookupServices = new ArrayList<>();
getServicesForContext().listOfLookupServices = listOfLookupServices;
return listOfLookupServices;
}
- private static ArrayList getRegisteredServices() {
+ private static ArrayList<PrintService> getRegisteredServices() {
return getServicesForContext().registeredServices;
}
- private static ArrayList initRegisteredServices() {
- ArrayList registeredServices = new ArrayList();
+ private static ArrayList<PrintService> initRegisteredServices() {
+ ArrayList<PrintService> registeredServices = new ArrayList<>();
getServicesForContext().registeredServices = registeredServices;
return registeredServices;
}
@@ -120,8 +120,8 @@
public static final PrintService[]
lookupPrintServices(DocFlavor flavor,
AttributeSet attributes) {
- ArrayList list = getServices(flavor, attributes);
- return (PrintService[])(list.toArray(new PrintService[list.size()]));
+ ArrayList<PrintService> list = getServices(flavor, attributes);
+ return list.toArray(new PrintService[list.size()]);
}
@@ -148,9 +148,8 @@
public static final MultiDocPrintService[]
lookupMultiDocPrintServices(DocFlavor[] flavors,
AttributeSet attributes) {
- ArrayList list = getMultiDocServices(flavors, attributes);
- return (MultiDocPrintService[])
- list.toArray(new MultiDocPrintService[list.size()]);
+ ArrayList<MultiDocPrintService> list = getMultiDocServices(flavors, attributes);
+ return list.toArray(new MultiDocPrintService[list.size()]);
}
@@ -177,10 +176,10 @@
public static final PrintService lookupDefaultPrintService() {
- Iterator psIterator = getAllLookupServices().iterator();
+ Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
while (psIterator.hasNext()) {
try {
- PrintServiceLookup lus = (PrintServiceLookup)psIterator.next();
+ PrintServiceLookup lus = psIterator.next();
PrintService service = lus.getDefaultPrintService();
if (service != null) {
return service;
@@ -208,7 +207,8 @@
*/
public static boolean registerServiceProvider(PrintServiceLookup sp) {
synchronized (PrintServiceLookup.class) {
- Iterator psIterator = getAllLookupServices().iterator();
+ Iterator<PrintServiceLookup> psIterator =
+ getAllLookupServices().iterator();
while (psIterator.hasNext()) {
try {
Object lus = psIterator.next();
@@ -249,7 +249,7 @@
if (service instanceof StreamPrintService) {
return false;
}
- ArrayList registeredServices = getRegisteredServices();
+ ArrayList<PrintService> registeredServices = getRegisteredServices();
if (registeredServices == null) {
registeredServices = initRegisteredServices();
}
@@ -326,9 +326,9 @@
*/
public abstract PrintService getDefaultPrintService();
- private static ArrayList getAllLookupServices() {
+ private static ArrayList<PrintServiceLookup> getAllLookupServices() {
synchronized (PrintServiceLookup.class) {
- ArrayList listOfLookupServices = getListOfLookupServices();
+ ArrayList<PrintServiceLookup> listOfLookupServices = getListOfLookupServices();
if (listOfLookupServices != null) {
return listOfLookupServices;
} else {
@@ -336,12 +336,12 @@
}
try {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
+ new java.security.PrivilegedExceptionAction<Object>() {
public Object run() {
Iterator<PrintServiceLookup> iterator =
ServiceLoader.load(PrintServiceLookup.class).
iterator();
- ArrayList los = getListOfLookupServices();
+ ArrayList<PrintServiceLookup> los = getListOfLookupServices();
while (iterator.hasNext()) {
try {
los.add(iterator.next());
@@ -364,14 +364,14 @@
}
}
- private static ArrayList getServices(DocFlavor flavor,
- AttributeSet attributes) {
+ private static ArrayList<PrintService> getServices(DocFlavor flavor,
+ AttributeSet attributes) {
- ArrayList listOfServices = new ArrayList();
- Iterator psIterator = getAllLookupServices().iterator();
+ ArrayList<PrintService> listOfServices = new ArrayList<>();
+ Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
while (psIterator.hasNext()) {
try {
- PrintServiceLookup lus = (PrintServiceLookup)psIterator.next();
+ PrintServiceLookup lus = psIterator.next();
PrintService[] services=null;
if (flavor == null && attributes == null) {
try {
@@ -391,7 +391,7 @@
}
}
/* add any directly registered services */
- ArrayList registeredServices = null;
+ ArrayList<PrintService> registeredServices = null;
try {
SecurityManager security = System.getSecurityManager();
if (security != null) {
@@ -401,8 +401,7 @@
} catch (SecurityException se) {
}
if (registeredServices != null) {
- PrintService[] services = (PrintService[])
- registeredServices.toArray(
+ PrintService[] services = registeredServices.toArray(
new PrintService[registeredServices.size()]);
for (int i=0; i<services.length; i++) {
if (!listOfServices.contains(services[i])) {
@@ -421,15 +420,15 @@
return listOfServices;
}
- private static ArrayList getMultiDocServices(DocFlavor[] flavors,
- AttributeSet attributes) {
+ private static ArrayList<MultiDocPrintService> getMultiDocServices(DocFlavor[] flavors,
+ AttributeSet attributes) {
- ArrayList listOfServices = new ArrayList();
- Iterator psIterator = getAllLookupServices().iterator();
+ ArrayList<MultiDocPrintService> listOfServices = new ArrayList<>();
+ Iterator<PrintServiceLookup> psIterator = getAllLookupServices().iterator();
while (psIterator.hasNext()) {
try {
- PrintServiceLookup lus = (PrintServiceLookup)psIterator.next();
+ PrintServiceLookup lus = psIterator.next();
MultiDocPrintService[] services =
lus.getMultiDocPrintServices(flavors, attributes);
if (services == null) {
@@ -442,7 +441,7 @@
}
}
/* add any directly registered services */
- ArrayList registeredServices = null;
+ ArrayList<PrintService> registeredServices = null;
try {
SecurityManager security = System.getSecurityManager();
if (security != null) {
@@ -452,14 +451,13 @@
} catch (Exception e) {
}
if (registeredServices != null) {
- PrintService[] services = (PrintService[])
- registeredServices.toArray(
- new PrintService[registeredServices.size()]);
+ PrintService[] services =
+ registeredServices.toArray(new PrintService[registeredServices.size()]);
for (int i=0; i<services.length; i++) {
if (services[i] instanceof MultiDocPrintService &&
!listOfServices.contains(services[i])) {
if (flavors == null || flavors.length == 0) {
- listOfServices.add(services[i]);
+ listOfServices.add((MultiDocPrintService)services[i]);
} else {
boolean supported = true;
for (int f=0; f<flavors.length; f++) {
@@ -476,7 +474,7 @@
}
}
if (supported) {
- listOfServices.add(services[i]);
+ listOfServices.add((MultiDocPrintService)services[i]);
}
}
}
--- a/jdk/src/share/classes/javax/print/ServiceUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/ServiceUI.java Fri May 23 11:13:54 2014 -0700
@@ -228,9 +228,9 @@
if (dialog.getStatus() == ServiceDialog.APPROVE) {
PrintRequestAttributeSet newas = dialog.getAttributes();
- Class dstCategory = Destination.class;
- Class amCategory = SunAlternateMedia.class;
- Class fdCategory = Fidelity.class;
+ Class<?> dstCategory = Destination.class;
+ Class<?> amCategory = SunAlternateMedia.class;
+ Class<?> fdCategory = Fidelity.class;
if (attributes.containsKey(dstCategory) &&
!newas.containsKey(dstCategory))
@@ -315,7 +315,7 @@
Attribute[] usAttrs = asUnsupported.toArray();
for (int i=0; i<usAttrs.length; i++) {
- Class category = usAttrs[i].getCategory();
+ Class<? extends Attribute> category = usAttrs[i].getCategory();
if (ps.isAttributeCategorySupported(category)) {
Attribute attr =
--- a/jdk/src/share/classes/javax/print/SimpleDoc.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/SimpleDoc.java Fri May 23 11:13:54 2014 -0700
@@ -89,7 +89,7 @@
throw new IllegalArgumentException("null argument(s)");
}
- Class repClass = null;
+ Class<?> repClass = null;
try {
String className = flavor.getRepresentationClassName();
sun.reflect.misc.ReflectUtil.checkPackageAccess(className);
--- a/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/StreamPrintServiceFactory.java Fri May 23 11:13:54 2014 -0700
@@ -59,7 +59,7 @@
public abstract class StreamPrintServiceFactory {
static class Services {
- private ArrayList listOfFactories = null;
+ private ArrayList<StreamPrintServiceFactory> listOfFactories = null;
}
private static Services getServices() {
@@ -72,12 +72,12 @@
return services;
}
- private static ArrayList getListOfFactories() {
+ private static ArrayList<StreamPrintServiceFactory> getListOfFactories() {
return getServices().listOfFactories;
}
- private static ArrayList initListOfFactories() {
- ArrayList listOfFactories = new ArrayList();
+ private static ArrayList<StreamPrintServiceFactory> initListOfFactories() {
+ ArrayList<StreamPrintServiceFactory> listOfFactories = new ArrayList<>();
getServices().listOfFactories = listOfFactories;
return listOfFactories;
}
@@ -108,9 +108,8 @@
lookupStreamPrintServiceFactories(DocFlavor flavor,
String outputMimeType) {
- ArrayList list = getFactories(flavor, outputMimeType);
- return (StreamPrintServiceFactory[])
- (list.toArray(new StreamPrintServiceFactory[list.size()]));
+ ArrayList<StreamPrintServiceFactory> list = getFactories(flavor, outputMimeType);
+ return list.toArray(new StreamPrintServiceFactory[list.size()]);
}
/** Queries the factory for the document format that is emitted
@@ -162,10 +161,10 @@
public abstract StreamPrintService getPrintService(OutputStream out);
- private static ArrayList getAllFactories() {
+ private static ArrayList<StreamPrintServiceFactory> getAllFactories() {
synchronized (StreamPrintServiceFactory.class) {
- ArrayList listOfFactories = getListOfFactories();
+ ArrayList<StreamPrintServiceFactory> listOfFactories = getListOfFactories();
if (listOfFactories != null) {
return listOfFactories;
} else {
@@ -174,12 +173,12 @@
try {
java.security.AccessController.doPrivileged(
- new java.security.PrivilegedExceptionAction() {
+ new java.security.PrivilegedExceptionAction<Object>() {
public Object run() {
Iterator<StreamPrintServiceFactory> iterator =
ServiceLoader.load
(StreamPrintServiceFactory.class).iterator();
- ArrayList lof = getListOfFactories();
+ ArrayList<StreamPrintServiceFactory> lof = getListOfFactories();
while (iterator.hasNext()) {
try {
lof.add(iterator.next());
@@ -210,17 +209,16 @@
return false;
}
- private static ArrayList getFactories(DocFlavor flavor, String outType) {
+ private static ArrayList<StreamPrintServiceFactory> getFactories(DocFlavor flavor, String outType) {
if (flavor == null && outType == null) {
return getAllFactories();
}
- ArrayList list = new ArrayList();
- Iterator iterator = getAllFactories().iterator();
+ ArrayList<StreamPrintServiceFactory> list = new ArrayList<>();
+ Iterator<StreamPrintServiceFactory> iterator = getAllFactories().iterator();
while (iterator.hasNext()) {
- StreamPrintServiceFactory factory =
- (StreamPrintServiceFactory)iterator.next();
+ StreamPrintServiceFactory factory = iterator.next();
if ((outType == null ||
outType.equalsIgnoreCase(factory.getOutputFormat())) &&
(flavor == null ||
--- a/jdk/src/share/classes/javax/print/attribute/AttributeSetUtilities.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/AttributeSetUtilities.java Fri May 23 11:13:54 2014 -0700
@@ -523,7 +523,7 @@
public static Class<?>
verifyAttributeCategory(Object object, Class<?> interfaceName) {
- Class result = (Class) object;
+ Class<?> result = (Class<?>) object;
if (interfaceName.isAssignableFrom (result)) {
return result;
}
--- a/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/HashAttributeSet.java Fri May 23 11:13:54 2014 -0700
@@ -48,13 +48,13 @@
* or a subinterface thereof.
* @serial
*/
- private Class myInterface;
+ private Class<?> myInterface;
/*
* A HashMap used by the implementation.
* The serialised form doesn't include this instance variable.
*/
- private transient HashMap attrMap = new HashMap();
+ private transient HashMap<Class<?>, Attribute> attrMap = new HashMap<>();
/**
* Write the instance to a stream (ie serialize the object)
@@ -82,7 +82,7 @@
throws ClassNotFoundException, IOException {
s.defaultReadObject();
- attrMap = new HashMap();
+ attrMap = new HashMap<>();
int count = s.readInt();
Attribute attr;
for (int i = 0; i < count; i++) {
@@ -274,10 +274,9 @@
* Attribute Attribute}.
*/
public Attribute get(Class<?> category) {
- return (Attribute)
- attrMap.get(AttributeSetUtilities.
- verifyAttributeCategory(category,
- Attribute.class));
+ return attrMap.get(AttributeSetUtilities.
+ verifyAttributeCategory(category,
+ Attribute.class));
}
/**
--- a/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/SetOfIntegerSyntax.java Fri May 23 11:13:54 2014 -0700
@@ -112,7 +112,7 @@
private static int[][] parse(String members) {
// Create vector to hold int[] elements, each element being one range
// parsed out of members.
- Vector theRanges = new Vector();
+ Vector<int[]> theRanges = new Vector<>();
// Run state machine over members.
int n = (members == null ? 0 : members.length());
@@ -243,7 +243,7 @@
* Accumulate the given range (lb .. ub) into the canonical array form
* into the given vector of int[] objects.
*/
- private static void accumulate(Vector ranges, int lb,int ub) {
+ private static void accumulate(Vector<int[]> ranges, int lb,int ub) {
// Make sure range is non-null.
if (lb <= ub) {
// Stick range at the back of the vector.
@@ -253,10 +253,10 @@
// with the existing ranges.
for (int j = ranges.size()-2; j >= 0; -- j) {
// Get lower and upper bounds of the two ranges being compared.
- int[] rangea = (int[]) ranges.elementAt (j);
+ int[] rangea = ranges.elementAt (j);
int lba = rangea[0];
int uba = rangea[1];
- int[] rangeb = (int[]) ranges.elementAt (j+1);
+ int[] rangeb = ranges.elementAt (j+1);
int lbb = rangeb[0];
int ubb = rangeb[1];
@@ -293,8 +293,8 @@
/**
* Convert the given vector of int[] objects to canonical array form.
*/
- private static int[][] canonicalArrayForm(Vector ranges) {
- return (int[][]) ranges.toArray (new int[ranges.size()][]);
+ private static int[][] canonicalArrayForm(Vector<int[]> ranges) {
+ return ranges.toArray (new int[ranges.size()][]);
}
/**
@@ -323,7 +323,7 @@
private static int[][] parse(int[][] members) {
// Create vector to hold int[] elements, each element being one range
// parsed out of members.
- Vector ranges = new Vector();
+ Vector<int[]> ranges = new Vector<>();
// Process all integer groups in members.
int n = (members == null ? 0 : members.length);
--- a/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/DialogTypeSelection.java Fri May 23 11:13:54 2014 -0700
@@ -26,6 +26,7 @@
package javax.print.attribute.standard;
import javax.print.attribute.EnumSyntax;
+import javax.print.attribute.Attribute;
import javax.print.attribute.PrintRequestAttribute;
/**
@@ -110,7 +111,7 @@
* @return Printing attribute class (category), an instance of class
* {@link java.lang.Class java.lang.Class}.
*/
- public final Class getCategory() {
+ public final Class<? extends Attribute> getCategory() {
return DialogTypeSelection.class;
}
--- a/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/MediaSize.java Fri May 23 11:13:54 2014 -0700
@@ -56,9 +56,9 @@
private MediaSizeName mediaName;
- private static HashMap mediaMap = new HashMap(100, 10);
+ private static HashMap<MediaSizeName, MediaSize> mediaMap = new HashMap<>(100, 10);
- private static Vector sizeVector = new Vector(100, 10);
+ private static Vector<MediaSize> sizeVector = new Vector<>(100, 10);
/**
* Construct a new media size attribute from the given floating-point
@@ -174,7 +174,7 @@
* with any size.
*/
public static MediaSize getMediaSizeForName(MediaSizeName media) {
- return (MediaSize)mediaMap.get(media);
+ return mediaMap.get(media);
}
/**
@@ -213,7 +213,7 @@
float diffy = y;
for (int i=0; i < sizeVector.size() ; i++) {
- MediaSize mediaSize = (MediaSize)sizeVector.elementAt(i);
+ MediaSize mediaSize = sizeVector.elementAt(i);
dim = mediaSize.getSize(units);
if (x == dim[0] && y == dim[1]) {
match = mediaSize;
--- a/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/print/attribute/standard/PrinterStateReasons.java Fri May 23 11:13:54 2014 -0700
@@ -242,16 +242,18 @@
extends AbstractSet<PrinterStateReason>
{
private Severity mySeverity;
- private Set myEntrySet;
+
+ private Set<Map.Entry<PrinterStateReason, Severity>> myEntrySet;
- public PrinterStateReasonSet(Severity severity, Set entrySet) {
+ public PrinterStateReasonSet(Severity severity,
+ Set<Map.Entry<PrinterStateReason, Severity>> entrySet) {
mySeverity = severity;
myEntrySet = entrySet;
}
public int size() {
int result = 0;
- Iterator iter = iterator();
+ Iterator<PrinterStateReason> iter = iterator();
while (iter.hasNext()) {
iter.next();
++ result;
@@ -259,19 +261,19 @@
return result;
}
- public Iterator iterator() {
+ public Iterator<PrinterStateReason> iterator() {
return new PrinterStateReasonSetIterator(mySeverity,
myEntrySet.iterator());
}
}
- private class PrinterStateReasonSetIterator implements Iterator {
+ private class PrinterStateReasonSetIterator implements Iterator<PrinterStateReason> {
private Severity mySeverity;
- private Iterator myIterator;
- private Map.Entry myEntry;
+ private Iterator<Map.Entry<PrinterStateReason, Severity>> myIterator;
+ private Map.Entry<PrinterStateReason, Severity> myEntry;
public PrinterStateReasonSetIterator(Severity severity,
- Iterator iterator) {
+ Iterator<Map.Entry<PrinterStateReason, Severity>> iterator) {
mySeverity = severity;
myIterator = iterator;
goToNext();
@@ -280,8 +282,8 @@
private void goToNext() {
myEntry = null;
while (myEntry == null && myIterator.hasNext()) {
- myEntry = (Map.Entry) myIterator.next();
- if ((Severity) myEntry.getValue() != mySeverity) {
+ myEntry = myIterator.next();
+ if (myEntry.getValue() != mySeverity) {
myEntry = null;
}
}
@@ -291,11 +293,11 @@
return myEntry != null;
}
- public Object next() {
+ public PrinterStateReason next() {
if (myEntry == null) {
throw new NoSuchElementException();
}
- Object result = myEntry.getKey();
+ PrinterStateReason result = myEntry.getKey();
goToNext();
return result;
}
--- a/jdk/src/share/classes/javax/swing/JComponent.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/JComponent.java Fri May 23 11:13:54 2014 -0700
@@ -63,6 +63,7 @@
import static javax.swing.ClientPropertyKey.*;
import javax.accessibility.*;
+import sun.awt.SunToolkit;
import sun.swing.SwingUtilities2;
import sun.swing.UIClientPropertyKey;
@@ -4802,7 +4803,8 @@
* @see RepaintManager#addDirtyRegion
*/
public void repaint(long tm, int x, int y, int width, int height) {
- RepaintManager.currentManager(this).addDirtyRegion(this, x, y, width, height);
+ RepaintManager.currentManager(SunToolkit.targetToAppContext(this))
+ .addDirtyRegion(this, x, y, width, height);
}
@@ -4856,7 +4858,7 @@
// which was causing some people grief.
return;
}
- if (SwingUtilities.isEventDispatchThread()) {
+ if (SunToolkit.isDispatchThreadForAppContext(this)) {
invalidate();
RepaintManager.currentManager(this).addInvalidComponent(this);
}
@@ -4870,15 +4872,12 @@
}
setFlag(REVALIDATE_RUNNABLE_SCHEDULED, true);
}
- Runnable callRevalidate = new Runnable() {
- public void run() {
- synchronized(JComponent.this) {
- setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
- }
- revalidate();
+ SunToolkit.executeOnEventHandlerThread(this, () -> {
+ synchronized(JComponent.this) {
+ setFlag(REVALIDATE_RUNNABLE_SCHEDULED, false);
}
- };
- SwingUtilities.invokeLater(callRevalidate);
+ revalidate();
+ });
}
}
--- a/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java Fri May 23 11:13:54 2014 -0700
@@ -380,15 +380,11 @@
InternalFrameEvent e = new InternalFrameEvent(
frame, InternalFrameEvent.INTERNAL_FRAME_CLOSING);
// Try posting event, unless there's a SecurityManager.
- if (JInternalFrame.class.getClassLoader() == null) {
- try {
- Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
- return;
- } catch (SecurityException se) {
- // Use dispatchEvent instead.
- }
+ try {
+ Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(e);
+ } catch (SecurityException se) {
+ frame.dispatchEvent(e);
}
- frame.dispatchEvent(e);
}
--- a/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/metal/MetalIconFactory.java Fri May 23 11:13:54 2014 -0700
@@ -1251,8 +1251,10 @@
g.translate(x, y);
// fill interior
- g.setColor(interiorColor);
- g.fillRect(2,2, 9,9);
+ if (c.isOpaque()) {
+ g.setColor(interiorColor);
+ g.fillRect(2, 2, 9, 9);
+ }
// draw Dark Circle (start at top, go clockwise)
g.setColor(darkCircle);
--- a/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/nimbus/AbstractRegionPainter.java Fri May 23 11:13:54 2014 -0700
@@ -31,6 +31,7 @@
import javax.swing.plaf.UIResource;
import javax.swing.Painter;
import java.awt.print.PrinterGraphics;
+import sun.reflect.misc.MethodUtil;
/**
* Convenient base class for defining Painter instances for rendering a
@@ -445,8 +446,8 @@
} else {
String s = "get" + Character.toUpperCase(property.charAt(0)) + property.substring(1);
try {
- Method method = c.getClass().getMethod(s);
- color = (Color) method.invoke(c);
+ Method method = MethodUtil.getMethod(c.getClass(), s, null);
+ color = (Color) MethodUtil.invoke(method, c, null);
} catch (Exception e) {
//don't do anything, it just didn't work, that's all.
//This could be a normal occurance if you use a property
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthButtonUI.java Fri May 23 11:13:54 2014 -0700
@@ -138,9 +138,7 @@
}
SynthContext getContext(JComponent c, int state) {
- Region region = SynthLookAndFeel.getRegion(c);
- return SynthContext.getContext(SynthContext.class, c, region,
- style, state);
+ return SynthContext.getContext(c, style, state);
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthColorChooserUI.java Fri May 23 11:13:54 2014 -0700
@@ -128,8 +128,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthComboBoxUI.java Fri May 23 11:13:54 2014 -0700
@@ -208,8 +208,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthContext.java Fri May 23 11:13:54 2014 -0700
@@ -24,8 +24,9 @@
*/
package javax.swing.plaf.synth;
-import javax.swing.*;
-import java.util.*;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import javax.swing.JComponent;
/**
* An immutable transient object containing contextual information about
@@ -39,59 +40,32 @@
* @author Scott Violet
*/
public class SynthContext {
- private static final Map<Class, List<SynthContext>> contextMap;
+ private static final Queue<SynthContext> queue = new ConcurrentLinkedQueue<>();
private JComponent component;
private Region region;
private SynthStyle style;
private int state;
-
- static {
- contextMap = new HashMap<Class, List<SynthContext>>();
+ static SynthContext getContext(JComponent c, SynthStyle style, int state) {
+ return getContext(c, SynthLookAndFeel.getRegion(c), style, state);
}
-
- static SynthContext getContext(Class type, JComponent component,
+ static SynthContext getContext(JComponent component,
Region region, SynthStyle style,
int state) {
- SynthContext context = null;
-
- synchronized(contextMap) {
- List<SynthContext> instances = contextMap.get(type);
-
- if (instances != null) {
- int size = instances.size();
-
- if (size > 0) {
- context = instances.remove(size - 1);
- }
- }
- }
+ SynthContext context = queue.poll();
if (context == null) {
- try {
- context = (SynthContext)type.newInstance();
- } catch (IllegalAccessException iae) {
- } catch (InstantiationException ie) {
- }
+ context = new SynthContext();
}
context.reset(component, region, style, state);
return context;
}
static void releaseContext(SynthContext context) {
- synchronized(contextMap) {
- List<SynthContext> instances = contextMap.get(context.getClass());
-
- if (instances == null) {
- instances = new ArrayList<SynthContext>(5);
- contextMap.put(context.getClass(), instances);
- }
- instances.add(context);
- }
+ queue.offer(context);
}
-
SynthContext() {
}
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopIconUI.java Fri May 23 11:13:54 2014 -0700
@@ -144,9 +144,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- Region region = SynthLookAndFeel.getRegion(c);
- return SynthContext.getContext(SynthContext.class, c, region,
- style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthDesktopPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -432,8 +432,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthEditorPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -139,8 +139,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameTitlePane.java Fri May 23 11:13:54 2014 -0700
@@ -68,8 +68,7 @@
}
public SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private Region getRegion(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthInternalFrameUI.java Fri May 23 11:13:54 2014 -0700
@@ -141,8 +141,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthLabelUI.java Fri May 23 11:13:54 2014 -0700
@@ -91,8 +91,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthListUI.java Fri May 23 11:13:54 2014 -0700
@@ -188,8 +188,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuBarUI.java Fri May 23 11:13:54 2014 -0700
@@ -116,8 +116,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuItemUI.java Fri May 23 11:13:54 2014 -0700
@@ -170,8 +170,7 @@
}
SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
SynthContext getContext(JComponent c, Region region) {
@@ -179,8 +178,7 @@
}
private SynthContext getContext(JComponent c, Region region, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- region, accStyle, state);
+ return SynthContext.getContext(c, region, accStyle, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthMenuUI.java Fri May 23 11:13:54 2014 -0700
@@ -170,9 +170,7 @@
}
SynthContext getContext(JComponent c, int state) {
- Region region = SynthLookAndFeel.getRegion(c);
- return SynthContext.getContext(SynthContext.class, c, region,
- style, state);
+ return SynthContext.getContext(c, style, state);
}
SynthContext getContext(JComponent c, Region region) {
@@ -180,8 +178,7 @@
}
private SynthContext getContext(JComponent c, Region region, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- region, accStyle, state);
+ return SynthContext.getContext(c, region, accStyle, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthOptionPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -140,8 +140,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPanelUI.java Fri May 23 11:13:54 2014 -0700
@@ -127,8 +127,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthParser.java Fri May 23 11:13:54 2014 -0700
@@ -67,6 +67,7 @@
import org.xml.sax.helpers.DefaultHandler;
import com.sun.beans.decoder.DocumentHandler;
+import sun.reflect.misc.ReflectUtil;
class SynthParser extends DefaultHandler {
//
@@ -648,7 +649,7 @@
}
else {
try {
- typeClass = Class.forName(typeName.substring(
+ typeClass = ReflectUtil.forName(typeName.substring(
0, classIndex));
} catch (ClassNotFoundException cnfe) {
throw new SAXException("Unknown class: " +
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthPopupMenuUI.java Fri May 23 11:13:54 2014 -0700
@@ -123,8 +123,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthProgressBarUI.java Fri May 23 11:13:54 2014 -0700
@@ -138,8 +138,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthRootPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -80,8 +80,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollBarUI.java Fri May 23 11:13:54 2014 -0700
@@ -185,8 +185,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private SynthContext getContext(JComponent c, Region region) {
@@ -199,8 +198,7 @@
if (region == Region.SCROLL_BAR_THUMB) {
style = thumbStyle;
}
- return SynthContext.getContext(SynthContext.class, c, region, style,
- state);
+ return SynthContext.getContext(c, region, style, state);
}
private int getComponentState(JComponent c, Region region) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthScrollPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -211,8 +211,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSeparatorUI.java Fri May 23 11:13:54 2014 -0700
@@ -248,8 +248,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
public void propertyChange(PropertyChangeEvent evt) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSliderUI.java Fri May 23 11:13:54 2014 -0700
@@ -722,8 +722,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private SynthContext getContext(JComponent c, Region subregion) {
@@ -732,14 +731,13 @@
private SynthContext getContext(JComponent c, Region subregion, int state) {
SynthStyle style = null;
- Class klass = SynthContext.class;
if (subregion == Region.SLIDER_TRACK) {
style = sliderTrackStyle;
} else if (subregion == Region.SLIDER_THUMB) {
style = sliderThumbStyle;
}
- return SynthContext.getContext(klass, c, subregion, style, state);
+ return SynthContext.getContext(c, subregion, style, state);
}
private int getComponentState(JComponent c, Region region) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSpinnerUI.java Fri May 23 11:13:54 2014 -0700
@@ -278,8 +278,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthSplitPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -209,8 +209,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
SynthContext getContext(JComponent c, Region region) {
@@ -219,11 +218,9 @@
private SynthContext getContext(JComponent c, Region region, int state) {
if (region == Region.SPLIT_PANE_DIVIDER) {
- return SynthContext.getContext(SynthContext.class, c, region,
- dividerStyle, state);
+ return SynthContext.getContext(c, region, dividerStyle, state);
}
- return SynthContext.getContext(SynthContext.class, c, region,
- style, state);
+ return SynthContext.getContext(c, region, style, state);
}
private int getComponentState(JComponent c, Region subregion) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTabbedPaneUI.java Fri May 23 11:13:54 2014 -0700
@@ -235,13 +235,11 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c),style, state);
+ return SynthContext.getContext(c, style, state);
}
private SynthContext getContext(JComponent c, Region subregion, int state){
SynthStyle style = null;
- Class klass = SynthContext.class;
if (subregion == Region.TABBED_PANE_TAB) {
style = tabStyle;
@@ -252,7 +250,7 @@
else if (subregion == Region.TABBED_PANE_CONTENT) {
style = tabContentStyle;
}
- return SynthContext.getContext(klass, c, subregion, style, state);
+ return SynthContext.getContext(c, subregion, style, state);
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableHeaderUI.java Fri May 23 11:13:54 2014 -0700
@@ -193,8 +193,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTableUI.java Fri May 23 11:13:54 2014 -0700
@@ -246,8 +246,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
//
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextAreaUI.java Fri May 23 11:13:54 2014 -0700
@@ -119,8 +119,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTextFieldUI.java Fri May 23 11:13:54 2014 -0700
@@ -157,8 +157,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
/**
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolBarUI.java Fri May 23 11:13:54 2014 -0700
@@ -178,19 +178,17 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private SynthContext getContext(JComponent c, Region region, SynthStyle style) {
- return SynthContext.getContext(SynthContext.class, c, region,
+ return SynthContext.getContext(c, region,
style, getComponentState(c, region));
}
private SynthContext getContext(JComponent c, Region region,
SynthStyle style, int state) {
- return SynthContext.getContext(SynthContext.class, c, region,
- style, state);
+ return SynthContext.getContext(c, region, style, state);
}
private int getComponentState(JComponent c, Region region) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java Fri May 23 11:13:54 2014 -0700
@@ -107,8 +107,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private int getComponentState(JComponent c) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthTreeUI.java Fri May 23 11:13:54 2014 -0700
@@ -173,8 +173,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- SynthLookAndFeel.getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private SynthContext getContext(JComponent c, Region region) {
@@ -182,8 +181,7 @@
}
private SynthContext getContext(JComponent c, Region region, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- region, cellStyle, state);
+ return SynthContext.getContext(c, region, cellStyle, state);
}
private int getComponentState(JComponent c, Region region) {
--- a/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/javax/swing/plaf/synth/SynthViewportUI.java Fri May 23 11:13:54 2014 -0700
@@ -141,8 +141,7 @@
}
private SynthContext getContext(JComponent c, int state) {
- return SynthContext.getContext(SynthContext.class, c,
- getRegion(c), style, state);
+ return SynthContext.getContext(c, style, state);
}
private Region getRegion(JComponent c) {
--- a/jdk/src/share/classes/sun/audio/AudioDevice.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioDevice.java Fri May 23 11:13:54 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -58,10 +58,7 @@
private boolean DEBUG = false /*true*/ ;
- /** Hashtable of audio clips / input streams. */
- private Hashtable clipStreams;
-
- private Vector infos;
+ private Vector<Info> infos;
/** Are we currently playing audio? */
private boolean playing = false;
@@ -81,9 +78,7 @@
* Create an AudioDevice instance.
*/
private AudioDevice() {
-
- clipStreams = new Hashtable();
- infos = new Vector();
+ infos = new Vector<>();
}
@@ -161,7 +156,7 @@
// is this already playing? if so, then just return
for(int i=0; i<infos.size(); i++) {
- info = (AudioDevice.Info)infos.elementAt(i);
+ info = infos.elementAt(i);
if( info.in == in ) {
return;
@@ -290,7 +285,7 @@
for(int i=0; i<infos.size(); i++) {
- info = (AudioDevice.Info)infos.elementAt(i);
+ info = infos.elementAt(i);
if( info.in == in ) {
@@ -355,7 +350,7 @@
for(int i=0; i<infos.size(); i++) {
- info = (AudioDevice.Info)infos.elementAt(i);
+ info = infos.elementAt(i);
if( info.sequencer != null ) {
@@ -375,8 +370,7 @@
System.err.println("Audio Device: Streams all closed.");
}
// Empty the hash table.
- clipStreams = new Hashtable();
- infos = new Vector();
+ infos = new Vector<>();
}
/**
--- a/jdk/src/share/classes/sun/audio/AudioPlayer.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioPlayer.java Fri May 23 11:13:54 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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
@@ -92,18 +92,16 @@
private static AudioPlayer getAudioPlayer() {
if(DEBUG) { System.out.println("> AudioPlayer.getAudioPlayer()"); }
- AudioPlayer audioPlayer;
- PrivilegedAction action = new PrivilegedAction() {
- public Object run() {
- Thread t = new AudioPlayer();
+ PrivilegedAction<AudioPlayer> action = new PrivilegedAction<AudioPlayer>() {
+ public AudioPlayer run() {
+ AudioPlayer t = new AudioPlayer();
t.setPriority(MAX_PRIORITY);
t.setDaemon(true);
t.start();
return t;
}
};
- audioPlayer = (AudioPlayer) AccessController.doPrivileged(action);
- return audioPlayer;
+ return AccessController.doPrivileged(action);
}
/**
--- a/jdk/src/share/classes/sun/audio/AudioStreamSequence.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/audio/AudioStreamSequence.java Fri May 23 11:13:54 2014 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 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,16 +44,11 @@
* @author Arthur van Hoff
*/
public final class AudioStreamSequence extends SequenceInputStream {
-
- Enumeration e;
- InputStream in;
-
/**
* Create an AudioStreamSequence given an
* enumeration of streams.
*/
- public AudioStreamSequence(Enumeration e) {
+ public AudioStreamSequence(Enumeration<? extends InputStream> e) {
super(e);
}
-
- }
+}
--- a/jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/ByteBandedRaster.java Fri May 23 11:13:54 2014 -0700
@@ -755,10 +755,22 @@
+ scanlineStride);
}
- for (int i = 0; i < data.length; i++) {
- if (scanlineStride > data[i].length) {
- throw new RasterFormatException("Incorrect scanline stride: "
- + scanlineStride);
+ if ((long)minX - sampleModelTranslateX < 0 ||
+ (long)minY - sampleModelTranslateY < 0) {
+
+ throw new RasterFormatException("Incorrect origin/translate: (" +
+ minX + ", " + minY + ") / (" +
+ sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+ }
+
+
+ if (height > 1 || minY - sampleModelTranslateY > 0) {
+ // buffer should contain at least one scanline
+ for (int i = 0; i < data.length; i++) {
+ if (scanlineStride > data[i].length) {
+ throw new RasterFormatException("Incorrect scanline stride: "
+ + scanlineStride);
+ }
}
}
--- a/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/ByteComponentRaster.java Fri May 23 11:13:54 2014 -0700
@@ -885,15 +885,31 @@
}
}
+ if ((long)minX - sampleModelTranslateX < 0 ||
+ (long)minY - sampleModelTranslateY < 0) {
+
+ throw new RasterFormatException("Incorrect origin/translate: (" +
+ minX + ", " + minY + ") / (" +
+ sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+ }
+
// we can be sure that width and height are greater than 0
if (scanlineStride < 0 ||
- scanlineStride > (Integer.MAX_VALUE / height) ||
- scanlineStride > data.length)
+ scanlineStride > (Integer.MAX_VALUE / height))
{
// integer overflow
throw new RasterFormatException("Incorrect scanline stride: "
+ scanlineStride);
}
+
+ if (height > 1 || minY - sampleModelTranslateY > 0) {
+ // buffer should contain at least one scanline
+ if (scanlineStride > data.length) {
+ throw new RasterFormatException("Incorrect scanline stride: "
+ + scanlineStride);
+ }
+ }
+
int lastScanOffset = (height - 1) * scanlineStride;
if (pixelStride < 0 ||
--- a/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/BytePackedRaster.java Fri May 23 11:13:54 2014 -0700
@@ -1386,13 +1386,28 @@
throw new RasterFormatException("Invalid raster dimension");
}
+ if ((long)minX - sampleModelTranslateX < 0 ||
+ (long)minY - sampleModelTranslateY < 0) {
+
+ throw new RasterFormatException("Incorrect origin/translate: (" +
+ minX + ", " + minY + ") / (" +
+ sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+ }
+
if (scanlineStride < 0 ||
- scanlineStride > (Integer.MAX_VALUE / height) ||
- scanlineStride > data.length)
+ scanlineStride > (Integer.MAX_VALUE / height))
{
throw new RasterFormatException("Invalid scanline stride");
}
+ if (height > 1 || minY - sampleModelTranslateY > 0) {
+ // buffer should contain at least one scanline
+ if (scanlineStride > data.length) {
+ throw new RasterFormatException("Incorrect scanline stride: "
+ + scanlineStride);
+ }
+ }
+
int lastbit = (dataBitOffset
+ (height-1) * scanlineStride * 8
+ (width-1) * pixelBitStride
--- a/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/IntegerComponentRaster.java Fri May 23 11:13:54 2014 -0700
@@ -654,15 +654,31 @@
") must be >= 0");
}
+ if ((long)minX - sampleModelTranslateX < 0 ||
+ (long)minY - sampleModelTranslateY < 0) {
+
+ throw new RasterFormatException("Incorrect origin/translate: (" +
+ minX + ", " + minY + ") / (" +
+ sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+ }
+
// we can be sure that width and height are greater than 0
if (scanlineStride < 0 ||
- scanlineStride > (Integer.MAX_VALUE / height) ||
- scanlineStride > data.length)
+ scanlineStride > (Integer.MAX_VALUE / height))
{
// integer overflow
throw new RasterFormatException("Incorrect scanline stride: "
+ scanlineStride);
}
+
+ if (height > 1 || minY - sampleModelTranslateY > 0) {
+ // buffer should contain at least one scanline
+ if (scanlineStride > data.length) {
+ throw new RasterFormatException("Incorrect scanline stride: "
+ + scanlineStride);
+ }
+ }
+
int lastScanOffset = (height - 1) * scanlineStride;
if (pixelStride < 0 ||
--- a/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/JPEGImageDecoder.java Fri May 23 11:13:54 2014 -0700
@@ -56,7 +56,7 @@
java.security.AccessController.doPrivileged(
new java.security.PrivilegedAction<Void>() {
public Void run() {
- System.loadLibrary("jpeg");
+ System.loadLibrary("javajpeg");
return null;
}
});
--- a/jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/ShortBandedRaster.java Fri May 23 11:13:54 2014 -0700
@@ -754,10 +754,21 @@
+ scanlineStride);
}
- for (int i = 0; i < data.length; i++) {
- if (scanlineStride > data[i].length) {
- throw new RasterFormatException("Incorrect scanline stride: "
- + scanlineStride);
+ if ((long)minX - sampleModelTranslateX < 0 ||
+ (long)minY - sampleModelTranslateY < 0) {
+
+ throw new RasterFormatException("Incorrect origin/translate: (" +
+ minX + ", " + minY + ") / (" +
+ sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+ }
+
+ if (height > 1 || minY - sampleModelTranslateY > 0) {
+ // buffer should contain at least one scanline
+ for (int i = 0; i < data.length; i++) {
+ if (scanlineStride > data[i].length) {
+ throw new RasterFormatException("Incorrect scanline stride: "
+ + scanlineStride);
+ }
}
}
--- a/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/classes/sun/awt/image/ShortComponentRaster.java Fri May 23 11:13:54 2014 -0700
@@ -819,15 +819,31 @@
}
}
+ if ((long)minX - sampleModelTranslateX < 0 ||
+ (long)minY - sampleModelTranslateY < 0) {
+
+ throw new RasterFormatException("Incorrect origin/translate: (" +
+ minX + ", " + minY + ") / (" +
+ sampleModelTranslateX + ", " + sampleModelTranslateY + ")");
+ }
+
// we can be sure that width and height are greater than 0
if (scanlineStride < 0 ||
- scanlineStride > (Integer.MAX_VALUE / height) ||
- scanlineStride > data.length)
+ scanlineStride > (Integer.MAX_VALUE / height))
{
// integer overflow
throw new RasterFormatException("Incorrect scanline stride: "
+ scanlineStride);
}
+
+ if (height > 1 || minY - sampleModelTranslateY > 0) {
+ // buffer should contain at least one scanline
+ if (scanlineStride > data.length) {
+ throw new RasterFormatException("Incorrect scanline stride: "
+ + scanlineStride);
+ }
+ }
+
int lastScanOffset = (height - 1) * scanlineStride;
if (pixelStride < 0 ||
--- a/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/imageioJPEG.c Fri May 23 11:13:54 2014 -0700
@@ -51,11 +51,17 @@
/* headers from the JPEG library */
#include <jpeglib.h>
-#include "jerror.h"
+#include <jerror.h>
#undef MAX
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
/* Cached Java method ids */
static jmethodID JPEGImageReader_readInputDataID;
static jmethodID JPEGImageReader_skipInputBytesID;
--- a/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/awt/image/jpeg/jpegdecoder.c Fri May 23 11:13:54 2014 -0700
@@ -47,6 +47,12 @@
#include <jpeglib.h>
#include "jerror.h"
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
/* The method IDs we cache. Note that the last two belongs to the
* java.io.InputStream class.
*/
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_jpeg.c Fri May 23 11:13:54 2014 -0700
@@ -30,6 +30,12 @@
#include <setjmp.h>
+#ifdef __APPLE__
+/* use setjmp/longjmp versions that do not save/restore the signal mask */
+#define setjmp _setjmp
+#define longjmp _longjmp
+#endif
+
/* stream input handling */
typedef struct
--- a/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/awt/splashscreen/splashscreen_png.c Fri May 23 11:13:54 2014 -0700
@@ -71,7 +71,12 @@
goto done;
}
+#ifdef __APPLE__
+ /* use setjmp/longjmp versions that do not save/restore the signal mask */
+ if (_setjmp(png_set_longjmp_fn(png_ptr, _longjmp, sizeof(jmp_buf)))) {
+#else
if (setjmp(png_jmpbuf(png_ptr))) {
+#endif
goto done;
}
--- a/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/font/layout/IndicLayoutEngine.cpp Fri May 23 11:13:54 2014 -0700
@@ -151,7 +151,7 @@
le_int32 outCharCount;
if (fVersion2) {
_LETRACE("v2process");
- outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage);
+ outCharCount = IndicReordering::v2process(&chars[offset], count, fScriptCode, outChars, glyphStorage, success);
} else {
_LETRACE("reorder");
outCharCount = IndicReordering::reorder(&chars[offset], count, fScriptCode, outChars, glyphStorage, &fMPreFixups, success);
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.cpp Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.cpp Fri May 23 11:13:54 2014 -0700
@@ -1096,9 +1096,13 @@
le_int32 IndicReordering::v2process(const LEUnicode *chars, le_int32 charCount, le_int32 scriptCode,
- LEUnicode *outChars, LEGlyphStorage &glyphStorage)
+ LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success)
{
const IndicClassTable *classTable = IndicClassTable::getScriptClassTable(scriptCode);
+ if (classTable == NULL) {
+ success = LE_MEMORY_ALLOCATION_ERROR;
+ return 0;
+ }
DynamicProperties dynProps[INDIC_BLOCK_SIZE];
IndicReordering::getDynamicProperties(dynProps,classTable);
--- a/jdk/src/share/native/sun/font/layout/IndicReordering.h Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/font/layout/IndicReordering.h Fri May 23 11:13:54 2014 -0700
@@ -181,7 +181,7 @@
static void adjustMPres(MPreFixups *mpreFixups, LEGlyphStorage &glyphStorage, LEErrorCode& success);
static le_int32 v2process(const LEUnicode *theChars, le_int32 charCount, le_int32 scriptCode,
- LEUnicode *outChars, LEGlyphStorage &glyphStorage);
+ LEUnicode *outChars, LEGlyphStorage &glyphStorage, LEErrorCode& success);
static const FeatureMap *getFeatureMap(le_int32 &count);
--- a/jdk/src/share/native/sun/font/layout/LEScripts.h Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/share/native/sun/font/layout/LEScripts.h Fri May 23 11:13:54 2014 -0700
@@ -263,12 +263,6 @@
tirhScriptCode = 158,
/**
- * @stable ICU 52
- */
- aghbScriptCode = 159,
- mahjScriptCode = 160,
-
-/**
* @stable ICU 2.2
*/
scriptCodeCount
--- a/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_PrintJob.cpp Fri May 23 11:13:54 2014 -0700
@@ -2541,8 +2541,21 @@
* rounded advances will drift away from the true advance.
*/
if (glyphPos != NULL && strLen > 0) {
- xadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, strLen, sizeof(int));
- xyadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, strLen, sizeof(int) * 2);
+ try {
+ xadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc,
+ strLen, sizeof(int));
+ xyadvances = (int*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, strLen,
+ sizeof(int) * 2);
+ } catch (std::bad_alloc&) {
+ if (xadvances != NULL) {
+ free(xadvances);
+ xadvances = NULL;
+ }
+ if (xyadvances != NULL) {
+ free(xyadvances);
+ xyadvances = NULL;
+ }
+ }
}
if (xadvances != NULL && xyadvances != NULL) {
int *inxAdvances = xadvances;
@@ -2752,8 +2765,12 @@
if ((imgWidthByteSz % sizeof(DWORD)) != 0)
padBytes = sizeof(DWORD) - (imgWidthByteSz % sizeof(DWORD));
- jbyte* alignedImage = (jbyte*) SAFE_SIZE_ARRAY_ALLOC(safe_Malloc,
+ jbyte* alignedImage = NULL;
+ try {
+ alignedImage = (jbyte*) SAFE_SIZE_ARRAY_ALLOC(safe_Malloc,
imgWidthByteSz+padBytes, ROUND_TO_LONG(srcHeight));
+ } catch (std::bad_alloc&) {
+ }
long newImgSize = (imgWidthByteSz+padBytes) * ROUND_TO_LONG(srcHeight);
if (alignedImage != NULL) {
@@ -3355,36 +3372,6 @@
// Set page size here.
}
-
-/**
- * Return an array of POINTS describing the paper sizes supported
- * by the driver identified by 'deviceName' and 'portName'.
- * If there is an error, then NULL is returned.
- */
-static POINT *getPaperSizeList(LPCTSTR deviceName, LPCTSTR portName) {
- DWORD numPaperSizes;
- POINT *paperSizes = NULL;
-
- SAVE_CONTROLWORD
- numPaperSizes = DeviceCapabilities(deviceName, portName,
- DC_PAPERSIZE, NULL, NULL);
-
- if (numPaperSizes > 0) {
- paperSizes = (POINT *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(*paperSizes), numPaperSizes);
-
- DWORD result = DeviceCapabilities(deviceName, portName,
- DC_PAPERSIZE, (LPTSTR) paperSizes,
- NULL);
- if (result == -1) {
- free((char *) paperSizes);
- paperSizes = NULL;
- }
- }
- RESTORE_CONTROLWORD
-
- return paperSizes;
-}
-
static WORD getOrientationFromDevMode2(HGLOBAL hDevMode) {
WORD orient = DMORIENT_PORTRAIT;
@@ -3989,20 +3976,33 @@
numPaperSizes = (int)DeviceCapabilities(printer, port, DC_PAPERSIZE,
NULL, NULL);
if (numPaperSizes > 0) {
- papers = (WORD*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(WORD), numPaperSizes);
- paperSizes = (POINT *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(*paperSizes), numPaperSizes);
-
- DWORD result1 = DeviceCapabilities(printer, port,
- DC_PAPERS, (LPTSTR) papers, NULL);
- DWORD result2 = DeviceCapabilities(printer, port,
- DC_PAPERSIZE, (LPTSTR) paperSizes,
- NULL);
-
- if (result1 == -1 || result2 == -1 ) {
- free((char *) papers);
- papers = NULL;
- free((char *) paperSizes);
- paperSizes = NULL;
+ try {
+ papers = (WORD*)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(WORD), numPaperSizes);
+ paperSizes = (POINT *)SAFE_SIZE_ARRAY_ALLOC(safe_Malloc, sizeof(*paperSizes), numPaperSizes);
+ } catch (std::bad_alloc&) {
+ if (papers != NULL) {
+ free((char*)papers);
+ papers = NULL;
+ }
+ if (paperSizes != NULL) {
+ free((char *)paperSizes);
+ paperSizes = NULL;
+ }
+ }
+
+ if (papers != NULL && paperSizes != NULL) {
+ DWORD result1 = DeviceCapabilities(printer, port,
+ DC_PAPERS, (LPTSTR) papers, NULL);
+ DWORD result2 = DeviceCapabilities(printer, port,
+ DC_PAPERSIZE, (LPTSTR) paperSizes,
+ NULL);
+
+ if (result1 == -1 || result2 == -1 ) {
+ free((char *) papers);
+ papers = NULL;
+ free((char *) paperSizes);
+ paperSizes = NULL;
+ }
}
}
--- a/jdk/src/windows/native/sun/windows/awt_TextField.cpp Fri May 23 09:05:24 2014 -0700
+++ b/jdk/src/windows/native/sun/windows/awt_TextField.cpp Fri May 23 11:13:54 2014 -0700
@@ -200,7 +200,10 @@
si.cbSize = sizeof(si);
si.fMask = SIF_PAGE | SIF_POS | SIF_RANGE;
+ SendMessage(EM_SHOWSCROLLBAR, SB_HORZ, TRUE);
VERIFY(::GetScrollInfo(GetHWnd(), SB_HORZ, &si));
+ SendMessage(EM_SHOWSCROLLBAR, SB_HORZ, FALSE);
+
if (bScrollLeft == TRUE) {
si.nPos = si.nPos - si.nPage / 2;
si.nPos = max(si.nMin, si.nPos);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/TextField/SelectionInvisibleTest/SelectionInvisibleTest.java Fri May 23 11:13:54 2014 -0700
@@ -0,0 +1,85 @@
+/*
+ * 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 java.awt.Frame;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.TextField;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8036110
+ * @author Alexander Scherbatiy
+ * @summary In TextField can only select text visible or to the left
+ * @run main SelectionInvisibleTest
+ */
+
+public class SelectionInvisibleTest {
+
+ private static final String TEXT = "One Two Three Four Five Six Seven Eight Nine ";
+ private static final String LAST_WORD = "Ten";
+
+ public static void main(String[] args) throws Exception {
+
+ Frame frame = new Frame();
+ frame.setSize(300, 200);
+ TextField textField = new TextField(TEXT + LAST_WORD, 30);
+ Panel panel = new Panel(new FlowLayout());
+ panel.add(textField);
+ frame.add(panel);
+ frame.setVisible(true);
+
+ SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+ toolkit.realSync();
+
+ Robot robot = new Robot();
+ robot.setAutoDelay(50);
+
+ Point point = textField.getLocationOnScreen();
+ int x = point.x + textField.getWidth() / 2;
+ int y = point.y + textField.getHeight() / 2;
+ robot.mouseMove(x, y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ int N = 10;
+ int dx = textField.getWidth() / N;
+ for (int i = 0; i < N; i++) {
+ x += dx;
+ robot.mouseMove(x, y);
+ }
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+ toolkit.realSync();
+
+ if (!textField.getSelectedText().endsWith(LAST_WORD)) {
+ throw new RuntimeException("Last word is not selected!");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComboBox/ConsumedEscTest/ConsumedEscTest.java Fri May 23 11:13:54 2014 -0700
@@ -0,0 +1,82 @@
+/*
+ * 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 javax.swing.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.KeyEvent;
+
+/*
+ @test
+ @bug 8031485
+ @summary Combo box consuming escape and enter key events
+ @author Petr Pchelko
+ @library ../../../../lib/testlibrary/
+ @build ExtendedRobot
+ @run main ConsumedEscTest
+*/
+public class ConsumedEscTest {
+ private static volatile JFrame frame;
+ private static volatile boolean passed = false;
+
+ public static void main(String... args) throws Exception {
+ try {
+ SwingUtilities.invokeAndWait(() -> {
+ frame = new JFrame();
+ JComboBox<String> combo = new JComboBox<>(new String[]{"one", "two", "three"});
+ JPanel panel = new JPanel();
+ panel.add(combo);
+ combo.requestFocusInWindow();
+ frame.setBounds(100, 150, 300, 100);
+ addAction(panel);
+ frame.add(panel);
+ frame.setVisible(true);
+ });
+
+ ExtendedRobot robot = new ExtendedRobot();
+ robot.waitForIdle();
+ robot.type(KeyEvent.VK_ESCAPE);
+ robot.waitForIdle();
+ if (!passed) {
+ throw new RuntimeException("FAILED: ESC was consumed by combo box");
+ }
+ } finally {
+ if (frame != null) {
+ frame.dispose();
+ }
+ }
+ }
+
+ private static void addAction(JComponent comp) {
+ KeyStroke k = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
+ Object actionKey = "cancel";
+ comp.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(k, actionKey);
+ Action cancelAction = new AbstractAction() {
+ @Override
+ public void actionPerformed(ActionEvent ev) {
+ passed = true;
+ }
+ };
+ comp.getActionMap().put(actionKey, cancelAction);
+ }
+
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JComponent/8043610/bug8043610.java Fri May 23 11:13:54 2014 -0700
@@ -0,0 +1,100 @@
+/*
+ * 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 8043610
+ @summary Tests that JComponent invalidate, revalidate and repaint methods could
+ be called from any thread
+ @author Petr Pchelko
+*/
+
+import sun.awt.SunToolkit;
+
+import javax.swing.*;
+import java.awt.*;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+public class bug8043610 {
+ private static volatile JFrame frame;
+ private static volatile JComponent component;
+
+ public static void main(String[] args) throws Exception {
+ ThreadGroup stubTG = new ThreadGroup(getRootThreadGroup(), "Stub Thread Group");
+ ThreadGroup swingTG = new ThreadGroup(getRootThreadGroup(), "SwingTG");
+ try {
+ Thread stubThread = new Thread(stubTG, SunToolkit::createNewAppContext);
+ stubThread.start();
+ stubThread.join();
+
+ CountDownLatch startSwingLatch = new CountDownLatch(1);
+ new Thread(swingTG, () -> {
+ SunToolkit.createNewAppContext();
+ SwingUtilities.invokeLater(() -> {
+ frame = new JFrame();
+ component = new JLabel("Test Text");
+ frame.add(component);
+ frame.setBounds(100, 100, 100, 100);
+ frame.setVisible(true);
+ startSwingLatch.countDown();
+ });
+ }).start();
+ startSwingLatch.await();
+
+ AtomicReference<Exception> caughtException = new AtomicReference<>();
+ Thread checkThread = new Thread(getRootThreadGroup(), () -> {
+ try {
+ component.invalidate();
+ component.revalidate();
+ component.repaint(new Rectangle(0, 0, 0, 0));
+ } catch (Exception e) {
+ caughtException.set(e);
+ }
+ });
+ checkThread.start();
+ checkThread.join();
+
+ if (caughtException.get() != null) {
+ throw new RuntimeException("Failed. Caught exception!", caughtException.get());
+ }
+ } finally {
+ new Thread(swingTG, () -> SwingUtilities.invokeLater(() -> {
+ if (frame != null) {
+ frame.dispose();
+ }
+ })).start();
+ }
+ }
+
+ private static ThreadGroup getRootThreadGroup() {
+ ThreadGroup currentTG = Thread.currentThread().getThreadGroup();
+ ThreadGroup parentTG = currentTG.getParent();
+ while (parentTG != null) {
+ currentTG = parentTG;
+ parentTG = currentTG.getParent();
+ }
+ return currentTG;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JRadioButton/8041561/bug8041561.java Fri May 23 11:13:54 2014 -0700
@@ -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.
+ */
+
+import java.awt.AWTException;
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.Robot;
+import java.awt.Toolkit;
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.plaf.metal.DefaultMetalTheme;
+import javax.swing.plaf.metal.MetalLookAndFeel;
+import sun.awt.SunToolkit;
+
+/**
+ * @test
+ * @bug 8041561
+ * @author Alexander Scherbatiy
+ * @summary Inconsistent opacity behaviour between JCheckBox and JRadioButton
+ * @run main bug8041561
+ */
+public class bug8041561 {
+
+ private static JRadioButton radioButton;
+
+ public static void main(String[] args) throws Exception {
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
+ UIManager.setLookAndFeel(new MetalLookAndFeel());
+ createAndShowGUI();
+ } catch (UnsupportedLookAndFeelException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+ Thread.sleep(500);
+
+ SwingUtilities.invokeAndWait(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ Point point = radioButton.getLocationOnScreen();
+ int x = (int) point.getX() + radioButton.getWidth() / 2;
+ int y = (int) point.getY() + radioButton.getHeight() / 2;
+
+ Robot robot = new Robot();
+ Color color = robot.getPixelColor(x, y);
+ if (!Color.BLUE.equals(color)) {
+ throw new RuntimeException("JRadioButton is opaque");
+ }
+ } catch (AWTException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ }
+
+ private static void createAndShowGUI() {
+ JFrame frame = new JFrame();
+ frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+ frame.setBackground(Color.BLUE);
+ radioButton = new JRadioButton();
+ radioButton.setOpaque(false);
+ JPanel panel = new JPanel();
+ panel.setBackground(Color.BLUE);
+ panel.add(radioButton);
+ frame.getContentPane().add(panel);
+ frame.pack();
+ frame.setVisible(true);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/Test8043627.java Fri May 23 11:13:54 2014 -0700
@@ -0,0 +1,39 @@
+/*
+ * 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 javax.swing.JButton;
+import javax.swing.plaf.synth.SynthButtonUI;
+
+/*
+ * @test
+ * @bug 8043627
+ * @summary Tests that SynthContext can be created with SecurityManager installed
+ * @author Sergey Malenkov
+ */
+
+public class Test8043627 {
+ public static void main(String[] args) {
+ System.setSecurityManager(new SecurityManager());
+ new SynthButtonUI().getContext(new JButton());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/awt/image/bug8038000.java Fri May 23 11:13:54 2014 -0700
@@ -0,0 +1,153 @@
+/*
+ * 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 8038000
+ *
+ * @summary Verifies that we could create different type of Rasters with height 1
+ * and strideline which exceeds raster width.
+ * Also checks that a set of RasterOp work correctly with such kind of Rasters.
+ *
+ * @run main bug8038000
+ */
+
+import java.awt.*;
+import java.awt.color.ColorSpace;
+import java.awt.geom.AffineTransform;
+import java.awt.image.*;
+import java.util.Arrays;
+
+public class bug8038000 {
+
+ public static void main(String[] args) throws Exception {
+ new bug8038000().checkOps();
+
+ // No exceptions - Passed
+ }
+
+ private void checkOps() throws Exception {
+
+ RasterOp[] ops = new RasterOp[] {
+ new ColorConvertOp(ColorSpace.getInstance(ColorSpace.CS_sRGB),
+ ColorSpace.getInstance(ColorSpace.CS_LINEAR_RGB), null),
+ new AffineTransformOp(AffineTransform.getScaleInstance(1, 1.1), null)
+ };
+
+
+ for (RasterOp op: ops) {
+ // Banded rasters
+ checkOp(Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 10, 1, 10,
+ new int[] {0, 1, 2}, new int[]{2,1,0}, null),
+ Raster.createBandedRaster(DataBuffer.TYPE_BYTE, 10, 1, 1001,
+ new int[] {0, 1, 2}, new int[]{2,1,0}, null), op);
+ checkOp(Raster.createBandedRaster(DataBuffer.TYPE_USHORT, 10, 1, 10,
+ new int[] {0, 1, 2}, new int[]{2,1,0}, null),
+ Raster.createBandedRaster(DataBuffer.TYPE_USHORT, 10, 1, 1001,
+ new int[] {0, 1, 2}, new int[]{2,1,0}, null), op);
+ checkOp(Raster.createBandedRaster(DataBuffer.TYPE_INT, 10, 1, 10,
+ new int[] {0, 1, 2}, new int[]{2,1,0}, null),
+ Raster.createBandedRaster(DataBuffer.TYPE_INT, 10, 1, 1001,
+ new int[] {0, 1, 2}, new int[]{2,1,0}, null), op);
+
+ // Interleaved rasters
+ checkOp(Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
+ 10, 1, 30, 3, new int[]{0, 1, 2}, null),
+ Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE,
+ 10, 1, 1001, 3, new int[]{0, 1, 2}, null),
+ op);
+
+ checkOp(Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT,
+ 10, 1, 30, 3, new int[]{0, 1, 2}, null),
+ Raster.createInterleavedRaster(DataBuffer.TYPE_USHORT,
+ 10, 1, 1001, 3, new int[]{0, 1, 2}, null),
+ op);
+
+ // Packed rasters
+ checkOp(Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 10,
+ new int[] {0x01, 0x02, 0x04}, null),
+ Raster.createPackedRaster(new DataBufferByte(10), 10, 1, 2000,
+ new int[] {0x01, 0x02, 0x04}, null),
+ op);
+ checkOp(Raster.createPackedRaster(new DataBufferInt(10), 10, 1, 10,
+ new int[] {0xff0000, 0x00ff00, 0x0000ff}, null),
+ Raster.createPackedRaster(new DataBufferInt(10), 10, 1, 20,
+ new int[] {0xff0000, 0x00ff00, 0x0000ff}, null),
+ op);
+
+ }
+ }
+
+ /**
+ * Takes two identical rasters (identical with the exception of scanline stride)
+ * fills their pixels with identical data, applies the RasterOp to both rasters
+ * and checks that the result is the same
+ */
+ private void checkOp(WritableRaster wr1, WritableRaster wr2, RasterOp op) {
+ System.out.println("Checking " + op + " with rasters: \n " + wr1 +
+ "\n " + wr2);
+ try {
+ WritableRaster r1 = op.filter(fillRaster(wr1), null);
+ WritableRaster r2 = op.filter(fillRaster(wr2), null);
+ compareRasters(r1, r2);
+ } catch (ImagingOpException e) {
+ System.out.println(" Skip: Op is not supported: " + e);
+ }
+ }
+
+ private WritableRaster fillRaster(WritableRaster wr) {
+ int c = 0;
+ for(int x = wr.getMinX(); x < wr.getMinX() + wr.getWidth(); x++) {
+ for(int y = wr.getMinY(); y < wr.getMinY() + wr.getHeight(); y++) {
+ for (int b = 0; b < wr.getNumBands(); b++) {
+ wr.setSample(x, y, b, c++);
+ }
+ }
+ }
+ return wr;
+ }
+
+ private void compareRasters(Raster r1, Raster r2) {
+ Rectangle bounds = r1.getBounds();
+ if (!bounds.equals(r2.getBounds())) {
+ throw new RuntimeException("Bounds differ.");
+ }
+
+ if (r1.getNumBands() != r2.getNumBands()) {
+ throw new RuntimeException("Bands differ.");
+ }
+
+ int[] b1 = new int[r1.getNumBands()];
+ int[] b2 = new int[r1.getNumBands()];
+
+ for (int x = (int) bounds.getX(); x < bounds.getMaxX(); x++) {
+ for (int y = (int) bounds.getY(); y < bounds.getMaxY(); y++) {
+ r1.getPixel(x,y, b1);
+ r2.getPixel(x,y, b2);
+ if (!Arrays.equals(b1, b2)) {
+ throw new RuntimeException("Pixels differ.");
+ }
+ }
+ }
+ }
+}