changeset 10366:875450e7ef8d jdk9-b24

Merge
author lana
date Fri, 18 Jul 2014 08:25:58 -0700
parents c90999d66c32 526240307741
children cc5cd8cd5fb3 fdf4cac36ef0
files src/macosx/native/sun/awt/awt.m src/share/classes/com/sun/jmx/remote/util/CacheMap.java src/share/classes/sun/awt/WindowClosingListener.java src/share/classes/sun/awt/WindowClosingSupport.java test/java/util/stream/test/org/openjdk/tests/java/util/stream/ExplodeOpTest.java test/java/util/stream/test/org/openjdk/tests/java/util/stream/SummaryStatisticsTest.java test/javax/management/remote/mandatory/util/CacheMapTest.java
diffstat 446 files changed, 11219 insertions(+), 3910 deletions(-) [+]
line wrap: on
line diff
--- a/make/lib/Awt2dLibraries.gmk	Thu Jul 17 09:50:33 2014 -0700
+++ b/make/lib/Awt2dLibraries.gmk	Fri Jul 18 08:25:58 2014 -0700
@@ -1358,7 +1358,7 @@
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
   LIBAWT_LWAWT_FILES := \
-      awt.m \
+      AWT_debug.m \
       ApplicationDelegate.m \
       CFRetainedResource.m \
       CGLGraphicsConfig.m \
--- a/make/mapfiles/libsplashscreen/mapfile-vers	Thu Jul 17 09:50:33 2014 -0700
+++ b/make/mapfiles/libsplashscreen/mapfile-vers	Fri Jul 18 08:25:58 2014 -0700
@@ -35,6 +35,7 @@
                 Java_java_awt_SplashScreen__1getImageFileName;
                 Java_java_awt_SplashScreen__1getImageJarName;
                 Java_java_awt_SplashScreen__1setImageData;
+                Java_java_awt_SplashScreen__1getScaleFactor;
 
 		SplashLoadMemory;
 		SplashLoadFile;
--- a/make/mapfiles/libsunec/mapfile-vers	Thu Jul 17 09:50:33 2014 -0700
+++ b/make/mapfiles/libsunec/mapfile-vers	Fri Jul 18 08:25:58 2014 -0700
@@ -28,10 +28,9 @@
 SUNWprivate_1.1 {
         global:
                 Java_sun_security_ec_ECKeyPairGenerator_generateECKeyPair;
-                Java_sun_security_ec_ECKeyPairGenerator_getEncodedBytes;
-		Java_sun_security_ec_ECDSASignature_signDigest;
-		Java_sun_security_ec_ECDSASignature_verifySignedDigest;
-		Java_sun_security_ec_ECDHKeyAgreement_deriveKey;
+                Java_sun_security_ec_ECDSASignature_signDigest;
+                Java_sun_security_ec_ECDSASignature_verifySignedDigest;
+                Java_sun_security_ec_ECDHKeyAgreement_deriveKey;
         local:
                 *;
 };
--- a/make/profile-includes.txt	Thu Jul 17 09:50:33 2014 -0700
+++ b/make/profile-includes.txt	Fri Jul 18 08:25:58 2014 -0700
@@ -71,6 +71,7 @@
     rt.jar \
     security/US_export_policy.jar \
     security/blacklist \
+    security/blacklisted.certs \
     security/cacerts \
     security/java.policy \
     security/java.security \
--- a/src/macosx/bin/java_md_macosx.c	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/bin/java_md_macosx.c	Fri Jul 18 08:25:58 2014 -0700
@@ -994,7 +994,7 @@
 
     sameThread = JNI_TRUE;
     // Set a variable that tells us we started on the main thread.
-    // This is used by the AWT during startup. (See awt.m)
+    // This is used by the AWT during startup. (See LWCToolkit.m)
     char envVar[80];
     snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
     setenv(envVar, "1", 1);
--- a/src/macosx/classes/com/apple/eawt/Application.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/classes/com/apple/eawt/Application.java	Fri Jul 18 08:25:58 2014 -0700
@@ -58,15 +58,8 @@
     static Application sApplication = null;
 
     static {
-        java.security.AccessController.doPrivileged(
-            new java.security.PrivilegedAction<Void>() {
-                public Void run() {
-                    System.loadLibrary("awt");
-                    return null;
-                }
-            });
-
         checkSecurity();
+        Toolkit.getDefaultToolkit(); // Start AppKit
         if (!Beans.isDesignTime()) {
             nativeInitializeApplicationDelegate();
         }
--- a/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaComboBoxPopup.java	Fri Jul 18 08:25:58 2014 -0700
@@ -121,10 +121,6 @@
     public void show() {
         final int startItemCount = comboBox.getItemCount();
 
-        if (startItemCount == 0) {
-            return;
-        }
-
         final Rectangle popupBounds = adjustPopupAndGetBounds();
         if (popupBounds == null) return; // null means don't show
 
--- a/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/classes/com/apple/laf/AquaMenuBarUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -26,11 +26,14 @@
 package com.apple.laf;
 
 import java.awt.*;
+import java.security.AccessController;
 
 import javax.swing.*;
 import javax.swing.plaf.ComponentUI;
 import javax.swing.plaf.basic.BasicMenuBarUI;
 
+import sun.lwawt.macosx.LWCToolkit;
+import sun.security.action.GetBooleanAction;
 import sun.security.action.GetPropertyAction;
 
 // MenuBar implementation for Mac L&F
@@ -131,28 +134,20 @@
     ScreenMenuBar fScreenMenuBar;
     boolean useScreenMenuBar = getScreenMenuBarProperty();
 
-    private static String getPrivSysProp(final String propName) {
-        return java.security.AccessController.doPrivileged(new GetPropertyAction(propName));
-    }
-
     static boolean getScreenMenuBarProperty() {
-        final String props[] = new String[]{""};
-
-        boolean useScreenMenuBar = false;
-        try {
-            props[0] = getPrivSysProp(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
-
-            if (props[0] != null && props[0].equals("true")) useScreenMenuBar = true;
-            else {
-                props[0] = getPrivSysProp(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar");
-
-                if (props[0] != null && props[0].equals("true")) {
-                    System.err.println(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar has been deprecated. Please switch to " + AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
-                    useScreenMenuBar = true;
-                }
-            }
-        } catch(final Throwable t) { };
-
-        return useScreenMenuBar;
+        // Do not allow AWT to set the screen menu bar if it's embedded in another UI toolkit
+        if (LWCToolkit.isEmbedded()) return false;
+        if (AccessController.doPrivileged(
+                new GetBooleanAction(AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar"))) {
+            return true;
+        }
+        if (AccessController.doPrivileged(
+                new GetBooleanAction(AquaLookAndFeel.sOldPropertyPrefix + "useScreenMenuBar"))) {
+                System.err.println(AquaLookAndFeel.sOldPropertyPrefix +
+                        "useScreenMenuBar has been deprecated. Please switch to " +
+                        AquaLookAndFeel.sPropertyPrefix + "useScreenMenuBar");
+                return true;
+        }
+        return false;
     }
 }
--- a/src/macosx/classes/sun/awt/CGraphicsEnvironment.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/classes/sun/awt/CGraphicsEnvironment.java	Fri Jul 18 08:25:58 2014 -0700
@@ -40,9 +40,6 @@
  */
 public final class CGraphicsEnvironment extends SunGraphicsEnvironment {
 
-    // Global initialization of the Cocoa runtime.
-    private static native void initCocoa();
-
     /**
      * Fetch an array of all valid CoreGraphics display identifiers.
      */
@@ -60,21 +57,8 @@
     public static void init() { }
 
     static {
-        java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
-            public Void run() {
-                System.loadLibrary("awt");
-                return null;
-            }
-        });
-
-        java.security.AccessController.doPrivileged(new java.security.PrivilegedAction<Void>() {
-            public Void run() {
-                if (isHeadless()) return null;
-                initCocoa();
-                return null;
-            }
-        });
-
+        // Load libraries and initialize the Toolkit.
+        Toolkit.getDefaultToolkit();
         // Install the correct surface manager factory.
         SurfaceManagerFactory.setInstance(new MacosxSurfaceManagerFactory());
     }
--- a/src/macosx/classes/sun/font/CFontConfiguration.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/classes/sun/font/CFontConfiguration.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -106,6 +106,6 @@
 
     @Override
     protected void initReorderMap() {
-        reorderMap = new HashMap();
+        reorderMap = new HashMap<>();
     }
 }
--- a/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/classes/sun/lwawt/macosx/LWCToolkit.java	Fri Jul 18 08:25:58 2014 -0700
@@ -44,6 +44,7 @@
 
 import sun.awt.*;
 import sun.awt.datatransfer.DataTransferer;
+import sun.awt.util.ThreadGroupUtils;
 import sun.java2d.opengl.OGLRenderQueue;
 import sun.lwawt.*;
 import sun.lwawt.LWWindowPeer.PeerType;
@@ -70,7 +71,7 @@
     private static final int BUTTONS = 5;
 
     private static native void initIDs();
-
+    private static native void initAppkit(ThreadGroup appKitThreadGroup, boolean headless);
     private static CInputMethodDescriptor sInputMethodDescriptor;
 
     static {
@@ -119,6 +120,7 @@
         areExtraMouseButtonsEnabled = Boolean.parseBoolean(System.getProperty("sun.awt.enableExtraMouseButtons", "true"));
         //set system property if not yet assigned
         System.setProperty("sun.awt.enableExtraMouseButtons", ""+areExtraMouseButtonsEnabled);
+        initAppkit(ThreadGroupUtils.getRootThreadGroup(), GraphicsEnvironment.isHeadless());
     }
 
     /*
@@ -166,7 +168,7 @@
     // This is only called from native code.
     static void systemColorsChanged() {
         EventQueue.invokeLater(() -> {
-            AccessController.doPrivileged ((PrivilegedAction<Object>) () -> {
+            AccessController.doPrivileged( (PrivilegedAction<Object>) () -> {
                 AWTAccessor.getSystemColorAccessor().updateSystemColors();
                 return null;
             });
@@ -790,6 +792,13 @@
      */
     native boolean isApplicationActive();
 
+    /**
+     * Returns true if AWT toolkit is embedded, false otherwise.
+     *
+     * @return true if AWT toolkit is embedded, false otherwise
+     */
+    public static native boolean isEmbedded();
+
     /************************
      * Native methods section
      ************************/
--- a/src/macosx/native/sun/awt/CGraphicsEnv.m	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/native/sun/awt/CGraphicsEnv.m	Fri Jul 18 08:25:58 2014 -0700
@@ -30,24 +30,6 @@
 #import "AWT_debug.h"
 
 
-/*
- * Class:     sun_awt_CGraphicsEnvironment
- * Method:    initCocoa
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_awt_CGraphicsEnvironment_initCocoa
-(JNIEnv *env, jclass self)
-{
-JNF_COCOA_ENTER(env);
-
-    // Inform Cocoa that we're multi-threaded.
-    // Creating a short-lived NSThread is the recommended way of doing so.
-    [NSThread detachNewThreadSelector:@selector(self) toTarget:[NSObject class] withObject:nil];
-
-JNF_COCOA_EXIT(env);
-}
-
 #define MAX_DISPLAYS 64
 
 /*
--- a/src/macosx/native/sun/awt/LWCToolkit.m	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/native/sun/awt/LWCToolkit.m	Fri Jul 18 08:25:58 2014 -0700
@@ -24,7 +24,12 @@
  */
 
 #import <dlfcn.h>
+#import <pthread.h>
+#import <objc/runtime.h>
+#import <Cocoa/Cocoa.h>
+#import <Security/AuthSession.h>
 #import <JavaNativeFoundation/JavaNativeFoundation.h>
+#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
 
 #include "jni_util.h"
 #import "CMenuBar.h"
@@ -34,6 +39,8 @@
 #import "AWT_debug.h"
 #import "CSystemColors.h"
 #import  "NSApplicationAWT.h"
+#import "PropertiesUtilities.h"
+#import "ApplicationDelegate.h"
 
 #import "sun_lwawt_macosx_LWCToolkit.h"
 
@@ -42,6 +49,20 @@
 int gNumberOfButtons;
 jint* gButtonDownMasks;
 
+// Indicates that the app has been started with -XstartOnFirstThread
+// (directly or via WebStart settings), and AWT should not run its
+// own event loop in this mode. Even if a loop isn't running yet,
+// we expect an embedder (e.g. SWT) to start it some time later.
+static BOOL forceEmbeddedMode = NO;
+
+// Indicates if awt toolkit is embedded into another UI toolkit
+static BOOL isEmbedded = NO;
+
+// This is the data necessary to have JNI_OnLoad wait for AppKit to start.
+static BOOL sAppKitStarted = NO;
+static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER;
+static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER;
+
 @implementation AWTToolkit
 
 static long eventCount;
@@ -115,6 +136,232 @@
 }
 @end
 
+void setBusy(BOOL busy) {
+    AWT_ASSERT_APPKIT_THREAD;
+
+    JNIEnv *env = [ThreadUtilities getJNIEnv];
+    static JNF_CLASS_CACHE(jc_AWTAutoShutdown, "sun/awt/AWTAutoShutdown");
+
+    if (busy) {
+        static JNF_STATIC_MEMBER_CACHE(jm_notifyBusyMethod, jc_AWTAutoShutdown, "notifyToolkitThreadBusy", "()V");
+        JNFCallStaticVoidMethod(env, jm_notifyBusyMethod);
+    } else {
+        static JNF_STATIC_MEMBER_CACHE(jm_notifyFreeMethod, jc_AWTAutoShutdown, "notifyToolkitThreadFree", "()V");
+        JNFCallStaticVoidMethod(env, jm_notifyFreeMethod);
+    }
+}
+
+static void setUpAWTAppKit(BOOL installObservers)
+{
+    if (installObservers) {
+        AWT_STARTUP_LOG(@"Setting up busy observers");
+
+        // Add CFRunLoopObservers to call into AWT so that AWT knows that the
+        //  AWT thread (which is the AppKit main thread) is alive. This way AWT
+        //  will not automatically shutdown.
+        CFRunLoopObserverRef busyObserver = CFRunLoopObserverCreateWithHandler(
+                                               NULL,                        // CFAllocator
+                                               kCFRunLoopAfterWaiting,      // CFOptionFlags
+                                               true,                        // repeats
+                                               NSIntegerMax,                // order
+                                               ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
+                                                   setBusy(YES);
+                                               });
+        
+        CFRunLoopObserverRef notBusyObserver = CFRunLoopObserverCreateWithHandler(
+                                                NULL,                        // CFAllocator
+                                                kCFRunLoopBeforeWaiting,     // CFOptionFlags
+                                                true,                        // repeats
+                                                NSIntegerMin,                // order
+                                                ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {
+                                                    setBusy(NO);
+                                                });
+        
+        CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
+        CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
+        CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
+        
+        CFRelease(busyObserver);
+        CFRelease(notBusyObserver);
+        
+        setBusy(YES);
+    }
+
+    JNIEnv* env = [ThreadUtilities getJNIEnv];
+    static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
+    static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V");
+    JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava);
+}
+
+BOOL isSWTInWebStart(JNIEnv* env) {
+    NSString *swtWebStart = [PropertiesUtilities javaSystemPropertyForKey:@"com.apple.javaws.usingSWT" withEnv:env];
+    return [@"true" isCaseInsensitiveLike:swtWebStart];
+}
+
+static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
+    NSLog(@"Apple AWT Internal Exception: %@", [exception description]);
+}
+
+@interface AWTStarter : NSObject
++ (void)start:(BOOL)headless;
++ (void)starter:(BOOL)onMainThread headless:(BOOL)headless;
++ (void)appKitIsRunning:(id)arg;
+@end
+
+@implementation AWTStarter
+
++ (BOOL) isConnectedToWindowServer {
+    SecuritySessionId session_id;
+    SessionAttributeBits session_info;
+    OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
+    if (status != noErr) return NO;
+    if (!(session_info & sessionHasGraphicAccess)) return NO;
+    return YES;
+}
+
++ (BOOL) markAppAsDaemon {
+    id jrsAppKitAWTClass = objc_getClass("JRSAppKitAWT");
+    SEL markAppSel = @selector(markAppIsDaemon);
+    if (![jrsAppKitAWTClass respondsToSelector:markAppSel]) return NO;
+    return [jrsAppKitAWTClass performSelector:markAppSel] ? YES : NO;
+}
+
++ (void)appKitIsRunning:(id)arg {
+    AWT_ASSERT_APPKIT_THREAD;
+    AWT_STARTUP_LOG(@"About to message AppKit started");
+
+    // Signal that AppKit has started (or is already running).
+    pthread_mutex_lock(&sAppKitStarted_mutex);
+    sAppKitStarted = YES;
+    pthread_cond_signal(&sAppKitStarted_cv);
+    pthread_mutex_unlock(&sAppKitStarted_mutex);
+
+    AWT_STARTUP_LOG(@"Finished messaging AppKit started");
+}
+
++ (void)start:(BOOL)headless
+{
+    // onMainThread is NOT the same at SWT mode!
+    // If the JVM was started on the first thread for SWT, but the SWT loads the AWT on a secondary thread,
+    // onMainThread here will be false but SWT mode will be true.  If we are currently on the main thread, we don't
+    // need to throw AWT startup over to another thread.
+    BOOL onMainThread = [NSThread isMainThread];
+
+    NSString* msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d] { onMainThread:%d }", headless, onMainThread];
+    AWT_STARTUP_LOG(msg);
+
+    if (!headless)
+    {
+        // Listen for the NSApp to start. This indicates that JNI_OnLoad can proceed.
+        //  It must wait because there is a chance that another java thread will grab
+        //  the AppKit lock before the +[NSApplication sharedApplication] returns.
+        //  See <rdar://problem/3492666> for an example.
+        [[NSNotificationCenter defaultCenter] addObserver:[AWTStarter class]
+                                                 selector:@selector(appKitIsRunning:)
+                                                     name:NSApplicationDidFinishLaunchingNotification
+                                                   object:nil];
+
+        AWT_STARTUP_LOG(@"+[AWTStarter start:::]: registered NSApplicationDidFinishLaunchingNotification");
+    }
+
+    [ThreadUtilities performOnMainThreadWaiting:NO block:^() {
+        [AWTStarter starter:onMainThread headless:headless];
+    }];
+
+
+    if (!headless && !onMainThread) {
+
+        AWT_STARTUP_LOG(@"about to wait on AppKit startup mutex");
+
+        // Wait here for AppKit to have started (or for AWT to have been loaded into
+        //  an already running NSApplication).
+        pthread_mutex_lock(&sAppKitStarted_mutex);
+        while (sAppKitStarted == NO) {
+            pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
+        }
+        pthread_mutex_unlock(&sAppKitStarted_mutex);
+
+        // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
+        AWT_STARTUP_LOG(@"got out of the AppKit startup mutex");
+    }
+
+    if (!headless) {
+        // Don't set the delegate until the NSApplication has been created and
+        // its finishLaunching has initialized it.
+        //  ApplicationDelegate is the support code for com.apple.eawt.
+        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+            id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
+            if (delegate != nil) {
+                OSXAPP_SetApplicationDelegate(delegate);
+            }
+        }];
+    }
+}
+
++ (void)starter:(BOOL)wasOnMainThread headless:(BOOL)headless {
+    NSAutoreleasePool *pool = [NSAutoreleasePool new];
+    // Add the exception handler of last resort
+    NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
+
+    // Headless mode trumps either ordinary AWT or SWT-in-AWT mode.  Declare us a daemon and return.
+    if (headless) {
+        // Note that we don't install run loop observers in headless mode
+        // because we don't need them (see 7174704)
+        if (!forceEmbeddedMode) {
+            setUpAWTAppKit(false);
+        }
+        [AWTStarter markAppAsDaemon];
+        return;
+    }
+
+    if (forceEmbeddedMode) {
+        AWT_STARTUP_LOG(@"in SWT or SWT/WebStart mode");
+
+        // Init a default NSApplication instance instead of the NSApplicationAWT.
+        // Note that [NSApp isRunning] will return YES after that, though
+        // this behavior isn't specified anywhere. We rely on that.
+        NSApplicationLoad();
+    }
+
+    // This will create a NSApplicationAWT for standalone AWT programs, unless there is
+    //  already a NSApplication instance. If there is already a NSApplication instance,
+    //  and -[NSApplication isRunning] returns YES, AWT is embedded inside another
+    //  AppKit Application.
+    NSApplication *app = [NSApplicationAWT sharedApplication];
+    isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
+
+    if (!isEmbedded) {
+        // Install run loop observers and set the AppKit Java thread name
+        setUpAWTAppKit(true);
+    }
+
+    // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent.
+    if (![app isRunning]) {
+        AWT_STARTUP_LOG(@"+[AWTStarter startAWT]: ![app isRunning]");
+        // This is where the AWT AppKit thread parks itself to process events.
+        [NSApplicationAWT runAWTLoopWithApp: app];
+    } else {
+        // We're either embedded, or showing a splash screen
+        if (isEmbedded) {
+            AWT_STARTUP_LOG(@"running embedded");
+            
+            // We don't track if the runloop is busy, so set it free to let AWT finish when it needs
+            setBusy(NO);
+        } else {
+            AWT_STARTUP_LOG(@"running after showing a splash screen");
+        }
+        
+        // Signal so that JNI_OnLoad can proceed.
+        if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil];
+        
+        // Proceed to exit this call as there is no reason to run the NSApplication event loop.
+    }
+    
+    [pool drain];
+}
+
+@end
+
 /*
  * Class:     sun_lwawt_macosx_LWCToolkit
  * Method:    nativeSyncQueue
@@ -169,52 +416,6 @@
     NSBeep(); // produces both sound and visual flash, if configured in System Preferences
 }
 
-/*
- * Class:     sun_lwawt_macosx_LWCToolkit
- * Method:    initIDs
- * Signature: ()V
- */
-JNIEXPORT void JNICALL
-Java_sun_lwawt_macosx_LWCToolkit_initIDs
-(JNIEnv *env, jclass klass) {
-    // set thread names
-    if (![ThreadUtilities isAWTEmbedded]) {
-        dispatch_async(dispatch_get_main_queue(), ^(void){
-            [[NSThread currentThread] setName:@"AppKit Thread"];
-            JNIEnv *env = [ThreadUtilities getJNIEnv];
-            static JNF_CLASS_CACHE(jc_LWCToolkit, "sun/lwawt/macosx/LWCToolkit");
-            static JNF_STATIC_MEMBER_CACHE(jsm_installToolkitThreadInJava, jc_LWCToolkit, "installToolkitThreadInJava", "()V");
-            JNFCallStaticVoidMethod(env, jsm_installToolkitThreadInJava);
-        });
-    }
-    
-    gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
-
-    jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
-    CHECK_NULL(inputEventClazz);
-    jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
-    CHECK_NULL(getButtonDownMasksID);
-    jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
-    jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
-    CHECK_NULL(tmp);
-
-    gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
-    if (gButtonDownMasks == NULL) {
-        gNumberOfButtons = 0;
-        (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
-        JNU_ThrowOutOfMemoryError(env, NULL);
-        return;
-    }
-
-    int i;
-    for (i = 0; i < gNumberOfButtons; i++) {
-        gButtonDownMasks[i] = tmp[i];
-    }
-
-    (*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
-    (*env)->DeleteLocalRef(env, obj);
-}
-
 static UInt32 RGB(NSColor *c) {
     c = [c colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
     if (c == nil)
@@ -443,3 +644,95 @@
 {
 
 }
+
+/*
+ * Class:     sun_lwawt_macosx_LWCToolkit
+ * Method:    initIDs
+ * Signature: ()V
+ */
+JNIEXPORT void JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_initIDs
+(JNIEnv *env, jclass klass) {
+
+    JNF_COCOA_ENTER(env)
+
+    gNumberOfButtons = sun_lwawt_macosx_LWCToolkit_BUTTONS;
+
+    jclass inputEventClazz = (*env)->FindClass(env, "java/awt/event/InputEvent");
+    CHECK_NULL(inputEventClazz);
+    jmethodID getButtonDownMasksID = (*env)->GetStaticMethodID(env, inputEventClazz, "getButtonDownMasks", "()[I");
+    CHECK_NULL(getButtonDownMasksID);
+    jintArray obj = (jintArray)(*env)->CallStaticObjectMethod(env, inputEventClazz, getButtonDownMasksID);
+    jint * tmp = (*env)->GetIntArrayElements(env, obj, JNI_FALSE);
+    CHECK_NULL(tmp);
+
+    gButtonDownMasks = (jint*)SAFE_SIZE_ARRAY_ALLOC(malloc, sizeof(jint), gNumberOfButtons);
+    if (gButtonDownMasks == NULL) {
+        gNumberOfButtons = 0;
+        (*env)->ReleaseIntArrayElements(env, obj, tmp, JNI_ABORT);
+        JNU_ThrowOutOfMemoryError(env, NULL);
+        return;
+    }
+
+    int i;
+    for (i = 0; i < gNumberOfButtons; i++) {
+        gButtonDownMasks[i] = tmp[i];
+    }
+
+    (*env)->ReleaseIntArrayElements(env, obj, tmp, 0);
+    (*env)->DeleteLocalRef(env, obj);
+
+    JNF_COCOA_EXIT(env)
+}
+
+/*
+ * Class:     sun_lwawt_macosx_LWCToolkit
+ * Method:    initAppkit
+ * Signature: (Ljava/lang/ThreadGroup;)V
+ */
+JNIEXPORT void JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_initAppkit
+(JNIEnv *env, jclass klass, jobject appkitThreadGroup, jboolean headless) {
+    JNF_COCOA_ENTER(env)
+
+    [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, appkitThreadGroup)];
+
+    // Launcher sets this env variable if -XstartOnFirstThread is specified
+    char envVar[80];
+    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+    if (getenv(envVar) != NULL) {
+        forceEmbeddedMode = YES;
+        unsetenv(envVar);
+    }
+
+    if (isSWTInWebStart(env)) {
+        forceEmbeddedMode = YES;
+    }
+
+    [AWTStarter start:headless ? YES : NO];
+
+    JNF_COCOA_EXIT(env)
+}
+
+JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
+    OSXAPP_SetJavaVM(vm);
+
+    // We need to let Foundation know that this is a multithreaded application, if it isn't already.
+    if (![NSThread isMultiThreaded]) {
+        [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
+    }
+
+    return JNI_VERSION_1_4;
+}
+
+/*
+ * Class:     sun_lwawt_macosx_LWCToolkit
+ * Method:    isEmbedded
+ * Signature: ()Z
+ */
+JNIEXPORT jboolean JNICALL
+Java_sun_lwawt_macosx_LWCToolkit_isEmbedded
+(JNIEnv *env, jclass klass) {
+    return isEmbedded ? JNI_TRUE : JNI_FALSE;
+}
+
--- a/src/macosx/native/sun/awt/awt.m	Thu Jul 17 09:50:33 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,460 +0,0 @@
-/*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#import <pthread.h>
-#import <objc/runtime.h>
-#import <Cocoa/Cocoa.h>
-#import <Security/AuthSession.h>
-#import <JavaNativeFoundation/JavaNativeFoundation.h>
-#import <JavaRuntimeSupport/JavaRuntimeSupport.h>
-
-#import "NSApplicationAWT.h"
-#import "PropertiesUtilities.h"
-#import "ThreadUtilities.h"
-#import "AWT_debug.h"
-#import "ApplicationDelegate.h"
-
-#define DEBUG 0
-
-
-// The symbol is defined in libosxapp.dylib (ThreadUtilities.m)
-extern JavaVM *jvm;
-
-// Indicates if AWT is running embedded (in SWT, FX, elsewhere)
-static BOOL isEmbedded = NO;
-
-// Indicates that the app has been started with -XstartOnFirstThread
-// (directly or via WebStart settings), and AWT should not run its
-// own event loop in this mode. Even if a loop isn't running yet,
-// we expect an embedder (e.g. SWT) to start it some time later.
-static BOOL forceEmbeddedMode = NO;
-
-static bool ShouldPrintVerboseDebugging() {
-    static int debug = -1;
-    if (debug == -1) {
-        debug = (int)(getenv("JAVA_AWT_VERBOSE") != NULL) || (DEBUG != 0);
-    }
-    return (bool)debug;
-}
-
-// This is the data necessary to have JNI_OnLoad wait for AppKit to start.
-static BOOL sAppKitStarted = NO;
-static pthread_mutex_t sAppKitStarted_mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t sAppKitStarted_cv = PTHREAD_COND_INITIALIZER;
-
-void setBusy(BOOL isBusy);
-static void BusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg);
-static void NotBusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg);
-static void AWT_NSUncaughtExceptionHandler(NSException *exception);
-
-static CFRunLoopObserverRef busyObserver = NULL;
-static CFRunLoopObserverRef notBusyObserver = NULL;
-
-static void setUpAWTAppKit()
-{
-    BOOL verbose = ShouldPrintVerboseDebugging();
-    if (verbose) AWT_DEBUG_LOG(@"setting up busy observers");
-
-    // Add CFRunLoopObservers to call into AWT so that AWT knows that the
-    //  AWT thread (which is the AppKit main thread) is alive. This way AWT
-    //  will not automatically shutdown.
-    busyObserver = CFRunLoopObserverCreate(
-            NULL,                        // CFAllocator
-            kCFRunLoopAfterWaiting,      // CFOptionFlags
-            true,                        // repeats
-            NSIntegerMax,                // order
-            &BusyObserver,               // CFRunLoopObserverCallBack
-            NULL);                       // CFRunLoopObserverContext
-
-    notBusyObserver = CFRunLoopObserverCreate(
-            NULL,                        // CFAllocator
-            kCFRunLoopBeforeWaiting,     // CFOptionFlags
-            true,                        // repeats
-            NSIntegerMin,                // order
-            &NotBusyObserver,            // CFRunLoopObserverCallBack
-            NULL);                       // CFRunLoopObserverContext
-
-    CFRunLoopRef runLoop = [[NSRunLoop currentRunLoop] getCFRunLoop];
-    CFRunLoopAddObserver(runLoop, busyObserver, kCFRunLoopDefaultMode);
-    CFRunLoopAddObserver(runLoop, notBusyObserver, kCFRunLoopDefaultMode);
-
-    CFRelease(busyObserver);
-    CFRelease(notBusyObserver);
-
-    setBusy(YES);
-}
-
-static void setUpAppKitThreadName()
-{
-    BOOL verbose = ShouldPrintVerboseDebugging();
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-
-    // Set the java name of the AppKit main thread appropriately.
-    jclass threadClass = NULL;
-    jstring name = NULL;
-    jobject curThread = NULL;
-
-    threadClass = (*env)->FindClass(env, "java/lang/Thread");
-    if (threadClass == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
-    jmethodID currentThreadID = (*env)->GetStaticMethodID(env, threadClass, "currentThread", "()Ljava/lang/Thread;");
-    if (currentThreadID == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
-    jmethodID setName = (*env)->GetMethodID(env, threadClass, "setName", "(Ljava/lang/String;)V");
-    if (setName == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
-
-    curThread = (*env)->CallStaticObjectMethod(env, threadClass, currentThreadID); // AWT_THREADING Safe (known object)
-    if (curThread == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
-    name = (*env)->NewStringUTF(env, "AWT-AppKit");
-    if (name == NULL || (*env)->ExceptionCheck(env)) goto cleanup;
-    (*env)->CallVoidMethod(env, curThread, setName, name); // AWT_THREADING Safe (known object)
-    if ((*env)->ExceptionCheck(env)) goto cleanup;
-
-cleanup:
-    if (threadClass != NULL) {
-        (*env)->DeleteLocalRef(env, threadClass);
-    }
-    if (name != NULL) {
-        (*env)->DeleteLocalRef(env, name);
-    }
-    if (curThread != NULL) {
-        (*env)->DeleteLocalRef(env, curThread);
-    }
-    if ((*env)->ExceptionCheck(env)) {
-        (*env)->ExceptionDescribe(env);
-        (*env)->ExceptionClear(env);
-    }
-
-    if (verbose) AWT_DEBUG_LOG(@"finished setting thread name");
-}
-
-
-// Returns true if java believes it is running headless
-BOOL isHeadless(JNIEnv *env) {
-    // Just access the property directly, instead of using GraphicsEnvironment.isHeadless.
-    //  This is because this may be called while AWT is being loaded, and calling AWT
-    //  while it is being loaded will deadlock.
-    static JNF_CLASS_CACHE(jc_Toolkit, "java/awt/GraphicsEnvironment");
-    static JNF_STATIC_MEMBER_CACHE(jm_isHeadless, jc_Toolkit, "isHeadless", "()Z");
-    return JNFCallStaticBooleanMethod(env, jm_isHeadless);
-}
-
-BOOL isSWTInWebStart(JNIEnv* env) {
-    NSString *swtWebStart = [PropertiesUtilities javaSystemPropertyForKey:@"com.apple.javaws.usingSWT" withEnv:env];
-    return [@"true" isCaseInsensitiveLike:swtWebStart];
-}
-
-void setBusy(BOOL busy) {
-AWT_ASSERT_APPKIT_THREAD;
-
-    JNIEnv *env = [ThreadUtilities getJNIEnv];
-    static JNF_CLASS_CACHE(jc_AWTAutoShutdown, "sun/awt/AWTAutoShutdown");
-
-    if (busy) {
-        static JNF_STATIC_MEMBER_CACHE(jm_notifyBusyMethod, jc_AWTAutoShutdown, "notifyToolkitThreadBusy", "()V");
-        JNFCallStaticVoidMethod(env, jm_notifyBusyMethod);
-    } else {
-        static JNF_STATIC_MEMBER_CACHE(jm_notifyFreeMethod, jc_AWTAutoShutdown, "notifyToolkitThreadFree", "()V");
-        JNFCallStaticVoidMethod(env, jm_notifyFreeMethod);
-    }
-}
-
-static void BusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg) {
-AWT_ASSERT_APPKIT_THREAD;
-
-    // This is only called with the selector kCFRunLoopAfterWaiting.
-#ifndef PRODUCT_BUILD
-    assert(what == kCFRunLoopAfterWaiting);
-#endif /* PRODUCT_BUILD */
-
-    setBusy(YES);
-}
-
-static void NotBusyObserver(CFRunLoopObserverRef ref, CFRunLoopActivity what, void* arg) {
-AWT_ASSERT_APPKIT_THREAD;
-
-    // This is only called with the selector kCFRunLoopBeforeWaiting.
-#ifndef PRODUCT_BUILD
-    assert(what == kCFRunLoopBeforeWaiting);
-#endif /* PRODUCT_BUILD */
-
-    setBusy(NO);
-}
-
-static void AWT_NSUncaughtExceptionHandler(NSException *exception) {
-    NSLog(@"Apple AWT Internal Exception: %@", [exception description]);
-}
-
-// This is an empty Obj-C object just so that -peformSelectorOnMainThread can be used.
-@interface AWTStarter : NSObject { }
-+ (void)start:(BOOL)headless;
-- (void)starter:(NSArray*)args;
-+ (void)appKitIsRunning:(id)arg;
-@end
-
-@implementation AWTStarter
-
-+ (BOOL) isConnectedToWindowServer {
-    SecuritySessionId session_id;
-    SessionAttributeBits session_info;
-    OSStatus status = SessionGetInfo(callerSecuritySession, &session_id, &session_info);
-    if (status != noErr) return NO;
-    if (!(session_info & sessionHasGraphicAccess)) return NO;
-    return YES;
-}
-
-+ (BOOL) markAppAsDaemon {
-    id jrsAppKitAWTClass = objc_getClass("JRSAppKitAWT");
-    SEL markAppSel = @selector(markAppIsDaemon);
-    if (![jrsAppKitAWTClass respondsToSelector:markAppSel]) return NO;
-    return [jrsAppKitAWTClass performSelector:markAppSel] ? YES : NO;
-}
-
-+ (void)appKitIsRunning:(id)arg {
-    // Headless: NO
-    // Embedded: BOTH
-    // Multiple Calls: NO
-    //  Callers: AppKit's NSApplicationDidFinishLaunchingNotification or +[AWTStarter startAWT:]
-AWT_ASSERT_APPKIT_THREAD;
-
-    BOOL verbose = ShouldPrintVerboseDebugging();
-    if (verbose) AWT_DEBUG_LOG(@"about to message AppKit started");
-
-    // Signal that AppKit has started (or is already running).
-    pthread_mutex_lock(&sAppKitStarted_mutex);
-    sAppKitStarted = YES;
-    pthread_cond_signal(&sAppKitStarted_cv);
-    pthread_mutex_unlock(&sAppKitStarted_mutex);
-
-    if (verbose) AWT_DEBUG_LOG(@"finished messaging AppKit started");
-}
-
-+ (void)start:(BOOL)headless
-{
-    BOOL verbose = ShouldPrintVerboseDebugging();
-
-    // Headless: BOTH
-    // Embedded: BOTH
-    // Multiple Calls: NO
-    //  Caller: JNI_OnLoad
-
-    // onMainThread is NOT the same at SWT mode!
-    // If the JVM was started on the first thread for SWT, but the SWT loads the AWT on a secondary thread,
-    // onMainThread here will be false but SWT mode will be true.  If we are currently on the main thread, we don't
-    // need to throw AWT startup over to another thread.
-    BOOL onMainThread = (pthread_main_np() != 0);
-
-    if (verbose) {
-        NSString *msg = [NSString stringWithFormat:@"+[AWTStarter start headless:%d] { onMainThread:%d }", headless, onMainThread];
-        AWT_DEBUG_LOG(msg);
-    }
-
-    if (!headless)
-    {
-        // Listen for the NSApp to start. This indicates that JNI_OnLoad can proceed.
-        //  It must wait because there is a chance that another java thread will grab
-        //  the AppKit lock before the +[NSApplication sharedApplication] returns.
-        //  See <rdar://problem/3492666> for an example.
-        [[NSNotificationCenter defaultCenter] addObserver:[AWTStarter class]
-                                                 selector:@selector(appKitIsRunning:)
-                                                     name:NSApplicationDidFinishLaunchingNotification
-                                                   object:nil];
-
-        if (verbose) NSLog(@"+[AWTStarter start:::]: registered NSApplicationDidFinishLaunchingNotification");
-    }
-
-    id st = [[AWTStarter alloc] init];
-
-    NSArray * args = [NSArray arrayWithObjects:
-                      [NSNumber numberWithBool: onMainThread],
-                      [NSNumber numberWithBool: headless],
-                      [NSNumber numberWithBool: verbose],
-                      nil];
-
-    if (onMainThread) {
-        [st starter:args];
-    } else {
-        [st performSelectorOnMainThread: @selector(starter:) withObject:args waitUntilDone:NO];
-    }
-
-    if (!headless && !onMainThread) {
-        if (verbose) AWT_DEBUG_LOG(@"about to wait on AppKit startup mutex");
-
-        // Wait here for AppKit to have started (or for AWT to have been loaded into
-        //  an already running NSApplication).
-        pthread_mutex_lock(&sAppKitStarted_mutex);
-        while (sAppKitStarted == NO) {
-            pthread_cond_wait(&sAppKitStarted_cv, &sAppKitStarted_mutex);
-        }
-        pthread_mutex_unlock(&sAppKitStarted_mutex);
-
-        // AWT gets here AFTER +[AWTStarter appKitIsRunning:] is called.
-        if (verbose) AWT_DEBUG_LOG(@"got out of the AppKit startup mutex");
-    }
-
-    if (!headless) {
-        // Don't set the delegate until the NSApplication has been created and
-        // its finishLaunching has initialized it.
-        //  ApplicationDelegate is the support code for com.apple.eawt.
-        [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
-            id<NSApplicationDelegate> delegate = [ApplicationDelegate sharedDelegate];
-            if (delegate != nil) {
-                OSXAPP_SetApplicationDelegate(delegate);
-            }        
-        }];
-    }
-}
-
-- (void)starter:(NSArray*)args {
-    NSAutoreleasePool *pool = [NSAutoreleasePool new];
-
-    BOOL onMainThread = [[args objectAtIndex:0] boolValue];
-    BOOL headless = [[args objectAtIndex:1] boolValue];
-    BOOL verbose = [[args objectAtIndex:2] boolValue];
-
-    BOOL wasOnMainThread = onMainThread;
-
-    // Add the exception handler of last resort
-    NSSetUncaughtExceptionHandler(AWT_NSUncaughtExceptionHandler);
-
-    // Headless mode trumps either ordinary AWT or SWT-in-AWT mode.  Declare us a daemon and return.
-    if (headless) {
-        // Note that we don't install run loop observers in headless mode
-        // because we don't need them (see 7174704)
-        if (!forceEmbeddedMode) {
-            setUpAppKitThreadName();
-        }
-        [AWTStarter markAppAsDaemon];
-        return;
-    }
-
-    if (forceEmbeddedMode) {
-        if (verbose) NSLog(@"in SWT or SWT/WebStart mode");
-
-        // Init a default NSApplication instance instead of the NSApplicationAWT.
-        // Note that [NSApp isRunning] will return YES after that, though
-        // this behavior isn't specified anywhere. We rely on that.
-        NSApplicationLoad();
-    }
-
-    // This will create a NSApplicationAWT for standalone AWT programs, unless there is
-    //  already a NSApplication instance. If there is already a NSApplication instance,
-    //  and -[NSApplication isRunning] returns YES, AWT is embedded inside another
-    //  AppKit Application.
-    NSApplication *app = [NSApplicationAWT sharedApplication];
-    isEmbedded = ![NSApp isKindOfClass:[NSApplicationAWT class]];
-    [ThreadUtilities setAWTEmbedded:isEmbedded];
-
-    if (!isEmbedded) {
-        // Install run loop observers and set the AppKit Java thread name
-        setUpAWTAppKit();
-        setUpAppKitThreadName();
-    }
-
-    // AWT gets to this point BEFORE NSApplicationDidFinishLaunchingNotification is sent.
-    if (![app isRunning]) {
-        if (verbose) AWT_DEBUG_LOG(@"+[AWTStarter startAWT]: ![app isRunning]");
-
-        // This is where the AWT AppKit thread parks itself to process events.
-        [NSApplicationAWT runAWTLoopWithApp: app];
-    } else {
-        // We're either embedded, or showing a splash screen
-        if (isEmbedded) {
-            if (verbose) AWT_DEBUG_LOG(@"running embedded");
-
-            // We don't track if the runloop is busy, so set it free to let AWT finish when it needs
-            setBusy(NO);
-        } else {
-            if (verbose) AWT_DEBUG_LOG(@"running after showing a splash screen");
-        }
-
-        // Signal so that JNI_OnLoad can proceed.
-        if (!wasOnMainThread) [AWTStarter appKitIsRunning:nil];
-
-        // Proceed to exit this call as there is no reason to run the NSApplication event loop.
-    }
-
-    [pool drain];
-}
-
-@end
-
-
-JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void *reserved) {
-    BOOL verbose = ShouldPrintVerboseDebugging();
-    if (verbose) AWT_DEBUG_LOG(@"entered JNI_OnLoad");
-
-    // Headless: BOTH
-    // Embedded: BOTH
-    // Multiple Calls: NO
-    //  Caller: JavaVM classloader
-
-    // Keep a static reference for other archives.
-    OSXAPP_SetJavaVM(vm);
-
-    JNIEnv *env = NULL;
-
-    // Need JNIEnv for JNF_COCOA_ENTER(env); macro below
-    jint status = (*jvm)->GetEnv(jvm, (void **)&env, JNI_VERSION_1_4);
-    if (status != JNI_OK || env == NULL) {
-        AWT_DEBUG_LOG(@"Can't get JNIEnv");
-        return JNI_VERSION_1_4;
-    }
-
-JNF_COCOA_ENTER(env);
-
-    // Launcher sets this env variable if -XstartOnFirstThread is specified
-    char envVar[80];
-    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
-    if (getenv(envVar) != NULL) {
-        forceEmbeddedMode = YES;
-        unsetenv(envVar);
-    }
-
-    if (isSWTInWebStart(env)) {
-        forceEmbeddedMode = YES;
-    }
-    JNIEnv* env = [ThreadUtilities getJNIEnvUncached];
-    jclass jc_ThreadGroupUtils = (*env)->FindClass(env, "sun/awt/util/ThreadGroupUtils");
-    jmethodID sjm_getRootThreadGroup = (*env)->GetStaticMethodID(env, jc_ThreadGroupUtils, "getRootThreadGroup", "()Ljava/lang/ThreadGroup;");
-    jobject rootThreadGroup = (*env)->CallStaticObjectMethod(env, jc_ThreadGroupUtils, sjm_getRootThreadGroup);
-    [ThreadUtilities setAppkitThreadGroup:(*env)->NewGlobalRef(env, rootThreadGroup)];
-    // The current thread was attached in getJNIEnvUnchached.
-    // Detach it back. It will be reattached later if needed with a proper TG
-    [ThreadUtilities detachCurrentThread];
-
-    BOOL headless = isHeadless(env);
-
-    // We need to let Foundation know that this is a multithreaded application, if it isn't already.
-    if (![NSThread isMultiThreaded]) {
-        [NSThread detachNewThreadSelector:nil toTarget:nil withObject:nil];
-    }
-
-    [AWTStarter start:headless];
-
-JNF_COCOA_EXIT(env);
-
-    if (verbose) AWT_DEBUG_LOG(@"exiting JNI_OnLoad");
-
-    return JNI_VERSION_1_4;
-}
--- a/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/native/sun/awt/splashscreen/splashscreen_sys.m	Fri Jul 18 08:25:58 2014 -0700
@@ -125,6 +125,39 @@
     return buf;
 }
 
+char* SplashGetScaledImageName(const char* jar, const char* file,
+                               float *scaleFactor) {
+    NSAutoreleasePool *pool = [NSAutoreleasePool new];
+    *scaleFactor = 1;
+    char* scaledFile = nil;
+    float screenScaleFactor = [SplashNSScreen() backingScaleFactor];
+    
+    if (screenScaleFactor > 1) {
+        NSString *fileName = [NSString stringWithUTF8String: file];
+        NSUInteger length = [fileName length];
+        NSRange range = [fileName rangeOfString: @"."
+                                        options:NSBackwardsSearch];
+        NSUInteger dotIndex = range.location;
+        NSString *fileName2x = nil;
+        
+        if (dotIndex == NSNotFound) {
+            fileName2x = [fileName stringByAppendingString: @"@2x"];
+        } else {
+            fileName2x = [fileName substringToIndex: dotIndex];
+            fileName2x = [fileName2x stringByAppendingString: @"@2x"];
+            fileName2x = [fileName2x stringByAppendingString:
+                          [fileName substringFromIndex: dotIndex]];
+        }
+        
+        if ((fileName2x != nil) && (jar || [[NSFileManager defaultManager]
+                    fileExistsAtPath: fileName2x])){
+            *scaleFactor = 2;
+            scaledFile = strdup([fileName2x UTF8String]);
+        }
+    }
+    [pool drain];
+    return scaledFile;
+}
 
 void
 SplashInitPlatform(Splash * splash) {
@@ -132,7 +165,7 @@
 
     splash->maskRequired = 0;
 
-
+    
     //TODO: the following is too much of a hack but should work in 90% cases.
     //      besides we don't use device-dependant drawing, so probably
     //      that's very fine indeed
@@ -225,7 +258,15 @@
         [image setBackgroundColor: [NSColor clearColor]];
 
         [image addRepresentation: rep];
-
+        float scaleFactor = splash->scaleFactor;
+        if (scaleFactor > 0 && scaleFactor != 1) {
+            [image setScalesWhenResized:YES];
+            NSSize size = [image size];
+            size.width /= scaleFactor;
+            size.height /= scaleFactor;
+            [image setSize: size];
+        }
+        
         NSImageView * view = [[NSImageView alloc] init];
 
         [view setImage: image];
--- a/src/macosx/native/sun/osxapp/AWT_debug.h	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/native/sun/osxapp/AWT_debug.h	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,12 +28,16 @@
 
 #import <Cocoa/Cocoa.h>
 
+bool ShouldPrintVerboseDebugging();
 
 #define kInternalError "java/lang/InternalError"
 
 #define AWT_DEBUG_LOG(str) \
     NSLog(@"\tCocoa AWT: %@ %@", str, [NSThread callStackSymbols])
 
+#define AWT_STARTUP_LOG(str) \
+    if (ShouldPrintVerboseDebugging()) AWT_DEBUG_LOG((str))
+
 #define AWT_DEBUG_BUG_REPORT_MESSAGE \
     NSLog(@"\tPlease file a bug report at http://bugreport.java.com/bugreport \
 with this message and a reproducible test case.")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/macosx/native/sun/osxapp/AWT_debug.m	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#import "AWT_debug.h"
+
+bool ShouldPrintVerboseDebugging() {
+    static int debug = -1;
+    if (debug == -1) {
+        debug = (int)(getenv("JAVA_AWT_VERBOSE") != NULL);
+    }
+    return (bool)debug;
+}
--- a/src/macosx/native/sun/osxapp/ThreadUtilities.h	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/native/sun/osxapp/ThreadUtilities.h	Fri Jul 18 08:25:58 2014 -0700
@@ -129,8 +129,6 @@
 + (JNIEnv*)getJNIEnvUncached;
 + (void)detachCurrentThread;
 + (void)setAppkitThreadGroup:(jobject)group;
-+ (void)setAWTEmbedded:(BOOL)embedded;
-+ (BOOL)isAWTEmbedded;
 
 //Wrappers for the corresponding JNFRunLoop methods with a check for main thread
 + (void)performOnMainThreadWaiting:(BOOL)wait block:(void (^)())block;
--- a/src/macosx/native/sun/osxapp/ThreadUtilities.m	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/macosx/native/sun/osxapp/ThreadUtilities.m	Fri Jul 18 08:25:58 2014 -0700
@@ -34,7 +34,6 @@
 JavaVM *jvm = NULL;
 static JNIEnv *appKitEnv = NULL;
 static jobject appkitThreadGroup = NULL;
-static BOOL awtEmbedded = NO;
 
 static inline void attachCurrentThread(void** env) {
     if ([NSThread isMainThread]) {
@@ -88,14 +87,6 @@
     }
 }
 
-+ (void)setAWTEmbedded:(BOOL)embedded {
-    awtEmbedded = embedded;
-}
-
-+ (BOOL)isAWTEmbedded {
-    return awtEmbedded;
-}
-
 @end
 
 
--- a/src/share/bin/java.c	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/bin/java.c	Fri Jul 18 08:25:58 2014 -0700
@@ -1816,20 +1816,48 @@
     const char *jar_name = getenv(SPLASH_JAR_ENV_ENTRY);
     const char *file_name = getenv(SPLASH_FILE_ENV_ENTRY);
     int data_size;
-    void *image_data;
+    void *image_data = NULL;
+    float scale_factor = 1;
+    char *scaled_splash_name = NULL;
+
+    if (file_name == NULL){
+        return;
+    }
+
+    scaled_splash_name = DoSplashGetScaledImageName(
+                        jar_name, file_name, &scale_factor);
     if (jar_name) {
-        image_data = JLI_JarUnpackFile(jar_name, file_name, &data_size);
+
+        if (scaled_splash_name) {
+            image_data = JLI_JarUnpackFile(
+                    jar_name, scaled_splash_name, &data_size);
+        }
+
+        if (!image_data) {
+            scale_factor = 1;
+            image_data = JLI_JarUnpackFile(
+                            jar_name, file_name, &data_size);
+        }
         if (image_data) {
             DoSplashInit();
+            DoSplashSetScaleFactor(scale_factor);
             DoSplashLoadMemory(image_data, data_size);
             JLI_MemFree(image_data);
         }
-    } else if (file_name) {
+    } else {
         DoSplashInit();
-        DoSplashLoadFile(file_name);
-    } else {
-        return;
+        if (scaled_splash_name) {
+            DoSplashSetScaleFactor(scale_factor);
+            DoSplashLoadFile(scaled_splash_name);
+        } else {
+            DoSplashLoadFile(file_name);
+        }
     }
+
+    if (scaled_splash_name) {
+        JLI_MemFree(scaled_splash_name);
+    }
+
     DoSplashSetFileJarName(file_name, jar_name);
 
     /*
--- a/src/share/bin/splashscreen.h	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/bin/splashscreen.h	Fri Jul 18 08:25:58 2014 -0700
@@ -29,3 +29,6 @@
 void    DoSplashInit(void);
 void    DoSplashClose(void);
 void    DoSplashSetFileJarName(const char* fileName, const char* jarName);
+void    DoSplashSetScaleFactor(float scaleFactor);
+char*   DoSplashGetScaledImageName(const char* jarName, const char* fileName,
+                                    float* scaleFactor);
--- a/src/share/bin/splashscreen_stubs.c	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/bin/splashscreen_stubs.c	Fri Jul 18 08:25:58 2014 -0700
@@ -37,6 +37,9 @@
 typedef void (*SplashClose_t)(void);
 typedef void (*SplashSetFileJarName_t)(const char* fileName,
                                        const char* jarName);
+typedef void (*SplashSetScaleFactor_t)(float scaleFactor);
+typedef char* (*SplashGetScaledImageName_t)(const char* fileName,
+                        const char* jarName, float* scaleFactor);
 
 /*
  * This macro invokes a function from the shared lib.
@@ -58,11 +61,11 @@
 #define INVOKEV(name) _INVOKE(name, ,;)
 
 int     DoSplashLoadMemory(void* pdata, int size) {
-    INVOKE(SplashLoadMemory,0)(pdata, size);
+    INVOKE(SplashLoadMemory, NULL)(pdata, size);
 }
 
 int     DoSplashLoadFile(const char* filename) {
-    INVOKE(SplashLoadFile,0)(filename);
+    INVOKE(SplashLoadFile, NULL)(filename);
 }
 
 void    DoSplashInit(void) {
@@ -76,3 +79,12 @@
 void    DoSplashSetFileJarName(const char* fileName, const char* jarName) {
     INVOKEV(SplashSetFileJarName)(fileName, jarName);
 }
+
+void    DoSplashSetScaleFactor(float scaleFactor) {
+    INVOKEV(SplashSetScaleFactor)(scaleFactor);
+}
+
+char*    DoSplashGetScaledImageName(const char* fileName, const char* jarName,
+                                    float* scaleFactor) {
+    INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/beans/introspect/ClassInfo.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.beans.introspect;
+
+import com.sun.beans.util.Cache;
+
+import java.lang.reflect.Method;
+import java.util.List;
+import java.util.Map;
+
+import static sun.reflect.misc.ReflectUtil.checkPackageAccess;
+
+public final class ClassInfo {
+    private static final ClassInfo DEFAULT = new ClassInfo(null);
+    private static final Cache<Class<?>,ClassInfo> CACHE
+            = new Cache<Class<?>,ClassInfo>(Cache.Kind.SOFT, Cache.Kind.SOFT) {
+        @Override
+        public ClassInfo create(Class<?> type) {
+            return new ClassInfo(type);
+        }
+    };
+
+    public static ClassInfo get(Class<?> type) {
+        if (type == null) {
+            return DEFAULT;
+        }
+        try {
+            checkPackageAccess(type);
+            return CACHE.get(type);
+        } catch (SecurityException exception) {
+            return DEFAULT;
+        }
+    }
+
+    private final Object mutex = new Object();
+    private final Class<?> type;
+    private List<Method> methods;
+    private Map<String,PropertyInfo> properties;
+    private Map<String,EventSetInfo> eventSets;
+
+    private ClassInfo(Class<?> type) {
+        this.type = type;
+    }
+
+    public List<Method> getMethods() {
+        if (this.methods == null) {
+            synchronized (this.mutex) {
+                if (this.methods == null) {
+                    this.methods = MethodInfo.get(this.type);
+                }
+            }
+        }
+        return this.methods;
+    }
+
+    public Map<String,PropertyInfo> getProperties() {
+        if (this.properties == null) {
+            synchronized (this.mutex) {
+                if (this.properties == null) {
+                    this.properties = PropertyInfo.get(this.type);
+                }
+            }
+        }
+        return this.properties;
+    }
+
+    public Map<String,EventSetInfo> getEventSets() {
+        if (this.eventSets == null) {
+            synchronized (this.mutex) {
+                if (this.eventSets == null) {
+                    this.eventSets = EventSetInfo.get(this.type);
+                }
+            }
+        }
+        return this.eventSets;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/beans/introspect/EventSetInfo.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.beans.introspect;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.Collections;
+import java.util.EventListener;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TooManyListenersException;
+import java.util.TreeMap;
+
+public final class EventSetInfo {
+    private MethodInfo add;
+    private MethodInfo remove;
+    private MethodInfo get;
+
+    private EventSetInfo() {
+    }
+
+    private boolean initialize() {
+        if ((this.add == null) || (this.remove == null) || (this.remove.type != this.add.type)) {
+            return false;
+        }
+        if ((this.get != null) && (this.get.type != this.add.type)) {
+            this.get = null;
+        }
+        return true;
+    }
+
+    public Class<?> getListenerType() {
+        return this.add.type;
+    }
+
+    public Method getAddMethod() {
+        return this.add.method;
+    }
+
+    public Method getRemoveMethod() {
+        return this.remove.method;
+    }
+
+    public Method getGetMethod() {
+        return (this.get == null) ? null : this.get.method;
+    }
+
+    public boolean isUnicast() {
+        // if the adder method throws the TooManyListenersException
+        // then it is an Unicast event source
+        return this.add.isThrow(TooManyListenersException.class);
+    }
+
+    private static MethodInfo getInfo(MethodInfo info, Method method, int prefix, int postfix) {
+        Class<?> type = (postfix > 0)
+                ? MethodInfo.resolve(method, method.getGenericReturnType()).getComponentType()
+                : MethodInfo.resolve(method, method.getGenericParameterTypes()[0]);
+
+        if ((type != null) && EventListener.class.isAssignableFrom(type)) {
+            String name = method.getName();
+            if (prefix + postfix < name.length()) {
+                if (type.getName().endsWith(name.substring(prefix, name.length() - postfix))) {
+                    if ((info == null) || info.type.isAssignableFrom(type)) {
+                        return new MethodInfo(method, type);
+                    }
+                }
+            }
+        }
+        return info;
+    }
+
+    private static EventSetInfo getInfo(Map<String,EventSetInfo> map, String key) {
+        EventSetInfo info = map.get(key);
+        if (info == null) {
+            info = new EventSetInfo();
+            map.put(key, info);
+        }
+        return info;
+    }
+
+    public static Map<String,EventSetInfo> get(Class<?> type) {
+        List<Method> methods = ClassInfo.get(type).getMethods();
+        if (methods.isEmpty()) {
+            return Collections.emptyMap();
+        }
+        Map<String,EventSetInfo> map = new TreeMap<>();
+        for (Method method : ClassInfo.get(type).getMethods()) {
+            if (!Modifier.isStatic(method.getModifiers())) {
+                Class<?> returnType = method.getReturnType();
+                String name = method.getName();
+                switch (method.getParameterCount()) {
+                    case 1:
+                        if ((returnType == void.class) && name.endsWith("Listener")) {
+                            if (name.startsWith("add")) {
+                                EventSetInfo info = getInfo(map, name.substring(3, name.length() - 8));
+                                info.add = getInfo(info.add, method, 3, 0);
+                            } else if (name.startsWith("remove")) {
+                                EventSetInfo info = getInfo(map, name.substring(6, name.length() - 8));
+                                info.remove = getInfo(info.remove, method, 6, 0);
+                            }
+                        }
+                        break;
+                    case 0:
+                        if (returnType.isArray() && name.startsWith("get") && name.endsWith("Listeners")) {
+                            EventSetInfo info = getInfo(map, name.substring(3, name.length() - 9));
+                            info.get = getInfo(info.get, method, 3, 1);
+                        }
+                        break;
+                }
+            }
+        }
+        Iterator<EventSetInfo> iterator = map.values().iterator();
+        while (iterator.hasNext()) {
+            if (!iterator.next().initialize()) {
+                iterator.remove();
+            }
+        }
+        return !map.isEmpty()
+                ? Collections.unmodifiableMap(map)
+                : Collections.emptyMap();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/beans/introspect/MethodInfo.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.beans.introspect;
+
+import com.sun.beans.TypeResolver;
+import com.sun.beans.finder.MethodFinder;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+final class MethodInfo {
+    final Method method;
+    final Class<?> type;
+
+    MethodInfo(Method method, Class<?> type) {
+        this.method = method;
+        this.type = type;
+    }
+
+    MethodInfo(Method method, Type type) {
+        this.method = method;
+        this.type = resolve(method, type);
+    }
+
+    boolean isThrow(Class<?> exception) {
+        for (Class<?> type : this.method.getExceptionTypes()) {
+            if (type == exception) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    static Class<?> resolve(Method method, Type type) {
+        return TypeResolver.erase(TypeResolver.resolveInClass(method.getDeclaringClass(), type));
+    }
+
+    static List<Method> get(Class<?> type) {
+        List<Method> list = null;
+        if (type != null) {
+            boolean inaccessible = !Modifier.isPublic(type.getModifiers());
+            for (Method method : type.getMethods()) {
+                if (method.getDeclaringClass().equals(type)) {
+                    if (inaccessible) {
+                        try {
+                            method = MethodFinder.findAccessibleMethod(method);
+                            if (!method.getDeclaringClass().isInterface()) {
+                                method = null; // ignore methods from superclasses
+                            }
+                        } catch (NoSuchMethodException exception) {
+                            // commented out because of 6976577
+                            // method = null; // ignore inaccessible methods
+                        }
+                    }
+                    if (method != null) {
+                        if (list == null) {
+                            list = new ArrayList<>();
+                        }
+                        list.add(method);
+                    }
+                }
+            }
+        }
+        return (list != null)
+                ? Collections.unmodifiableList(list)
+                : Collections.emptyList();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/com/sun/beans/introspect/PropertyInfo.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.beans.introspect;
+
+import java.beans.BeanProperty;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.EnumMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+import static com.sun.beans.finder.ClassFinder.findClass;
+
+public final class PropertyInfo {
+    public enum Name {bound, expert, hidden, preferred, visualUpdate, description, enumerationValues}
+
+    private static final String VETO_EXCEPTION_NAME = "java.beans.PropertyVetoException";
+    private static final Class<?> VETO_EXCEPTION;
+
+    static {
+        Class<?> type;
+        try {
+            type = Class.forName(VETO_EXCEPTION_NAME);
+        } catch (Exception exception) {
+            type = null;
+        }
+        VETO_EXCEPTION = type;
+    }
+
+    private Class<?> type;
+    private MethodInfo read;
+    private MethodInfo write;
+    private PropertyInfo indexed;
+    private List<MethodInfo> readList;
+    private List<MethodInfo> writeList;
+    private Map<Name,Object> map;
+
+    private PropertyInfo() {
+    }
+
+    private boolean initialize() {
+        if (this.read != null) {
+            this.type = this.read.type;
+        }
+        if (this.readList != null) {
+            for (MethodInfo info : this.readList) {
+                if ((this.read == null) || this.read.type.isAssignableFrom(info.type)) {
+                    this.read = info;
+                    this.type = info.type;
+                }
+            }
+            this.readList = null;
+        }
+        if (this.writeList != null) {
+            for (MethodInfo info : this.writeList) {
+                if (this.type == null) {
+                    this.write = info;
+                    this.type = info.type;
+                } else if (this.type.isAssignableFrom(info.type)) {
+                    if ((this.write == null) || this.write.type.isAssignableFrom(info.type)) {
+                        this.write = info;
+                    }
+                }
+            }
+            this.writeList = null;
+        }
+        if (this.indexed != null) {
+            if ((this.type != null) && !this.type.isArray()) {
+                this.indexed = null; // property type is not an array
+            } else if (!this.indexed.initialize()) {
+                this.indexed = null; // cannot initialize indexed methods
+            } else if ((this.type != null) && (this.indexed.type != this.type.getComponentType())) {
+                this.indexed = null; // different property types
+            } else {
+                this.map = this.indexed.map;
+                this.indexed.map = null;
+            }
+        }
+        if ((this.type == null) && (this.indexed == null)) {
+            return false;
+        }
+        initialize(this.write);
+        initialize(this.read);
+        return true;
+    }
+
+    private void initialize(MethodInfo info) {
+        if (info != null) {
+            BeanProperty annotation = info.method.getAnnotation(BeanProperty.class);
+            if (annotation != null) {
+                if (!annotation.bound()) {
+                    put(Name.bound, Boolean.FALSE);
+                }
+                put(Name.expert, annotation.expert());
+                put(Name.hidden, annotation.hidden());
+                put(Name.preferred, annotation.preferred());
+                put(Name.visualUpdate, annotation.visualUpdate());
+                put(Name.description, annotation.description());
+                String[] values = annotation.enumerationValues();
+                if (0 < values.length) {
+                    try {
+                        Object[] array = new Object[3 * values.length];
+                        int index = 0;
+                        for (String value : values) {
+                            Class<?> type = info.method.getDeclaringClass();
+                            String name = value;
+                            int pos = value.lastIndexOf('.');
+                            if (pos > 0) {
+                                name = value.substring(0, pos);
+                                if (name.indexOf('.') < 0) {
+                                    String pkg = type.getName();
+                                    name = pkg.substring(0, 1 + Math.max(
+                                            pkg.lastIndexOf('.'),
+                                            pkg.lastIndexOf('$'))) + name;
+                                }
+                                type = findClass(name);
+                                name = value.substring(pos + 1);
+                            }
+                            Field field = type.getField(name);
+                            if (Modifier.isStatic(field.getModifiers()) && info.type.isAssignableFrom(field.getType())) {
+                                array[index++] = name;
+                                array[index++] = field.get(null);
+                                array[index++] = value;
+                            }
+                        }
+                        if (index == array.length) {
+                            put(Name.enumerationValues, array);
+                        }
+                    } catch (Exception ignored) {
+                        ignored.printStackTrace();
+                    }
+                }
+            }
+        }
+    }
+
+    public Class<?> getPropertyType() {
+        return this.type;
+    }
+
+    public Method getReadMethod() {
+        return (this.read == null) ? null : this.read.method;
+    }
+
+    public Method getWriteMethod() {
+        return (this.write == null) ? null : this.write.method;
+    }
+
+    public PropertyInfo getIndexed() {
+        return this.indexed;
+    }
+
+    public boolean isConstrained() {
+        if (this.write != null) {
+            if (VETO_EXCEPTION == null) {
+                for (Class<?> type : this.write.method.getExceptionTypes()) {
+                    if (type.getName().equals(VETO_EXCEPTION_NAME)) {
+                        return true;
+                    }
+                }
+            } else if (this.write.isThrow(VETO_EXCEPTION)) {
+                return true;
+            }
+        }
+        return (this.indexed != null) && this.indexed.isConstrained();
+    }
+
+    public boolean is(Name name) {
+        Object value = get(name);
+        return (value instanceof Boolean)
+                ? (Boolean) value
+                : Name.bound.equals(name);
+    }
+
+    public Object get(Name name) {
+        return this.map == null ? null : this.map.get(name);
+    }
+
+    private void put(Name name, boolean value) {
+        if (value) {
+            put(name, Boolean.TRUE);
+        }
+    }
+
+    private void put(Name name, String value) {
+        if (0 < value.length()) {
+            put(name, (Object) value);
+        }
+    }
+
+    private void put(Name name, Object value) {
+        if (this.map == null) {
+            this.map = new EnumMap<>(Name.class);
+        }
+        this.map.put(name, value);
+    }
+
+    private static List<MethodInfo> add(List<MethodInfo> list, Method method, Type type) {
+        if (list == null) {
+            list = new ArrayList<>();
+        }
+        list.add(new MethodInfo(method, type));
+        return list;
+    }
+
+    private static boolean isPrefix(String name, String prefix) {
+        return name.length() > prefix.length() && name.startsWith(prefix);
+    }
+
+    private static PropertyInfo getInfo(Map<String,PropertyInfo> map, String key, boolean indexed) {
+        PropertyInfo info = map.get(key);
+        if (info == null) {
+            info = new PropertyInfo();
+            map.put(key, info);
+        }
+        if (!indexed) {
+            return info;
+        }
+        if (info.indexed == null) {
+            info.indexed = new PropertyInfo();
+        }
+        return info.indexed;
+    }
+
+    public static Map<String,PropertyInfo> get(Class<?> type) {
+        List<Method> methods = ClassInfo.get(type).getMethods();
+        if (methods.isEmpty()) {
+            return Collections.emptyMap();
+        }
+        Map<String,PropertyInfo> map = new TreeMap<>();
+        for (Method method : methods) {
+            if (!Modifier.isStatic(method.getModifiers())) {
+                Class<?> returnType = method.getReturnType();
+                String name = method.getName();
+                switch (method.getParameterCount()) {
+                    case 0:
+                        if (returnType.equals(boolean.class) && isPrefix(name, "is")) {
+                            PropertyInfo info = getInfo(map, name.substring(2), false);
+                            info.read = new MethodInfo(method, boolean.class);
+                        } else if (!returnType.equals(void.class) && isPrefix(name, "get")) {
+                            PropertyInfo info = getInfo(map, name.substring(3), false);
+                            info.readList = add(info.readList, method, method.getGenericReturnType());
+                        }
+                        break;
+                    case 1:
+                        if (returnType.equals(void.class) && isPrefix(name, "set")) {
+                            PropertyInfo info = getInfo(map, name.substring(3), false);
+                            info.writeList = add(info.writeList, method, method.getGenericParameterTypes()[0]);
+                        } else if (!returnType.equals(void.class) && method.getParameterTypes()[0].equals(int.class) && isPrefix(name, "get")) {
+                            PropertyInfo info = getInfo(map, name.substring(3), true);
+                            info.readList = add(info.readList, method, method.getGenericReturnType());
+                        }
+                        break;
+                    case 2:
+                        if (returnType.equals(void.class) && method.getParameterTypes()[0].equals(int.class) && isPrefix(name, "set")) {
+                            PropertyInfo info = getInfo(map, name.substring(3), true);
+                            info.writeList = add(info.writeList, method, method.getGenericParameterTypes()[1]);
+                        }
+                        break;
+                }
+            }
+        }
+        Iterator<PropertyInfo> iterator = map.values().iterator();
+        while (iterator.hasNext()) {
+            if (!iterator.next().initialize()) {
+                iterator.remove();
+            }
+        }
+        return !map.isEmpty()
+                ? Collections.unmodifiableMap(map)
+                : Collections.emptyMap();
+    }
+}
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKFileChooserUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -82,14 +82,14 @@
     private String renameFileErrorTitle = null;
     private String renameFileErrorText = null;
 
-    private JComboBox filterComboBox;
+    private JComboBox<FileFilter> filterComboBox;
     private FilterComboBoxModel filterComboBoxModel;
 
     // From Motif
 
     private JPanel rightPanel;
-    private JList directoryList;
-    private JList fileList;
+    private JList<File> directoryList;
+    private JList<File> fileList;
 
     private JLabel pathField;
     private JTextField fileNameTextField;
@@ -116,7 +116,7 @@
     private int pathLabelMnemonic = 0;
     private int filterLabelMnemonic = 0;
 
-    private JComboBox directoryComboBox;
+    private JComboBox<File> directoryComboBox;
     private DirectoryComboBoxModel directoryComboBoxModel;
     private Action directoryComboBoxAction = new DirectoryComboBoxAction();
     private JPanel bottomButtonPanel;
@@ -153,7 +153,7 @@
         }
 
         int mode = fc.getFileSelectionMode();
-        JList list = mode == JFileChooser.DIRECTORIES_ONLY ?
+        JList<File> list = mode == JFileChooser.DIRECTORIES_ONLY ?
             directoryList : fileList;
         Object[] files = list.getSelectedValues();
         int len = files.length;
@@ -369,8 +369,8 @@
     }
 
     class DoubleClickListener extends MouseAdapter {
-        JList list;
-        public  DoubleClickListener(JList list) {
+        JList<?> list;
+        public  DoubleClickListener(JList<?> list) {
             this.list = list;
         }
 
@@ -413,7 +413,7 @@
         }
     }
 
-    protected MouseListener createDoubleClickListener(JFileChooser fc, JList list) {
+    protected MouseListener createDoubleClickListener(JFileChooser fc, JList<?> list) {
         return new DoubleClickListener(list);
     }
 
@@ -423,7 +423,7 @@
         public void valueChanged(ListSelectionEvent e) {
             if (!e.getValueIsAdjusting()) {
                 JFileChooser chooser = getFileChooser();
-                JList list = (JList) e.getSource();
+                JList<?> list = (JList) e.getSource();
 
                 if (chooser.isMultiSelectionEnabled()) {
                     File[] files = null;
@@ -554,7 +554,7 @@
                                                          0, 0) {
             public void layoutContainer(Container target) {
                 super.layoutContainer(target);
-                JComboBox comboBox = directoryComboBox;
+                JComboBox<?> comboBox = directoryComboBox;
                 if (comboBox.getWidth() > target.getWidth()) {
                     comboBox.setBounds(0, comboBox.getY(), target.getWidth(),
                                        comboBox.getHeight());
@@ -565,7 +565,7 @@
         comboBoxPanel.setName("GTKFileChooser.directoryComboBoxPanel");
         // CurrentDir ComboBox
         directoryComboBoxModel = createDirectoryComboBoxModel(fc);
-        directoryComboBox = new JComboBox(directoryComboBoxModel);
+        directoryComboBox = new JComboBox<>(directoryComboBoxModel);
         directoryComboBox.setName("GTKFileChooser.directoryComboBox");
         directoryComboBox.putClientProperty( "JComboBox.lightweightKeyboardNavigation", "Lightweight" );
         directoryComboBox.addActionListener(directoryComboBoxAction);
@@ -710,7 +710,7 @@
 
         filterComboBoxModel = createFilterComboBoxModel();
         fc.addPropertyChangeListener(filterComboBoxModel);
-        filterComboBox = new JComboBox(filterComboBoxModel);
+        filterComboBox = new JComboBox<>(filterComboBoxModel);
         filterComboBox.setRenderer(createFilterComboBoxRenderer());
         filterLabel.setLabelFor(filterComboBox);
 
@@ -851,7 +851,7 @@
     }
 
     protected JScrollPane createFilesList() {
-        fileList = new JList();
+        fileList = new JList<>();
         fileList.setName("GTKFileChooser.fileList");
         fileList.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, filesLabelText);
 
@@ -877,7 +877,7 @@
     }
 
     protected JScrollPane createDirectoryList() {
-        directoryList = new JList();
+        directoryList = new JList<>();
         directoryList.setName("GTKFileChooser.directoryList");
         directoryList.putClientProperty(AccessibleContext.ACCESSIBLE_NAME_PROPERTY, foldersLabelText);
         align(directoryList);
@@ -930,7 +930,7 @@
     }
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
-    protected class GTKDirectoryListModel extends AbstractListModel implements ListDataListener {
+    protected class GTKDirectoryListModel extends AbstractListModel<File> implements ListDataListener {
         File curDir;
         public GTKDirectoryListModel() {
             getModel().addListDataListener(this);
@@ -941,7 +941,8 @@
             return getModel().getDirectories().size() + 1;
         }
 
-        public Object getElementAt(int index) {
+        @Override
+        public File getElementAt(int index) {
             return index > 0 ? getModel().getDirectories().elementAt(index - 1):
                     curDir;
         }
@@ -974,7 +975,7 @@
     }
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
-    protected class GTKFileListModel extends AbstractListModel implements ListDataListener {
+    protected class GTKFileListModel extends AbstractListModel<File> implements ListDataListener {
         public GTKFileListModel() {
             getModel().addListDataListener(this);
         }
@@ -991,7 +992,8 @@
             return getModel().getFiles().indexOf(o);
         }
 
-        public Object getElementAt(int index) {
+        @Override
+        public File getElementAt(int index) {
             return getModel().getFiles().elementAt(index);
         }
 
@@ -1019,7 +1021,7 @@
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class FileCellRenderer extends DefaultListCellRenderer  {
-        public Component getListCellRendererComponent(JList list, Object value, int index,
+        public Component getListCellRendererComponent(JList<?> list, Object value, int index,
                                                       boolean isSelected, boolean cellHasFocus) {
 
             super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -1033,7 +1035,7 @@
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class DirectoryCellRenderer extends DefaultListCellRenderer  {
-        public Component getListCellRendererComponent(JList list, Object value, int index,
+        public Component getListCellRendererComponent(JList<?> list, Object value, int index,
                                                       boolean isSelected, boolean cellHasFocus) {
 
             super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -1095,7 +1097,7 @@
      * Data model for a type-face selection combo-box.
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
-    protected class DirectoryComboBoxModel extends AbstractListModel implements ComboBoxModel {
+    protected class DirectoryComboBoxModel extends AbstractListModel<File> implements ComboBoxModel<File> {
         Vector<File> directories = new Vector<File>();
         File selectedDirectory = null;
         JFileChooser chooser = getFileChooser();
@@ -1163,7 +1165,8 @@
             return directories.size();
         }
 
-        public Object getElementAt(int index) {
+        @Override
+        public File getElementAt(int index) {
             return directories.elementAt(index);
         }
     }
@@ -1314,7 +1317,7 @@
             return name;
         }
 
-        public Component getListCellRendererComponent(JList list, Object value,
+        public Component getListCellRendererComponent(JList<?> list, Object value,
                                                       int index, boolean isSelected,
                                                       boolean cellHasFocus) {
 
@@ -1345,8 +1348,8 @@
      * Data model for filter combo-box.
      */
     @SuppressWarnings("serial") // JDK implementation class
-    protected class FilterComboBoxModel extends AbstractListModel
-            implements ComboBoxModel, PropertyChangeListener {
+    protected class FilterComboBoxModel extends AbstractListModel<FileFilter>
+            implements ComboBoxModel<FileFilter>, PropertyChangeListener {
         protected FileFilter[] filters;
 
         protected FilterComboBoxModel() {
@@ -1400,7 +1403,8 @@
             }
         }
 
-        public Object getElementAt(int index) {
+        @Override
+        public FileFilter getElementAt(int index) {
             if (index > getSize() - 1) {
                 // This shouldn't happen. Try to recover gracefully.
                 return getFileChooser().getFileFilter();
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKIconFactory.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -151,7 +151,7 @@
 
     private static class DelegatingIcon extends SynthIcon implements
                                    UIResource {
-        private static final Class[] PARAM_TYPES = new Class[] {
+        private static final Class<?>[] PARAM_TYPES = new Class<?>[] {
             SynthContext.class, Graphics.class, int.class,
             int.class, int.class, int.class, int.class
         };
@@ -190,7 +190,7 @@
             return (Method)method;
         }
 
-        protected Class[] getMethodParamTypes() {
+        protected Class<?>[] getMethodParamTypes() {
             return PARAM_TYPES;
         }
 
@@ -262,7 +262,7 @@
     // we create a unique icon per ToolBar and lookup the style for the
     // HandleBox.
     private static class ToolBarHandleIcon extends DelegatingIcon {
-        private static final Class[] PARAM_TYPES = new Class[] {
+        private static final Class<?>[] PARAM_TYPES = new Class<?>[] {
             SynthContext.class, Graphics.class, int.class,
             int.class, int.class, int.class, int.class, Orientation.class,
         };
@@ -273,7 +273,7 @@
             super(TOOL_BAR_HANDLE_ICON);
         }
 
-        protected Class[] getMethodParamTypes() {
+        protected Class<?>[] getMethodParamTypes() {
             return PARAM_TYPES;
         }
 
@@ -323,7 +323,7 @@
     }
 
     private static class MenuArrowIcon extends DelegatingIcon {
-        private static final Class[] PARAM_TYPES = new Class[] {
+        private static final Class<?>[] PARAM_TYPES = new Class<?>[] {
             SynthContext.class, Graphics.class, int.class,
             int.class, int.class, int.class, int.class, ArrowType.class,
         };
@@ -332,7 +332,7 @@
             super(MENU_ARROW_ICON);
         }
 
-        protected Class[] getMethodParamTypes() {
+        protected Class<?>[] getMethodParamTypes() {
             return PARAM_TYPES;
         }
 
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/GTKStyle.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1086,13 +1086,13 @@
 
         public Object createValue(UIDefaults table) {
             try {
-                Class c = Class.forName(className, true,Thread.currentThread().
-                                        getContextClassLoader());
+                Class<?> c = Class.forName(className, true,Thread.currentThread().
+                                           getContextClassLoader());
 
                 if (methodName == null) {
                     return c.newInstance();
                 }
-                Method m = c.getMethod(methodName, (Class[])null);
+                Method m = c.getMethod(methodName, (Class<?>[])null);
 
                 return m.invoke(c, (Object[])null);
             } catch (ClassNotFoundException cnfe) {
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/Metacity.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -764,7 +764,7 @@
             } else {
                 return;
             }
-            Map gm = getFrameGeometry();
+            Map<String, Object> gm = getFrameGeometry();
 
             int w = titlePane.getWidth();
             int h = titlePane.getHeight();
@@ -828,11 +828,11 @@
         }
     } // end TitlePaneLayout
 
-    protected Map getFrameGeometry() {
+    protected Map<String, Object> getFrameGeometry() {
         return frameGeometry;
     }
 
-    protected void setFrameGeometry(JComponent titlePane, Map gm) {
+    protected void setFrameGeometry(JComponent titlePane, Map<String, Object> gm) {
         this.frameGeometry = gm;
         if (getInt("top_height") == 0 && titlePane != null) {
             gm.put("top_height", Integer.valueOf(titlePane.getHeight()));
@@ -1501,7 +1501,7 @@
                     "name", getStringAttr(frame, "style")
                 });
                 if (frame_style != null) {
-                    Map gm = frameGeometries.get(getStringAttr(frame_style, "geometry"));
+                    Map<String, Object> gm = frameGeometries.get(getStringAttr(frame_style, "geometry"));
 
                     setFrameGeometry(titlePane, gm);
                 }
--- a/src/share/classes/com/sun/java/swing/plaf/gtk/XColors.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/gtk/XColors.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
  */
 class XColors {
 
-    private static class XColor implements Comparable {
+    private static class XColor implements Comparable<XColor> {
         String name;
 
         int red;
@@ -52,10 +52,8 @@
             return new ColorUIResource(red, green, blue);
         }
 
-        public int compareTo(Object o) {
-            XColor other = (XColor)o;
-
-            return name.compareTo(other.name);
+        public int compareTo(XColor o) {
+            return name.compareTo(o.name);
         }
     }
 
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifComboBoxUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -97,7 +97,7 @@
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class MotifComboPopup extends BasicComboPopup {
 
-        public MotifComboPopup( JComboBox comboBox ) {
+        public MotifComboPopup( JComboBox<Object> comboBox ) {
             super( comboBox );
         }
 
@@ -177,7 +177,7 @@
     }
 
     public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
-        ListCellRenderer renderer = comboBox.getRenderer();
+        ListCellRenderer<Object> renderer = comboBox.getRenderer();
         Component c;
         Dimension d;
         c = renderer.getListCellRendererComponent(listBox, comboBox.getSelectedItem(), -1, false, false);
--- a/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/motif/MotifFileChooserUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -342,7 +342,7 @@
         leftPanel.add(l);
 
         @SuppressWarnings("serial") // anonymous class
-        JComboBox tmp2 = new JComboBox<FileFilter>() {
+        JComboBox<FileFilter> tmp2 = new JComboBox<FileFilter>() {
             public Dimension getMaximumSize() {
                 Dimension d = super.getMaximumSize();
                 d.height = getPreferredSize().height;
@@ -655,7 +655,7 @@
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class FileCellRenderer extends DefaultListCellRenderer  {
-        public Component getListCellRendererComponent(JList list, Object value, int index,
+        public Component getListCellRendererComponent(JList<?> list, Object value, int index,
                                                       boolean isSelected, boolean cellHasFocus) {
 
             super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -667,7 +667,7 @@
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class DirectoryCellRenderer extends DefaultListCellRenderer  {
-        public Component getListCellRendererComponent(JList list, Object value, int index,
+        public Component getListCellRendererComponent(JList<?> list, Object value, int index,
                                                       boolean isSelected, boolean cellHasFocus) {
 
             super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
@@ -778,7 +778,7 @@
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public class FilterComboBoxRenderer extends DefaultListCellRenderer {
-        public Component getListCellRendererComponent(JList list,
+        public Component getListCellRendererComponent(JList<?> list,
             Object value, int index, boolean isSelected,
             boolean cellHasFocus) {
 
--- a/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/AnimationController.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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
@@ -130,11 +130,14 @@
                     //one second seems plausible value
                     duration = 1000;
                 } else {
-                     duration = XPStyle.getXP().getThemeTransitionDuration(
-                           c, part,
-                           normalizeState(oldState),
-                           normalizeState(newState),
-                           Prop.TRANSITIONDURATIONS);
+                    XPStyle xp = XPStyle.getXP();
+                    duration = (xp != null)
+                               ? xp.getThemeTransitionDuration(
+                                       c, part,
+                                       normalizeState(oldState),
+                                       normalizeState(newState),
+                                       Prop.TRANSITIONDURATIONS)
+                               : 1000;
                 }
                 controller.startAnimation(c, part, oldState, newState, duration);
             }
--- a/src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/DesktopProperty.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -102,7 +102,7 @@
     private static void updateAllUIs() {
         // Check if the current UI is WindowsLookAndfeel and flush the XP style map.
         // Note: Change the package test if this class is moved to a different package.
-        Class uiClass = UIManager.getLookAndFeel().getClass();
+        Class<?> uiClass = UIManager.getLookAndFeel().getClass();
         if (uiClass.getPackage().equals(DesktopProperty.class.getPackage())) {
             XPStyle.invalidateStyle();
         }
--- a/src/share/classes/com/sun/java/swing/plaf/windows/TMSchema.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/TMSchema.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 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
@@ -446,7 +446,7 @@
                 initStates();
             }
 
-            Enum[] states = stateMap.get(part);
+            Enum<?>[] states = stateMap.get(part);
             if (states != null) {
                 for (int i = 0; i < states.length; i++) {
                     if (state == states[i]) {
@@ -504,10 +504,10 @@
 
         TRANSITIONDURATIONS(Integer.class, 6000);
 
-        private final Class type;
+        private final Class<?> type;
         private final int value;
 
-        private Prop(Class type, int value) {
+        private Prop(Class<?> type, int value) {
             this.type     = type;
             this.value    = value;
         }
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsComboBoxUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -37,6 +37,7 @@
 import static com.sun.java.swing.plaf.windows.TMSchema.Part;
 import static com.sun.java.swing.plaf.windows.TMSchema.State;
 import static com.sun.java.swing.plaf.windows.XPStyle.Skin;
+
 import sun.swing.DefaultLookup;
 import sun.swing.StringUIClientPropertyKey;
 
@@ -60,7 +61,7 @@
     private static final MouseListener rolloverListener =
         new MouseAdapter() {
             private void handleRollover(MouseEvent e, boolean isRollover) {
-                JComboBox comboBox = getComboBox(e);
+                JComboBox<?> comboBox = getComboBox(e);
                 WindowsComboBoxUI comboBoxUI = getWindowsComboBoxUI(e);
                 if (comboBox == null || comboBoxUI == null) {
                     return;
@@ -88,9 +89,9 @@
                 handleRollover(e, false);
             }
 
-            private JComboBox getComboBox(MouseEvent event) {
+            private JComboBox<?> getComboBox(MouseEvent event) {
                 Object source = event.getSource();
-                JComboBox rv = null;
+                JComboBox<?> rv = null;
                 if (source instanceof JComboBox) {
                     rv = (JComboBox) source;
                 } else if (source instanceof XPComboBoxButton) {
@@ -101,7 +102,7 @@
             }
 
             private WindowsComboBoxUI getWindowsComboBoxUI(MouseEvent event) {
-                JComboBox comboBox = getComboBox(event);
+                JComboBox<?> comboBox = getComboBox(event);
                 WindowsComboBoxUI rv = null;
                 if (comboBox != null
                     && comboBox.getUI() instanceof WindowsComboBoxUI) {
@@ -122,7 +123,7 @@
                     && (source = e.getSource()) instanceof JComboBox
                     && ((JComboBox) source).getUI() instanceof
                       WindowsComboBoxUI) {
-                    JComboBox comboBox = (JComboBox) source;
+                    JComboBox<?> comboBox = (JComboBox) source;
                     WindowsComboBoxUI comboBoxUI = (WindowsComboBoxUI) comboBox.getUI();
                     if (comboBoxUI.arrowButton instanceof XPComboBoxButton) {
                         ((XPComboBoxButton) comboBoxUI.arrowButton).setPart(
@@ -231,6 +232,9 @@
 
     private void paintXPComboBoxBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         State state = getXPComboBoxState(c);
         Skin skin = null;
         if (! comboBox.isEditable()
@@ -273,7 +277,7 @@
             // color for currentValue is the same as for any other item
 
             // mostly copied from javax.swing.plaf.basic.BasicComboBoxUI.paintCurrentValue
-            ListCellRenderer renderer = comboBox.getRenderer();
+            ListCellRenderer<Object> renderer = comboBox.getRenderer();
             Component c;
             if ( hasFocus && !isPopupVisible(comboBox) ) {
                 c = renderer.getListCellRendererComponent(
@@ -384,7 +388,7 @@
      * @since 1.6
      */
     @Override
-    protected ListCellRenderer createRenderer() {
+    protected ListCellRenderer<Object> createRenderer() {
         XPStyle xp = XPStyle.getXP();
         if (xp != null && xp.isSkinDefined(comboBox, Part.CP_READONLY)) {
             return new WindowsComboBoxRenderer();
@@ -400,8 +404,9 @@
      * @return a button which represents the popup control
      */
     protected JButton createArrowButton() {
-        if (XPStyle.getXP() != null) {
-            return new XPComboBoxButton();
+        XPStyle xp = XPStyle.getXP();
+        if (xp != null) {
+            return new XPComboBoxButton(xp);
         } else {
             return super.createArrowButton();
         }
@@ -409,9 +414,9 @@
 
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     private class XPComboBoxButton extends XPStyle.GlyphButton {
-        public XPComboBoxButton() {
+        public XPComboBoxButton(XPStyle xp) {
             super(null,
-                  (! XPStyle.getXP().isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
+                  (! xp.isSkinDefined(comboBox, Part.CP_DROPDOWNBUTTONRIGHT))
                    ? Part.CP_DROPDOWNBUTTON
                    : (comboBox.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT)
                      ? Part.CP_DROPDOWNBUTTONLEFT
@@ -424,10 +429,11 @@
         protected State getState() {
             State rv;
             rv = super.getState();
+            XPStyle xp = XPStyle.getXP();
             if (rv != State.DISABLED
                 && comboBox != null && ! comboBox.isEditable()
-                && XPStyle.getXP().isSkinDefined(comboBox,
-                                                 Part.CP_DROPDOWNBUTTONRIGHT)) {
+                && xp != null && xp.isSkinDefined(comboBox,
+                                                  Part.CP_DROPDOWNBUTTONRIGHT)) {
                 /*
                  * for non editable ComboBoxes Vista seems to have the
                  * same glyph for all non DISABLED states
@@ -463,7 +469,7 @@
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     protected class WindowsComboPopup extends BasicComboPopup {
 
-        public WindowsComboPopup( JComboBox cBox ) {
+        public WindowsComboPopup( JComboBox<Object> cBox ) {
             super( cBox );
         }
 
@@ -523,7 +529,7 @@
          */
         @Override
         public Component getListCellRendererComponent(
-                                                 JList list,
+                                                 JList<?> list,
                                                  Object value,
                                                  int index,
                                                  boolean isSelected,
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -191,7 +191,7 @@
             return WindowsFileChooserUI.this.getNewFolderAction();
         }
 
-        public MouseListener createDoubleClickListener(JList list) {
+        public MouseListener createDoubleClickListener(JList<?> list) {
             return WindowsFileChooserUI.this.createDoubleClickListener(getFileChooser(),
                                                                        list);
         }
@@ -994,7 +994,7 @@
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     class DirectoryComboBoxRenderer extends DefaultListCellRenderer  {
         IndentIcon ii = new IndentIcon();
-        public Component getListCellRendererComponent(JList list, Object value,
+        public Component getListCellRendererComponent(JList<?> list, Object value,
                                                       int index, boolean isSelected,
                                                       boolean cellHasFocus) {
 
@@ -1184,7 +1184,7 @@
      */
     @SuppressWarnings("serial") // Superclass is not serializable across versions
     public class FilterComboBoxRenderer extends DefaultListCellRenderer {
-        public Component getListCellRendererComponent(JList list,
+        public Component getListCellRendererComponent(JList<?> list,
             Object value, int index, boolean isSelected,
             boolean cellHasFocus) {
 
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsGraphicsUtils.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -125,6 +125,9 @@
     static void paintXPText(AbstractButton b, Part part, State state,
             Graphics g, int x, int y, String text, int mnemIndex) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Color textColor = b.getForeground();
 
         if (textColor instanceof UIResource) {
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsIconFactory.java	Fri Jul 18 08:25:58 2014 -0700
@@ -623,8 +623,8 @@
     @SuppressWarnings("serial") // Same-version serialization only
     private static class MenuArrowIcon implements Icon, UIResource, Serializable {
         public void paintIcon(Component c, Graphics g, int x, int y) {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                XPStyle xp = XPStyle.getXP();
+            XPStyle xp = XPStyle.getXP();
+            if (WindowsMenuItemUI.isVistaPainting(xp)) {
                 State state = State.NORMAL;
                 if (c instanceof JMenuItem) {
                     state = ((JMenuItem) c).getModel().isEnabled()
@@ -657,16 +657,18 @@
             }
         }
         public int getIconWidth() {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+            XPStyle xp = XPStyle.getXP();
+            if (WindowsMenuItemUI.isVistaPainting(xp)) {
+                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getWidth();
             } else {
                 return 4;
             }
         }
         public int getIconHeight() {
-            if (WindowsMenuItemUI.isVistaPainting()) {
-                Skin skin = XPStyle.getXP().getSkin(null, Part.MP_POPUPSUBMENU);
+            XPStyle xp = XPStyle.getXP();
+            if (WindowsMenuItemUI.isVistaPainting(xp)) {
+                Skin skin = xp.getSkin(null, Part.MP_POPUPSUBMENU);
                 return skin.getHeight();
             } else {
                 return 8;
@@ -692,7 +694,8 @@
         }
 
         static int getIconWidth() {
-            return XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK).getWidth()
+            XPStyle xp = XPStyle.getXP();
+            return ((xp != null) ? xp.getSkin(null, Part.MP_POPUPCHECK).getWidth() : 16)
                 + 2 * OFFSET;
         }
 
@@ -756,12 +759,17 @@
                 Icon icon = getIcon();
                 int height = 0;
                 if (icon != null) {
-                    height = icon.getIconHeight() + 2 * OFFSET;
+                    height = icon.getIconHeight();
                 } else {
-                    Skin skin =
-                        XPStyle.getXP().getSkin(null, Part.MP_POPUPCHECK);
-                    height = skin.getHeight() + 2 * OFFSET;
+                    XPStyle xp = XPStyle.getXP();
+                    if (xp != null) {
+                        Skin skin = xp.getSkin(null, Part.MP_POPUPCHECK);
+                        height = skin.getHeight();
+                    } else {
+                        height = 16;
+                    }
                 }
+                height +=  2 * OFFSET;
                 return height;
             }
 
@@ -809,14 +817,16 @@
                                   ? State.BULLETDISABLED
                                   : State.CHECKMARKDISABLED;
                         }
-                        Skin skin;
                         XPStyle xp = XPStyle.getXP();
-                        skin =  xp.getSkin(c, backgroundPart);
-                        skin.paintSkin(g, x, y,
-                            getIconWidth(), getIconHeight(), backgroundState);
-                        if (icon == null) {
-                            skin = xp.getSkin(c, part);
-                            skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                        if (xp != null) {
+                            Skin skin;
+                            skin =  xp.getSkin(c, backgroundPart);
+                            skin.paintSkin(g, x, y,
+                                getIconWidth(), getIconHeight(), backgroundState);
+                            if (icon == null) {
+                                skin = xp.getSkin(c, part);
+                                skin.paintSkin(g, x + OFFSET, y + OFFSET, state);
+                            }
                         }
                     }
                 }
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsInternalFrameTitlePane.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 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
@@ -86,14 +86,15 @@
             }
         } else {
             buttonWidth += 2;
-            selectedTitleGradientColor =
-                    UIManager.getColor("InternalFrame.activeTitleGradient");
-            notSelectedTitleGradientColor =
-                    UIManager.getColor("InternalFrame.inactiveTitleGradient");
             Color activeBorderColor =
                     UIManager.getColor("InternalFrame.activeBorderColor");
             setBorder(BorderFactory.createLineBorder(activeBorderColor, 1));
         }
+        // JDK-8039383: initialize these colors because getXP() may return null when theme is changed
+        selectedTitleGradientColor =
+                UIManager.getColor("InternalFrame.activeTitleGradient");
+        notSelectedTitleGradientColor =
+                UIManager.getColor("InternalFrame.inactiveTitleGradient");
     }
 
     protected void uninstallListeners() {
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsLookAndFeel.java	Fri Jul 18 08:25:58 2014 -0700
@@ -2326,8 +2326,9 @@
         }
 
         public Object getXPValue(UIDefaults table) {
-            Border xpBorder = XPStyle.getXP().getBorder(null, (Part)xpValue);
-            if (extraMargin != null) {
+            XPStyle xp = XPStyle.getXP();
+            Border xpBorder = xp != null ? xp.getBorder(null, (Part)xpValue) : null;
+            if (xpBorder != null && extraMargin != null) {
                 return new BorderUIResource.
                         CompoundBorderUIResource(xpBorder, extraMargin);
             } else {
@@ -2343,7 +2344,8 @@
 
         public Object getXPValue(UIDefaults table) {
             XPColorValueKey key = (XPColorValueKey)xpValue;
-            return XPStyle.getXP().getColor(key.skin, key.prop, null);
+            XPStyle xp = XPStyle.getXP();
+            return xp != null ? xp.getColor(key.skin, key.prop, null) : null;
         }
 
         private static class XPColorValueKey {
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuBarUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -156,8 +156,8 @@
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        if (WindowsMenuItemUI.isVistaPainting()) {
-            XPStyle xp = XPStyle.getXP();
+        XPStyle xp = XPStyle.getXP();
+        if (WindowsMenuItemUI.isVistaPainting(xp)) {
             Skin skin;
             skin = xp.getSkin(c, Part.MP_BARBACKGROUND);
             int width = c.getWidth();
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsMenuItemUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -108,8 +108,9 @@
 
     static void paintBackground(WindowsMenuItemUIAccessor menuItemUI,
             Graphics g, JMenuItem menuItem, Color bgColor) {
-        assert isVistaPainting();
-        if (isVistaPainting()) {
+        XPStyle xp = XPStyle.getXP();
+        assert isVistaPainting(xp);
+        if (isVistaPainting(xp)) {
             int menuWidth = menuItem.getWidth();
             int menuHeight = menuItem.getHeight();
             if (menuItem.isOpaque()) {
@@ -118,7 +119,6 @@
                 g.fillRect(0,0, menuWidth, menuHeight);
                 g.setColor(oldColor);
             }
-            XPStyle xp = XPStyle.getXP();
             Part part = menuItemUI.getPart(menuItem);
             Skin skin = xp.getSkin(menuItem, part);
             skin.paintSkin(g, 0 , 0,
@@ -170,8 +170,11 @@
      * is it possible that in some theme some Vista parts are not defined while
      * others are?
      */
-    static boolean isVistaPainting() {
-        XPStyle xp = XPStyle.getXP();
+    static boolean isVistaPainting(final XPStyle xp) {
         return xp != null && xp.isSkinDefined(null, Part.MP_POPUPITEM);
     }
+
+    static boolean isVistaPainting() {
+        return isVistaPainting(XPStyle.getXP());
+    }
 }
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuSeparatorUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 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
@@ -50,7 +50,8 @@
 
     public void paint(Graphics g, JComponent c) {
         Dimension s = c.getSize();
-        if (WindowsMenuItemUI.isVistaPainting()) {
+        XPStyle xp = XPStyle.getXP();
+        if (WindowsMenuItemUI.isVistaPainting(xp)) {
             int x = 1;
             Component parent = c.getParent();
             if (parent instanceof JComponent) {
@@ -67,7 +68,7 @@
                     x += WindowsPopupMenuUI.getGutterWidth();
                 }
             }
-            Skin skin = XPStyle.getXP().getSkin(c, Part.MP_POPUPSEPARATOR);
+            Skin skin = xp.getSkin(c, Part.MP_POPUPSEPARATOR);
             int skinHeight = skin.getHeight();
             int y = (s.height - skinHeight) / 2;
             skin.paintSkin(g, x, y, s.width - x - 1, skinHeight, State.NORMAL);
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsPopupMenuUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -194,8 +194,8 @@
 
     @Override
     public void paint(Graphics g, JComponent c) {
-        if (WindowsMenuItemUI.isVistaPainting()) {
-            XPStyle xp = XPStyle.getXP();
+        XPStyle xp = XPStyle.getXP();
+        if (WindowsMenuItemUI.isVistaPainting(xp)) {
             Skin skin = xp.getSkin(c, Part.MP_POPUPBACKGROUND);
             skin.paintSkin(g, 0, 0, c.getWidth(),c.getHeight(), State.NORMAL);
             int textOffset = getTextOffset(c);
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsProgressBarUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -322,8 +322,9 @@
     private Rectangle getFullChunkBounds(Rectangle box) {
         boolean vertical = (progressBar.getOrientation() == JProgressBar.VERTICAL);
         XPStyle xp = XPStyle.getXP();
-        int gap = xp.getInt(progressBar, Part.PP_PROGRESS, null,
-                            Prop.PROGRESSSPACESIZE, 0);
+        int gap = (xp != null) ? xp.getInt(progressBar, Part.PP_PROGRESS,
+                                           null, Prop.PROGRESSSPACESIZE, 0)
+                               : 0;
 
         if (!vertical) {
             int chunksize = box.width+gap;
@@ -338,6 +339,9 @@
                                           boolean vertical,
                                           int bgwidth, int bgheight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
 
         // create a new graphics to keep drawing surface state
         Graphics2D gfx = (Graphics2D)g.create();
@@ -396,6 +400,9 @@
     private void paintXPBackground(Graphics g, boolean vertical,
                                    int barRectWidth, int barRectHeight) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Part part = vertical ? Part.PP_BARVERT : Part.PP_BAR;
         Skin skin = xp.getSkin(progressBar, part);
 
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSliderUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -215,7 +215,6 @@
     }
 
     private Part getXPThumbPart() {
-        XPStyle xp = XPStyle.getXP();
         Part part;
         boolean vertical = (slider.getOrientation() == JSlider.VERTICAL);
         boolean leftToRight = slider.getComponentOrientation().isLeftToRight();
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsSpinnerUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -63,6 +63,9 @@
 
     private void paintXPBackground(Graphics g, JComponent c) {
         XPStyle xp = XPStyle.getXP();
+        if (xp == null) {
+            return;
+        }
         Skin skin = xp.getSkin(c, Part.EP_EDIT);
         State state = getXPState(c);
         skin.paintSkin(g, 0, 0, c.getWidth(), c.getHeight(), state);
--- a/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/WindowsTableHeaderUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -91,9 +91,10 @@
             this.column = column;
             this.hasRollover = (column == getRolloverColumn());
             if (skin == null) {
-                skin = XPStyle.getXP().getSkin(header, Part.HP_HEADERITEM);
+                XPStyle xp = XPStyle.getXP();
+                skin = (xp != null) ? xp.getSkin(header, Part.HP_HEADERITEM) : null;
             }
-            Insets margins = skin.getContentMargin();
+            Insets margins = (skin != null) ? skin.getContentMargin() : null;
             Border border = null;
             int contentTop = 0;
             int contentLeft = 0;
--- a/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/java/swing/plaf/windows/XPStyle.java	Fri Jul 18 08:25:58 2014 -0700
@@ -115,7 +115,7 @@
                 }
             }
         }
-        return xp;
+        return ThemeReader.isXPStyleEnabled() ? xp : null;
     }
 
     static boolean isVista() {
@@ -180,9 +180,10 @@
      * should probably be cached there instead of here.
      */
     Dimension getDimension(Component c, Part part, State state, Prop prop) {
-        return ThemeReader.getPosition(part.getControlName(c), part.getValue(),
-                                       State.getValue(part, state),
-                                       prop.getValue());
+        Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
+                                              State.getValue(part, state),
+                                              prop.getValue());
+        return (d != null) ? d : new Dimension();
     }
 
     /** Get a named <code>Point</code> (e.g. a location or an offset) value
@@ -199,11 +200,7 @@
         Dimension d = ThemeReader.getPosition(part.getControlName(c), part.getValue(),
                                               State.getValue(part, state),
                                               prop.getValue());
-        if (d != null) {
-            return new Point(d.width, d.height);
-        } else {
-            return null;
-        }
+        return (d != null) ? new Point(d.width, d.height) : new Point();
     }
 
     /** Get a named <code>Insets</code> value from the current style
@@ -217,9 +214,10 @@
      * The return value is already cached in those places.
      */
     Insets getMargin(Component c, Part part, State state, Prop prop) {
-        return ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
-                                           State.getValue(part, state),
-                                           prop.getValue());
+        Insets insets = ThemeReader.getThemeMargins(part.getControlName(c), part.getValue(),
+                                                    State.getValue(part, state),
+                                                    prop.getValue());
+        return (insets != null) ? insets : new Insets(0, 0, 0, 0);
     }
 
 
@@ -349,7 +347,7 @@
             // special casing for comboboxes.
             // there may be more special cases in the future
             if(c instanceof JComboBox) {
-                JComboBox cb = (JComboBox)c;
+                JComboBox<?> cb = (JComboBox)c;
                 // note. in the future this should be replaced with a call
                 // to BasicLookAndFeel.getUIOfType()
                 if(cb.getUI() instanceof WindowsComboBoxUI) {
@@ -509,16 +507,17 @@
             int boundingWidth = 100;
             int boundingHeight = 100;
 
-            return ThemeReader.getThemeBackgroundContentMargins(
+            Insets insets = ThemeReader.getThemeBackgroundContentMargins(
                 part.getControlName(null), part.getValue(),
                 0, boundingWidth, boundingHeight);
+            return (insets != null) ? insets : new Insets(0, 0, 0, 0);
         }
 
         private int getWidth(State state) {
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return size.width;
+            return (size != null) ? size.width : 0;
         }
 
         int getWidth() {
@@ -529,7 +528,7 @@
             if (size == null) {
                 size = getPartSize(part, state);
             }
-            return size.height;
+            return (size != null) ? size.height : 0;
         }
 
         int getHeight() {
@@ -586,6 +585,9 @@
          * @param state which state to paint
          */
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             if (ThemeReader.isGetThemeTransitionDurationDefined()
                   && component instanceof JComponent
                   && SwingUtilities.getAncestorOfClass(CellRendererPane.class,
@@ -611,6 +613,9 @@
          * @param state which state to paint
          */
         void paintSkinRaw(Graphics g, int dx, int dy, int dw, int dh, State state) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             skinPainter.paint(null, g, dx, dy, dw, dh, this, state);
         }
 
@@ -629,6 +634,9 @@
          */
         void paintSkin(Graphics g, int dx, int dy, int dw, int dh, State state,
                 boolean borderFill) {
+            if (XPStyle.getXP() == null) {
+                return;
+            }
             if(borderFill && "borderfill".equals(getTypeEnumName(component, part,
                     state, Prop.BGTYPE))) {
                 return;
@@ -684,7 +692,7 @@
 
         public GlyphButton(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp.getSkin(parent, part);
+            skin = xp != null ? xp.getSkin(parent, part) : null;
             setBorder(null);
             setContentAreaFilled(false);
             setMinimumSize(new Dimension(5, 5));
@@ -709,13 +717,16 @@
         }
 
         public void paintComponent(Graphics g) {
+            if (XPStyle.getXP() == null || skin == null) {
+                return;
+            }
             Dimension d = getSize();
             skin.paintSkin(g, 0, 0, d.width, d.height, getState());
         }
 
         public void setPart(Component parent, Part part) {
             XPStyle xp = getXP();
-            skin = xp.getSkin(parent, part);
+            skin = xp != null ? xp.getSkin(parent, part) : null;
             revalidate();
             repaint();
         }
--- a/src/share/classes/com/sun/jmx/remote/security/SubjectDelegator.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/remote/security/SubjectDelegator.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -34,22 +34,14 @@
 
 import javax.management.remote.SubjectDelegationPermission;
 
-import com.sun.jmx.remote.util.CacheMap;
-import java.util.ArrayList;
-import java.util.Collection;
+import java.util.*;
 
 public class SubjectDelegator {
-    private static final int PRINCIPALS_CACHE_SIZE = 10;
-    private static final int ACC_CACHE_SIZE = 10;
-
-    private CacheMap<Subject, Principal[]> principalsCache;
-    private CacheMap<Subject, AccessControlContext> accCache;
-
     /* Return the AccessControlContext appropriate to execute an
        operation on behalf of the delegatedSubject.  If the
        authenticatedAccessControlContext does not have permission to
        delegate to that subject, throw SecurityException.  */
-    public synchronized AccessControlContext
+    public AccessControlContext
         delegatedContext(AccessControlContext authenticatedACC,
                          Subject delegatedSubject,
                          boolean removeCallerContext)
@@ -58,56 +50,14 @@
         if (System.getSecurityManager() != null && authenticatedACC == null) {
             throw new SecurityException("Illegal AccessControlContext: null");
         }
-        if (principalsCache == null || accCache == null) {
-            principalsCache =
-                    new CacheMap<>(PRINCIPALS_CACHE_SIZE);
-            accCache =
-                    new CacheMap<>(ACC_CACHE_SIZE);
-        }
-
-        // Retrieve the principals for the given
-        // delegated subject from the cache
-        //
-        Principal[] delegatedPrincipals = principalsCache.get(delegatedSubject);
-
-        // Convert the set of principals stored in the
-        // delegated subject into an array of principals
-        // and store it in the cache
-        //
-        if (delegatedPrincipals == null) {
-            delegatedPrincipals =
-                delegatedSubject.getPrincipals().toArray(new Principal[0]);
-            principalsCache.put(delegatedSubject, delegatedPrincipals);
-        }
-
-        // Retrieve the access control context for the
-        // given delegated subject from the cache
-        //
-        AccessControlContext delegatedACC = accCache.get(delegatedSubject);
-
-        // Build the access control context to be used
-        // when executing code as the delegated subject
-        // and store it in the cache
-        //
-        if (delegatedACC == null) {
-            if (removeCallerContext) {
-                delegatedACC =
-                    JMXSubjectDomainCombiner.getDomainCombinerContext(
-                                                              delegatedSubject);
-            } else {
-                delegatedACC =
-                    JMXSubjectDomainCombiner.getContext(delegatedSubject);
-            }
-            accCache.put(delegatedSubject, delegatedACC);
-        }
 
         // Check if the subject delegation permission allows the
         // authenticated subject to assume the identity of each
         // principal in the delegated subject
         //
-        final Principal[] dp = delegatedPrincipals;
-        final Collection<Permission> permissions = new ArrayList<>(dp.length);
-        for(Principal p : dp) {
+        Collection<Principal> ps = getSubjectPrincipals(delegatedSubject);
+        final Collection<Permission> permissions = new ArrayList<>(ps.size());
+        for(Principal p : ps) {
             final String pname = p.getClass().getName() + "." + p.getName();
             permissions.add(new SubjectDelegationPermission(pname));
         }
@@ -122,7 +72,15 @@
             };
         AccessController.doPrivileged(action, authenticatedACC);
 
-        return delegatedACC;
+        return getDelegatedAcc(delegatedSubject, removeCallerContext);
+    }
+
+    private AccessControlContext getDelegatedAcc(Subject delegatedSubject, boolean removeCallerContext) {
+        if (removeCallerContext) {
+            return JMXSubjectDomainCombiner.getDomainCombinerContext(delegatedSubject);
+        } else {
+            return JMXSubjectDomainCombiner.getContext(delegatedSubject);
+        }
     }
 
     /**
@@ -137,11 +95,9 @@
     public static synchronized boolean
         checkRemoveCallerContext(Subject subject) {
         try {
-            final Principal[] dp =
-                subject.getPrincipals().toArray(new Principal[0]);
-            for (int i = 0 ; i < dp.length ; i++) {
+            for (Principal p : getSubjectPrincipals(subject)) {
                 final String pname =
-                    dp[i].getClass().getName() + "." + dp[i].getName();
+                    p.getClass().getName() + "." + p.getName();
                 final Permission sdp =
                     new SubjectDelegationPermission(pname);
                 AccessController.checkPermission(sdp);
@@ -151,4 +107,19 @@
         }
         return true;
     }
+
+    /**
+     * Retrieves the {@linkplain Subject} principals
+     * @param subject The subject
+     * @return If the {@code Subject} is immutable it will return the principals directly.
+     *         If the {@code Subject} is mutable it will create an unmodifiable copy.
+     */
+    private static Collection<Principal> getSubjectPrincipals(Subject subject) {
+        if (subject.isReadOnly()) {
+            return subject.getPrincipals();
+        }
+
+        List<Principal> principals = Arrays.asList(subject.getPrincipals().toArray(new Principal[0]));
+        return Collections.unmodifiableList(principals);
+    }
 }
--- a/src/share/classes/com/sun/jmx/remote/util/CacheMap.java	Thu Jul 17 09:50:33 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.jmx.remote.util;
-
-import java.lang.ref.SoftReference;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.WeakHashMap;
-
-import com.sun.jmx.mbeanserver.Util;
-
-/**
- * <p>Like WeakHashMap, except that the keys of the <em>n</em> most
- * recently-accessed entries are kept as {@link SoftReference soft
- * references}.  Accessing an element means creating it, or retrieving
- * it with {@link #get(Object) get}.  Because these entries are kept
- * with soft references, they will tend to remain even if their keys
- * are not referenced elsewhere.  But if memory is short, they will
- * be removed.</p>
- */
-public class CacheMap<K, V> extends WeakHashMap<K, V> {
-    /**
-     * <p>Create a <code>CacheMap</code> that can keep up to
-     * <code>nSoftReferences</code> as soft references.</p>
-     *
-     * @param nSoftReferences Maximum number of keys to keep as soft
-     * references.  Access times for {@link #get(Object) get} and
-     * {@link #put(Object, Object) put} have a component that scales
-     * linearly with <code>nSoftReferences</code>, so this value
-     * should not be too great.
-     *
-     * @throws IllegalArgumentException if
-     * <code>nSoftReferences</code> is negative.
-     */
-    public CacheMap(int nSoftReferences) {
-        if (nSoftReferences < 0) {
-            throw new IllegalArgumentException("nSoftReferences = " +
-                                               nSoftReferences);
-        }
-        this.nSoftReferences = nSoftReferences;
-    }
-
-    public V put(K key, V value) {
-        cache(key);
-        return super.put(key, value);
-    }
-
-    public V get(Object key) {
-        cache(Util.<K>cast(key));
-        return super.get(key);
-    }
-
-    /* We don't override remove(Object) or try to do something with
-       the map's iterators to detect removal.  So we may keep useless
-       entries in the soft reference list for keys that have since
-       been removed.  The assumption is that entries are added to the
-       cache but never removed.  But the behavior is not wrong if
-       they are in fact removed -- the caching is just less
-       performant.  */
-
-    private void cache(K key) {
-        Iterator<SoftReference<K>> it = cache.iterator();
-        while (it.hasNext()) {
-            SoftReference<K> sref = it.next();
-            K key1 = sref.get();
-            if (key1 == null)
-                it.remove();
-            else if (key.equals(key1)) {
-                // Move this element to the head of the LRU list
-                it.remove();
-                cache.add(0, sref);
-                return;
-            }
-        }
-
-        int size = cache.size();
-        if (size == nSoftReferences) {
-            if (size == 0)
-                return;  // degenerate case, equivalent to WeakHashMap
-            it.remove();
-        }
-
-        cache.add(0, new SoftReference<K>(key));
-    }
-
-    /* List of soft references for the most-recently referenced keys.
-       The list is in most-recently-used order, i.e. the first element
-       is the most-recently referenced key.  There are never more than
-       nSoftReferences elements of this list.
-
-       If we didn't care about J2SE 1.3 compatibility, we could use
-       LinkedHashSet in conjunction with a subclass of SoftReference
-       whose equals and hashCode reflect the referent.  */
-    private final LinkedList<SoftReference<K>> cache =
-            new LinkedList<SoftReference<K>>();
-    private final int nSoftReferences;
-}
--- a/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/EnumRowStatus.java	Fri Jul 18 08:25:58 2014 -0700
@@ -284,20 +284,20 @@
     final static Hashtable<Integer, String> intTable = new Hashtable<>();
     final static Hashtable<String, Integer> stringTable = new Hashtable<>();
     static  {
-        intTable.put(new Integer(0), "unspecified");
-        intTable.put(new Integer(3), "notReady");
-        intTable.put(new Integer(6), "destroy");
-        intTable.put(new Integer(2), "notInService");
-        intTable.put(new Integer(5), "createAndWait");
-        intTable.put(new Integer(1), "active");
-        intTable.put(new Integer(4), "createAndGo");
-        stringTable.put("unspecified", new Integer(0));
-        stringTable.put("notReady", new Integer(3));
-        stringTable.put("destroy", new Integer(6));
-        stringTable.put("notInService", new Integer(2));
-        stringTable.put("createAndWait", new Integer(5));
-        stringTable.put("active", new Integer(1));
-        stringTable.put("createAndGo", new Integer(4));
+        intTable.put(0, "unspecified");
+        intTable.put(3, "notReady");
+        intTable.put(6, "destroy");
+        intTable.put(2, "notInService");
+        intTable.put(5, "createAndWait");
+        intTable.put(1, "active");
+        intTable.put(4, "createAndGo");
+        stringTable.put("unspecified", 0);
+        stringTable.put("notReady", 3);
+        stringTable.put("destroy", 6);
+        stringTable.put("notInService", 2);
+        stringTable.put("createAndWait", 5);
+        stringTable.put("active", 1);
+        stringTable.put("createAndGo", 4);
     }
 
 
--- a/src/share/classes/com/sun/jmx/snmp/Enumerated.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/Enumerated.java	Fri Jul 18 08:25:58 2014 -0700
@@ -71,7 +71,7 @@
    *            the method is illegal or inappropriate.
    */
   public Enumerated(int valueIndex) throws IllegalArgumentException {
-    if (getIntTable().get(new Integer(valueIndex)) == null) {
+    if (getIntTable().get(valueIndex) == null) {
       throw new IllegalArgumentException() ;
     }
     value = valueIndex ;
@@ -181,7 +181,7 @@
    */
   @Override
   public String toString() {
-    return getIntTable().get(new Integer(value)) ;
+    return getIntTable().get(value);
   }
 
 
--- a/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/IPAcl/JJTParserState.java	Fri Jul 18 08:25:58 2014 -0700
@@ -100,7 +100,7 @@
 
 
   void openNodeScope(Node n) {
-    marks.push(new Integer(mk));
+    marks.push(mk);
     mk = sp;
     n.jjtOpen();
   }
--- a/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/SnmpCounter64.java	Fri Jul 18 08:25:58 2014 -0700
@@ -100,7 +100,7 @@
      * @return The <CODE>Integer</CODE> representation of the value.
      */
     public Integer toInteger() {
-        return new Integer((int)value) ;
+        return (int)value;
     }
 
     /**
--- a/src/share/classes/com/sun/jmx/snmp/SnmpInt.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/SnmpInt.java	Fri Jul 18 08:25:58 2014 -0700
@@ -146,7 +146,7 @@
      * @return The <CODE>Integer</CODE> representation of the value.
      */
     public Integer toInteger() {
-        return new Integer((int)value) ;
+        return (int)value;
     }
 
     /**
--- a/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/daemon/CommunicatorServer.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1272,8 +1272,8 @@
                          message,                    // message
                          "State",                    // attribute name
                          "int",                      // attribute type
-                         new Integer(oldState),      // old value
-                         new Integer(newState) );    // new value
+                         oldState,                   // old value
+                         newState );                 // new value
         if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) {
             SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, dbgTag,
                 "sendStateChangeNotification","Sending AttributeChangeNotification #"
--- a/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/daemon/SnmpAdaptorServer.java	Fri Jul 18 08:25:58 2014 -0700
@@ -569,7 +569,7 @@
      */
     @Override
     public Integer getTrapPort() {
-        return new Integer(trapPort) ;
+        return trapPort;
     }
 
     /**
@@ -639,7 +639,7 @@
      */
     @Override
     public Integer getBufferSize() {
-        return new Integer(bufferSize) ;
+        return bufferSize;
     }
 
     /**
--- a/src/share/classes/com/sun/jmx/snmp/internal/SnmpLcd.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jmx/snmp/internal/SnmpLcd.java	Fri Jul 18 08:25:58 2014 -0700
@@ -43,15 +43,15 @@
 
         public void addModelLcd(int id,
                                 SnmpModelLcd usmlcd) {
-            models.put(new Integer(id), usmlcd);
+            models.put(id, usmlcd);
         }
 
         public SnmpModelLcd getModelLcd(int id) {
-            return models.get(new Integer(id));
+            return models.get(id);
         }
 
         public SnmpModelLcd removeModelLcd(int id) {
-            return models.remove(new Integer(id));
+            return models.remove(id);
         }
     }
 
--- a/src/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2004, 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
@@ -71,17 +71,10 @@
 
         if (orig instanceof Remote) {
             // Turn remote object into org.omg.CORBA.Object
-            try {
-                // Returns null if JRMP; let next factory try
-                // CNCtx will eventually throw IllegalArgumentException if
-                // no CORBA object gotten
-                return
-                    CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb);
-            } catch (ClassNotFoundException e) {
-                // RMI-IIOP library not available
-                throw new ConfigurationException(
-                    "javax.rmi packages not available");
-            }
+            // Returns null if JRMP; let next factory try
+            // CNCtx will eventually throw IllegalArgumentException if
+            // no CORBA object gotten
+            return CorbaUtils.remoteToCorba((Remote)orig, ((CNCtx)ctx)._orb);
         }
         return null; // pass and let next state factory try
     }
--- a/src/share/classes/com/sun/jndi/ldap/ClientId.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jndi/ldap/ClientId.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,9 +86,8 @@
             try {
                 Class<?> socketFactoryClass =
                         Obj.helper.loadClass(socketFactory);
-                Class<?> objClass = Class.forName("java.lang.Object");
                 this.sockComparator = socketFactoryClass.getMethod(
-                                "compare", new Class<?>[]{objClass, objClass});
+                                "compare", new Class<?>[]{Object.class, Object.class});
                 Method getDefault = socketFactoryClass.getMethod(
                                             "getDefault", new Class<?>[]{});
                 this.factory =
--- a/src/share/classes/com/sun/jndi/ldap/Connection.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jndi/ldap/Connection.java	Fri Jul 18 08:25:58 2014 -0700
@@ -31,6 +31,7 @@
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.InputStream;
+import java.net.InetSocketAddress;
 import java.net.Socket;
 import javax.net.ssl.SSLSocket;
 
@@ -42,11 +43,10 @@
 import javax.naming.ldap.Control;
 
 import java.lang.reflect.Method;
-import java.lang.reflect.Constructor;
 import java.lang.reflect.InvocationTargetException;
 import java.util.Arrays;
 import sun.misc.IOUtils;
-//import javax.net.SocketFactory;
+import javax.net.SocketFactory;
 
 /**
   * A thread that creates a connection to an LDAP server.
@@ -219,9 +219,7 @@
             ce.setRootCause(realException);
             throw ce;
         } catch (Exception e) {
-            // Class.forName() seems to do more error checking
-            // and will throw IllegalArgumentException and such.
-            // That's why we need to have a catch all here and
+            // We need to have a catch all here and
             // ignore generic exceptions.
             // Also catches all IO errors generated by socket creation.
             CommunicationException ce =
@@ -238,27 +236,8 @@
     /*
      * Create an InetSocketAddress using the specified hostname and port number.
      */
-    private Object createInetSocketAddress(String host, int port)
-            throws NoSuchMethodException {
-
-        try {
-            Class<?> inetSocketAddressClass =
-                Class.forName("java.net.InetSocketAddress");
-
-            Constructor<?> inetSocketAddressCons =
-                inetSocketAddressClass.getConstructor(new Class<?>[]{
-                String.class, int.class});
-
-            return inetSocketAddressCons.newInstance(new Object[]{
-                host, new Integer(port)});
-
-        } catch (ClassNotFoundException |
-                 InstantiationException |
-                 InvocationTargetException |
-                 IllegalAccessException e) {
-            throw new NoSuchMethodException();
-
-        }
+    private InetSocketAddress createInetSocketAddress(String host, int port) {
+            return new InetSocketAddress(host, port);
     }
 
     /*
@@ -279,82 +258,57 @@
 
             // create the factory
 
-            Class<?> socketFactoryClass = Obj.helper.loadClass(socketFactory);
+            @SuppressWarnings("unchecked")
+            Class<? extends SocketFactory> socketFactoryClass =
+                (Class<? extends SocketFactory>)Obj.helper.loadClass(socketFactory);
             Method getDefault =
                 socketFactoryClass.getMethod("getDefault", new Class<?>[]{});
-            Object factory = getDefault.invoke(null, new Object[]{});
+            SocketFactory factory = (SocketFactory) getDefault.invoke(null, new Object[]{});
 
             // create the socket
 
-            Method createSocket = null;
-
             if (connectTimeout > 0) {
 
-                try {
-                    createSocket = socketFactoryClass.getMethod("createSocket",
-                        new Class<?>[]{});
+                InetSocketAddress endpoint =
+                        createInetSocketAddress(host, port);
 
-                    Method connect = Socket.class.getMethod("connect",
-                        new Class<?>[]{Class.forName("java.net.SocketAddress"),
-                        int.class});
-                    Object endpoint = createInetSocketAddress(host, port);
+                // unconnected socket
+                socket = factory.createSocket();
 
-                    // unconnected socket
-                    socket =
-                        (Socket)createSocket.invoke(factory, new Object[]{});
+                if (debug) {
+                    System.err.println("Connection: creating socket with " +
+                            "a timeout using supplied socket factory");
+                }
 
-                    if (debug) {
-                        System.err.println("Connection: creating socket with " +
-                            "a timeout using supplied socket factory");
-                    }
-
-                    // connected socket
-                    connect.invoke(socket, new Object[]{
-                        endpoint, new Integer(connectTimeout)});
-
-                } catch (NoSuchMethodException e) {
-                    // continue (but ignore connectTimeout)
-                }
+                // connected socket
+                socket.connect(endpoint, connectTimeout);
             }
 
+            // continue (but ignore connectTimeout)
             if (socket == null) {
-                createSocket = socketFactoryClass.getMethod("createSocket",
-                    new Class<?>[]{String.class, int.class});
-
                 if (debug) {
                     System.err.println("Connection: creating socket using " +
                         "supplied socket factory");
                 }
                 // connected socket
-                socket = (Socket) createSocket.invoke(factory,
-                    new Object[]{host, new Integer(port)});
+                socket = factory.createSocket(host, port);
             }
         } else {
 
             if (connectTimeout > 0) {
 
-                try {
-                    Constructor<Socket> socketCons =
-                        Socket.class.getConstructor(new Class<?>[]{});
+                    InetSocketAddress endpoint = createInetSocketAddress(host, port);
 
-                    Method connect = Socket.class.getMethod("connect",
-                        new Class<?>[]{Class.forName("java.net.SocketAddress"),
-                        int.class});
-                    Object endpoint = createInetSocketAddress(host, port);
-
-                    socket = socketCons.newInstance(new Object[]{});
+                    socket = new Socket();
 
                     if (debug) {
                         System.err.println("Connection: creating socket with " +
                             "a timeout");
                     }
-                    connect.invoke(socket, new Object[]{
-                        endpoint, new Integer(connectTimeout)});
+                    socket.connect(endpoint, connectTimeout);
+            }
 
-                } catch (NoSuchMethodException e) {
-                    // continue (but ignore connectTimeout)
-                }
-            }
+            // continue (but ignore connectTimeout)
 
             if (socket == null) {
                 if (debug) {
--- a/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jndi/ldap/LdapPoolManager.java	Fri Jul 18 08:25:58 2014 -0700
@@ -406,7 +406,7 @@
                 try {
                     return Integer.getInteger(propName, defVal);
                 } catch (SecurityException e) {
-                    return new Integer(defVal);
+                    return defVal;
                 }
             }
         });
--- a/src/share/classes/com/sun/jndi/ldap/VersionHelper.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jndi/ldap/VersionHelper.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -30,32 +30,10 @@
 
 abstract class VersionHelper {
 
-    private static VersionHelper helper = null;
+    private static final VersionHelper helper = new VersionHelper12();
 
     VersionHelper() {} // Disallow anyone from creating one of these.
 
-    static {
-        try {
-            Class.forName("java.net.URLClassLoader"); // 1.2 test
-            Class.forName("java.security.PrivilegedAction"); // 1.2 test
-            helper = (VersionHelper)
-                Class.forName(
-                    "com.sun.jndi.ldap.VersionHelper12").newInstance();
-        } catch (Exception e) {
-        }
-
-        // Use 1.1 helper if 1.2 test fails, or if we cannot create 1.2 helper
-        if (helper == null) {
-            try {
-                helper = (VersionHelper)
-                    Class.forName(
-                        "com.sun.jndi.ldap.VersionHelper11").newInstance();
-            } catch (Exception e) {
-                // should never happen
-            }
-        }
-    }
-
     static VersionHelper getVersionHelper() {
         return helper;
     }
--- a/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, 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
@@ -28,16 +28,18 @@
 // Needed for RMI/IIOP
 import java.rmi.Remote;
 
-import java.lang.reflect.Method;
-import java.lang.reflect.InvocationTargetException;
+import java.rmi.RemoteException;
 import java.util.Hashtable;
 import java.util.Properties;
 import java.util.Enumeration;
+import java.applet.Applet;
 
 import org.omg.CORBA.ORB;
 
 import javax.naming.Context;
 import javax.naming.ConfigurationException;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.PortableRemoteObject;
 
 /**
   * Contains utilities for performing CORBA-related tasks:
@@ -76,71 +78,43 @@
       * @param orb       The non-null ORB to connect the remote object to
       * @return The CORBA Object for remoteObj; null if <tt>remoteObj</tt>
       *                 is a JRMP implementation or JRMP stub.
-      * @exception ClassNotFoundException The RMI-IIOP package is not available
       * @exception ConfigurationException The CORBA Object cannot be obtained
       *         because of configuration problems.
       */
     public static org.omg.CORBA.Object remoteToCorba(Remote remoteObj, ORB orb)
-        throws ClassNotFoundException, ConfigurationException {
-            synchronized (CorbaUtils.class) {
-                if (toStubMethod == null) {
-                    initMethodHandles();
-                }
-            }
+        throws ConfigurationException {
 
 // First, get remoteObj's stub
 
             // javax.rmi.CORBA.Stub stub = PortableRemoteObject.toStub(remoteObj);
 
-            java.lang.Object stub;
+            Remote stub;
 
             try {
-                stub = toStubMethod.invoke(null, new java.lang.Object[]{remoteObj});
-
-            } catch (InvocationTargetException e) {
-                Throwable realException = e.getTargetException();
-                // realException.printStackTrace();
-
+                stub = PortableRemoteObject.toStub(remoteObj);
+            } catch (Throwable t) {
                 ConfigurationException ce = new ConfigurationException(
     "Problem with PortableRemoteObject.toStub(); object not exported or stub not found");
-                ce.setRootCause(realException);
-                throw ce;
-
-            } catch (IllegalAccessException e) {
-                ConfigurationException ce = new ConfigurationException(
-    "Cannot invoke javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote)");
-
-                ce.setRootCause(e);
+                ce.setRootCause(t);
                 throw ce;
             }
 
 // Next, make sure that the stub is javax.rmi.CORBA.Stub
 
-            if (!corbaStubClass.isInstance(stub)) {
+            if (!(stub instanceof Stub)) {
                 return null;  // JRMP implementation or JRMP stub
             }
 
 // Next, make sure that the stub is connected
-            // Invoke stub.connect(orb)
             try {
-                connectMethod.invoke(stub, new java.lang.Object[]{orb});
-
-            } catch (InvocationTargetException e) {
-                Throwable realException = e.getTargetException();
-                // realException.printStackTrace();
-
-                if (!(realException instanceof java.rmi.RemoteException)) {
-                    ConfigurationException ce = new ConfigurationException(
-                        "Problem invoking javax.rmi.CORBA.Stub.connect()");
-                    ce.setRootCause(realException);
-                    throw ce;
-                }
+                ((Stub) stub).connect(orb);
+            } catch (RemoteException e) {
                 // ignore RemoteException because stub might have already
                 // been connected
-            } catch (IllegalAccessException e) {
+            } catch (Throwable t) {
                 ConfigurationException ce = new ConfigurationException(
-                    "Cannot invoke javax.rmi.CORBA.Stub.connect()");
-                ce.setRootCause(e);
+                        "Problem invoking javax.rmi.CORBA.Stub.connect()");
+                ce.setRootCause(t);
                 throw ce;
             }
 // Finally, return stub
@@ -192,83 +166,13 @@
 
         // Get Applet from environment
         if (env != null) {
-            Object applet = env.get(Context.APPLET);
+            Applet applet = (Applet) env.get(Context.APPLET);
             if (applet != null) {
-                // Create ORBs for an applet
-                return initAppletORB(applet, orbProp);
+            // Create ORBs using applet and orbProp
+                return ORB.init(applet, orbProp);
             }
         }
 
-        // Create ORBs using orbProp for a standalone application
         return ORB.init(new String[0], orbProp);
     }
-
-    /**
-     * This method returns a new ORB instance for the given applet
-     * without creating a static dependency on java.applet.
-     */
-    private static ORB initAppletORB(Object applet, Properties orbProp) {
-        try {
-            Class<?> appletClass  = Class.forName("java.applet.Applet", true, null);
-            if (!appletClass.isInstance(applet)) {
-                throw new ClassCastException(applet.getClass().getName());
-            }
-
-            // invoke the static method ORB.init(applet, orbProp);
-            Method method = ORB.class.getMethod("init", appletClass, Properties.class);
-            return (ORB) method.invoke(null, applet, orbProp);
-        } catch (ClassNotFoundException e) {
-            // java.applet.Applet doesn't exist and the applet parameter is
-            // non-null; so throw CCE
-            throw new ClassCastException(applet.getClass().getName());
-        } catch (NoSuchMethodException e) {
-            throw new AssertionError(e);
-        } catch (InvocationTargetException e) {
-            Throwable cause = e.getCause();
-            if (cause instanceof RuntimeException) {
-                throw (RuntimeException) cause;
-            } else if (cause instanceof Error) {
-                throw (Error) cause;
-            }
-            throw new AssertionError(e);
-        } catch (IllegalAccessException iae) {
-            throw new AssertionError(iae);
-        }
-    }
-
-    // Fields used for reflection of RMI-IIOP
-    private static Method toStubMethod = null;
-    private static Method connectMethod = null;
-    private static Class<?> corbaStubClass = null;
-    /**
-     * Initializes reflection method handles for RMI-IIOP.
-     * @exception ClassNotFoundException javax.rmi.CORBA.* not available
-     */
-    private static void initMethodHandles() throws ClassNotFoundException {
-        // Get javax.rmi.CORBA.Stub class
-        corbaStubClass = Class.forName("javax.rmi.CORBA.Stub");
-
-        // Get javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB) method
-
-        try {
-            connectMethod = corbaStubClass.getMethod("connect",
-                new Class<?>[] {org.omg.CORBA.ORB.class});
-        } catch (NoSuchMethodException e) {
-            throw new IllegalStateException(
-        "No method definition for javax.rmi.CORBA.Stub.connect(org.omg.CORBA.ORB)");
-        }
-
-        // Get javax.rmi.PortableRemoteObject class
-        Class<?> proClass = Class.forName("javax.rmi.PortableRemoteObject");
-
-        // Get javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote) method
-        try {
-            toStubMethod = proClass.getMethod("toStub",
-                new Class<?>[] {java.rmi.Remote.class});
-
-        } catch (NoSuchMethodException e) {
-            throw new IllegalStateException(
-"No method definition for javax.rmi.PortableRemoteObject.toStub(java.rmi.Remote)");
-        }
-    }
 }
--- a/src/share/classes/com/sun/security/sasl/CramMD5Base.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/security/sasl/CramMD5Base.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 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
@@ -32,6 +32,7 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.MessageDigest;
 
+import java.util.Arrays;
 import java.util.logging.Logger;
 
 /**
@@ -159,7 +160,7 @@
         MessageDigest md5 = MessageDigest.getInstance("MD5");
 
         /* digest the key if longer than 64 bytes */
-        if (key.length > 64) {
+        if (key.length > MD5_BLOCKSIZE) {
             key = md5.digest(key);
         }
 
@@ -169,13 +170,9 @@
         int i;
 
         /* store key in pads */
-        for (i = 0; i < MD5_BLOCKSIZE; i++) {
-            for ( ; i < key.length; i++) {
-                ipad[i] = key[i];
-                opad[i] = key[i];
-            }
-            ipad[i] = 0x00;
-            opad[i] = 0x00;
+        for (i = 0; i < key.length; i++) {
+            ipad[i] = key[i];
+            opad[i] = key[i];
         }
 
         /* XOR key with pads */
@@ -207,6 +204,11 @@
             }
         }
 
+        Arrays.fill(ipad, (byte)0);
+        Arrays.fill(opad, (byte)0);
+        ipad = null;
+        opad = null;
+
         return (digestString.toString());
     }
 
--- a/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1410,7 +1410,7 @@
             if (logger.isLoggable(Level.FINEST)) {
                 logger.log(Level.FINEST,
                     "DIGEST33:Expecting sequence num: {0}",
-                    new Integer(peerSeqNum));
+                    peerSeqNum);
                 traceOutput(DP_CLASS_NAME, "unwrap", "DIGEST34:incoming: ",
                     encryptedMsg);
             }
--- a/src/share/classes/com/sun/security/sasl/digest/DigestMD5Client.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/security/sasl/digest/DigestMD5Client.java	Fri Jul 18 08:25:58 2014 -0700
@@ -439,7 +439,7 @@
 
         if (logger.isLoggable(Level.FINE)) {
             logger.log(Level.FINE, "DIGEST61:Raw send size: {0}",
-                new Integer(rawSendSize));
+                rawSendSize);
         }
      }
 
--- a/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Client.java	Fri Jul 18 08:25:58 2014 -0700
@@ -275,9 +275,9 @@
             if (logger.isLoggable(Level.FINE)) {
                 logger.log(Level.FINE,
 "KRB5CLNT07:Client max recv size: {0}; server max recv size: {1}; rawSendSize: {2}",
-                    new Object[] {new Integer(recvMaxBufSize),
-                                  new Integer(srvMaxBufSize),
-                                  new Integer(rawSendSize)});
+                    new Object[] {recvMaxBufSize,
+                                  srvMaxBufSize,
+                                  rawSendSize});
             }
 
             // Construct negotiated security layers and client's max
--- a/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/security/sasl/gsskerb/GssKrb5Server.java	Fri Jul 18 08:25:58 2014 -0700
@@ -222,7 +222,7 @@
                 logger.log(Level.FINE,
                     "KRB5SRV06:Supported protections: {0}; recv max buf size: {1}",
                     new Object[]{allQop,
-                                 new Integer(recvMaxBufSize)});
+                                 recvMaxBufSize});
             }
 
             handshakeStage = 2;  // progress to next stage
@@ -293,9 +293,9 @@
                                  Boolean.valueOf(integrity)});
                 logger.log(Level.FINE,
 "KRB5SRV11:Client max recv size: {0}; server max send size: {1}; rawSendSize: {2}",
-                    new Object[] {new Integer(clntMaxBufSize),
-                                  new Integer(sendMaxBufSize),
-                                  new Integer(rawSendSize)});
+                    new Object[] {clntMaxBufSize,
+                                  sendMaxBufSize,
+                                  rawSendSize});
             }
 
             // Get authorization identity, if any
--- a/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/security/sasl/util/AbstractSaslImpl.java	Fri Jul 18 08:25:58 2014 -0700
@@ -286,7 +286,7 @@
 
             // Message id supplied by caller as part of traceTag
             logger.logp(lev, srcClass, srcMethod, "{0} ( {1} ): {2}",
-                new Object[] {traceTag, new Integer(origlen), content});
+                new Object[] {traceTag, origlen, content});
         } catch (Exception e) {
             logger.logp(Level.WARNING, srcClass, srcMethod,
                 "SASLIMPL09:Error generating trace output: {0}", e);
--- a/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/example/debug/gui/ContextManager.java	Fri Jul 18 08:25:58 2014 -0700
@@ -211,7 +211,7 @@
     }
 
     private void setCurrentFrameIndex(ThreadInfo tinfo, int index) {
-        tinfo.setUserObject(new Integer(index));
+        tinfo.setUserObject(index);
         //### In fact, the value may not have changed at this point.
         //### We need to signal that the user attempted to change it,
         //### however, so that the selection can be "warped" to the
--- a/src/share/classes/com/sun/tools/example/debug/tty/Commands.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/example/debug/tty/Commands.java	Fri Jul 18 08:25:58 2014 -0700
@@ -84,7 +84,7 @@
                                     MessageOutput.println("Current thread isnt suspended.");
                                 } catch (ArrayIndexOutOfBoundsException e) {
                                     MessageOutput.println("Requested stack frame is no longer active:",
-                                                          new Object []{new Integer(stackFrame)});
+                                                          new Object []{stackFrame});
                                 }
                             }
                             MessageOutput.printPrompt();
@@ -942,14 +942,14 @@
         }
         if (pc != -1) {
             MessageOutput.println("stack frame dump with pc",
-                                  new Object [] {new Integer(frameNumber + 1),
+                                  new Object [] {(frameNumber + 1),
                                                  meth.declaringType().name(),
                                                  meth.name(),
                                                  methodInfo,
                                                  Long.valueOf(pc)});
         } else {
             MessageOutput.println("stack frame dump",
-                                  new Object [] {new Integer(frameNumber + 1),
+                                  new Object [] {(frameNumber + 1),
                                                  meth.declaringType().name(),
                                                  meth.name(),
                                                  methodInfo});
@@ -2093,8 +2093,8 @@
                         VirtualMachineManager vmm) {
         MessageOutput.println("minus version",
                               new Object [] { debuggerName,
-                                              new Integer(vmm.majorInterfaceVersion()),
-                                              new Integer(vmm.minorInterfaceVersion()),
+                                              vmm.majorInterfaceVersion(),
+                                              vmm.minorInterfaceVersion(),
                                                   System.getProperty("java.version")});
         if (Env.connection() != null) {
             try {
--- a/src/share/classes/com/sun/tools/example/debug/tty/TTY.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/example/debug/tty/TTY.java	Fri Jul 18 08:25:58 2014 -0700
@@ -241,7 +241,7 @@
                 }
                 if (line != null) {
                     MessageOutput.println("source line number and line",
-                                          new Object [] {new Integer(loc.lineNumber()),
+                                          new Object [] {loc.lineNumber(),
                                                          line});
                 }
             }
--- a/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/hat/internal/model/JavaLazyReadObject.java	Fri Jul 18 08:25:58 2014 -0700
@@ -100,7 +100,7 @@
     // make Integer or Long for given object ID
     protected static Number makeId(long id) {
         if ((id & ~Snapshot.SMALL_ID_MASK) == 0) {
-            return new Integer((int)id);
+            return (int)id;
         } else {
             return id;
         }
--- a/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/hat/internal/model/Snapshot.java	Fri Jul 18 08:25:58 2014 -0700
@@ -581,7 +581,7 @@
     // Internals only below this point
     private Number makeId(long id) {
         if (identifierSize == 4) {
-            return new Integer((int)id);
+            return (int)id;
         } else {
             return id;
         }
--- a/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/hat/internal/parser/HprofReader.java	Fri Jul 18 08:25:58 2014 -0700
@@ -227,7 +227,7 @@
                     String nm = getNameFromID(classNameID).replace('/', '.');
                     classNameFromObjectID.put(classIdI, nm);
                     if (classNameFromSerialNo != null) {
-                        classNameFromSerialNo.put(new Integer(serialNo), nm);
+                        classNameFromSerialNo.put(serialNo, nm);
                     }
                     break;
                 }
@@ -297,7 +297,7 @@
                         String methodSig = getNameFromID(readID());
                         String sourceFile = getNameFromID(readID());
                         int classSer = in.readInt();
-                        String className = classNameFromSerialNo.get(new Integer(classSer));
+                        String className = classNameFromSerialNo.get(classSer);
                         int lineNumber = in.readInt();
                         if (lineNumber < StackFrame.LINE_NUMBER_NATIVE) {
                             warn("Weird stack frame line number:  " + lineNumber);
@@ -324,7 +324,7 @@
                                 throw new IOException("Stack frame " + toHex(fid) + " not found");
                             }
                         }
-                        stackTraces.put(new Integer(serialNo),
+                        stackTraces.put(serialNo,
                                         new StackTrace(frames));
                     }
                     break;
@@ -404,7 +404,7 @@
                     int threadSeq = in.readInt();
                     int stackSeq = in.readInt();
                     bytesLeft -= identifierSize + 8;
-                    threadObjects.put(new Integer(threadSeq),
+                    threadObjects.put(threadSeq,
                                       new ThreadObject(id, stackSeq));
                     break;
                 }
@@ -610,7 +610,7 @@
 
     private ThreadObject getThreadObjectFromSequence(int threadSeq)
             throws IOException {
-        ThreadObject to = threadObjects.get(new Integer(threadSeq));
+        ThreadObject to = threadObjects.get(threadSeq);
         if (to == null) {
             throw new IOException("Thread " + threadSeq +
                                   " not found for JNI local ref");
@@ -638,7 +638,7 @@
         if (stackTraces == null) {
             return null;
         }
-        StackTrace result = stackTraces.get(new Integer(ser));
+        StackTrace result = stackTraces.get(ser);
         if (result == null) {
             warn("Stack trace not found for serial # " + ser);
         }
--- a/src/share/classes/com/sun/tools/hat/internal/server/ObjectQuery.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/hat/internal/server/ObjectQuery.java	Fri Jul 18 08:25:58 2014 -0700
@@ -99,7 +99,7 @@
         final JavaField[] fields = obj.getClazz().getFieldsForInstance();
         Integer[] hack = new Integer[things.length];
         for (int i = 0; i < things.length; i++) {
-            hack[i] = new Integer(i);
+            hack[i] = i;
         }
         ArraySorter.sort(hack, new Comparer() {
             public int compare(Object lhs, Object rhs) {
--- a/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/ConcreteMethodImpl.java	Fri Jul 18 08:25:58 2014 -0700
@@ -143,7 +143,7 @@
          * Find the locations which match the line number
          * passed in.
          */
-        List<Location> list = info.lineMapper.get(new Integer(lineNumber));
+        List<Location> list = info.lineMapper.get(lineNumber);
 
         if (list == null) {
             list = new ArrayList<Location>(0);
@@ -329,7 +329,7 @@
                 lineLocations.add(loc);
 
                 // Add to the line -> locations map
-                Integer key = new Integer(lineNumber);
+                Integer key = lineNumber;
                 List<Location> mappedLocs = lineMapper.get(key);
                 if (mappedLocs == null) {
                     mappedLocs = new ArrayList<Location>(1);
@@ -399,7 +399,7 @@
                 lineLocations.add(loc);
 
                 // Add to the line -> locations map
-                Integer key = new Integer(lineNumber);
+                Integer key = lineNumber;
                 List<Location> mappedLocs = lineMapper.get(key);
                 if (mappedLocs == null) {
                     mappedLocs = new ArrayList<Location>(1);
--- a/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/com/sun/tools/jdi/ReferenceTypeImpl.java	Fri Jul 18 08:25:58 2014 -0700
@@ -529,7 +529,7 @@
          * to filter that ordered collection.
          */
         List<Method> list = allMethods();
-        list.retainAll(map.values());
+        list.retainAll(new HashSet<Method>(map.values()));
         return list;
     }
 
--- a/src/share/classes/java/awt/Component.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/awt/Component.java	Fri Jul 18 08:25:58 2014 -0700
@@ -67,7 +67,6 @@
 import sun.awt.ConstrainableGraphics;
 import sun.awt.SubRegionShowable;
 import sun.awt.SunToolkit;
-import sun.awt.WindowClosingListener;
 import sun.awt.CausedFocusEvent;
 import sun.awt.EmbeddedFrame;
 import sun.awt.dnd.SunDropTargetEvent;
@@ -544,8 +543,6 @@
     transient MouseWheelListener mouseWheelListener;
     transient InputMethodListener inputMethodListener;
 
-    transient RuntimeException windowClosingException = null;
-
     /** Internal, constants for serialization */
     final static String actionListenerK = "actionL";
     final static String adjustmentListenerK = "adjustmentL";
@@ -4959,16 +4956,6 @@
               }
               break;
 
-          case WindowEvent.WINDOW_CLOSING:
-              if (toolkit instanceof WindowClosingListener) {
-                  windowClosingException = ((WindowClosingListener)
-                                            toolkit).windowClosingNotify((WindowEvent)e);
-                  if (checkWindowClosingException()) {
-                      return;
-                  }
-              }
-              break;
-
           default:
               break;
         }
@@ -5024,21 +5011,6 @@
         }
 
         /*
-         * 8. Special handling for 4061116 : Hook for browser to close modal
-         *    dialogs.
-         */
-        if (id == WindowEvent.WINDOW_CLOSING && !e.isConsumed()) {
-            if (toolkit instanceof WindowClosingListener) {
-                windowClosingException =
-                    ((WindowClosingListener)toolkit).
-                    windowClosingDelivered((WindowEvent)e);
-                if (checkWindowClosingException()) {
-                    return;
-                }
-            }
-        }
-
-        /*
          * 9. Allow the peer to process the event.
          * Except KeyEvents, they will be processed by peer after
          * all KeyEventPostProcessors
@@ -5145,20 +5117,6 @@
         return false;
     }
 
-    boolean checkWindowClosingException() {
-        if (windowClosingException != null) {
-            if (this instanceof Dialog) {
-                ((Dialog)this).interruptBlocking();
-            } else {
-                windowClosingException.fillInStackTrace();
-                windowClosingException.printStackTrace();
-                windowClosingException = null;
-            }
-            return true;
-        }
-        return false;
-    }
-
     boolean areInputMethodsEnabled() {
         // in 1.2, we assume input method support is required for all
         // components that handle key events, but components can turn off
--- a/src/share/classes/java/awt/Container.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/awt/Container.java	Fri Jul 18 08:25:58 2014 -0700
@@ -2910,17 +2910,10 @@
             }
         }
 
-        Runnable pumpEventsForHierarchy = new Runnable() {
-            public void run() {
-                EventDispatchThread dispatchThread =
-                    (EventDispatchThread)Thread.currentThread();
-                dispatchThread.pumpEventsForHierarchy(
-                        new Conditional() {
-                        public boolean evaluate() {
-                        return ((windowClosingException == null) && (nativeContainer.modalComp != null)) ;
-                        }
-                        }, Container.this);
-            }
+        Runnable pumpEventsForHierarchy = () -> {
+            EventDispatchThread dispatchThread = (EventDispatchThread)Thread.currentThread();
+            dispatchThread.pumpEventsForHierarchy(() -> nativeContainer.modalComp != null,
+                    Container.this);
         };
 
         if (EventQueue.isDispatchThread()) {
@@ -2938,8 +2931,7 @@
                     postEvent(new PeerEvent(this,
                                 pumpEventsForHierarchy,
                                 PeerEvent.PRIORITY_EVENT));
-                while ((windowClosingException == null) &&
-                       (nativeContainer.modalComp != null))
+                while (nativeContainer.modalComp != null)
                 {
                     try {
                         getTreeLock().wait();
@@ -2949,10 +2941,6 @@
                 }
             }
         }
-        if (windowClosingException != null) {
-            windowClosingException.fillInStackTrace();
-            throw windowClosingException;
-        }
         if (predictedFocusOwner != null) {
             KeyboardFocusManager.getCurrentKeyboardFocusManager().
                 dequeueKeyEvents(time, predictedFocusOwner);
--- a/src/share/classes/java/awt/Dialog.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/awt/Dialog.java	Fri Jul 18 08:25:58 2014 -0700
@@ -40,6 +40,7 @@
 import sun.awt.util.IdentityArrayList;
 import sun.awt.util.IdentityLinkedList;
 import java.security.AccessControlException;
+import java.util.function.BooleanSupplier;
 
 /**
  * A Dialog is a top-level window with a title and a border
@@ -1044,13 +1045,6 @@
                 predictedFocusOwner = getMostRecentFocusOwner();
                 if (conditionalShow(predictedFocusOwner, time)) {
                     modalFilter = ModalEventFilter.createFilterForDialog(this);
-                    final Conditional cond = new Conditional() {
-                        @Override
-                        public boolean evaluate() {
-                            return windowClosingException == null;
-                        }
-                    };
-
                     // if this dialog is toolkit-modal, the filter should be added
                     // to all EDTs (for all AppContexts)
                     if (modalityType == ModalityType.TOOLKIT_MODAL) {
@@ -1063,10 +1057,7 @@
                             EventQueue eventQueue = (EventQueue)appContext.get(AppContext.EVENT_QUEUE_KEY);
                             // it may occur that EDT for appContext hasn't been started yet, so
                             // we post an empty invocation event to trigger EDT initialization
-                            Runnable createEDT = new Runnable() {
-                                public void run() {};
-                            };
-                            eventQueue.postEvent(new InvocationEvent(this, createEDT));
+                            eventQueue.postEvent(new InvocationEvent(this, () -> {}));
                             EventDispatchThread edt = eventQueue.getDispatchThread();
                             edt.addEventFilter(modalFilter);
                         }
@@ -1075,12 +1066,8 @@
                     modalityPushed();
                     try {
                         final EventQueue eventQueue = AccessController.doPrivileged(
-                            new PrivilegedAction<EventQueue>() {
-                                public EventQueue run() {
-                                    return Toolkit.getDefaultToolkit().getSystemEventQueue();
-                                }
-                        });
-                        secondaryLoop = eventQueue.createSecondaryLoop(cond, modalFilter, 0);
+                                (PrivilegedAction<EventQueue>) Toolkit.getDefaultToolkit()::getSystemEventQueue);
+                        secondaryLoop = eventQueue.createSecondaryLoop(() -> true, modalFilter, 0);
                         if (!secondaryLoop.enter()) {
                             secondaryLoop = null;
                         }
@@ -1102,11 +1089,6 @@
                             edt.removeEventFilter(modalFilter);
                         }
                     }
-
-                    if (windowClosingException != null) {
-                        windowClosingException.fillInStackTrace();
-                        throw windowClosingException;
-                    }
                 }
             } finally {
                 if (predictedFocusOwner != null) {
@@ -1134,16 +1116,6 @@
         }
     }
 
-    void interruptBlocking() {
-        if (isModal()) {
-            disposeImpl();
-        } else if (windowClosingException != null) {
-            windowClosingException.fillInStackTrace();
-            windowClosingException.printStackTrace();
-            windowClosingException = null;
-        }
-    }
-
     private void hideAndDisposePreHandler() {
         isInHide = true;
         synchronized (getTreeLock()) {
--- a/src/share/classes/java/awt/SplashScreen.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/awt/SplashScreen.java	Fri Jul 18 08:25:58 2014 -0700
@@ -245,7 +245,14 @@
     public Rectangle getBounds() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             checkVisible();
-            return _getBounds(splashPtr);
+            float scale = _getScaleFactor(splashPtr);
+            Rectangle bounds = _getBounds(splashPtr);
+            assert scale > 0;
+            if (scale > 0 && scale != 1) {
+                bounds.setSize((int) (bounds.getWidth() / scale),
+                        (int) (bounds.getWidth() / scale));
+            }
+            return bounds;
         }
     }
 
@@ -287,10 +294,19 @@
     public Graphics2D createGraphics() throws IllegalStateException {
         synchronized (SplashScreen.class) {
             if (image==null) {
-                Dimension dim = getSize();
-                image = new BufferedImage(dim.width, dim.height, BufferedImage.TYPE_INT_ARGB);
+                // get unscaled splash image size
+                Dimension dim = _getBounds(splashPtr).getSize();
+                image = new BufferedImage(dim.width, dim.height,
+                        BufferedImage.TYPE_INT_ARGB);
             }
-            return image.createGraphics();
+            float scale = _getScaleFactor(splashPtr);
+            Graphics2D g = image.createGraphics();
+            assert (scale > 0);
+            if (scale <= 0) {
+                scale = 1;
+            }
+            g.scale(scale, scale);
+            return g;
         }
     }
 
@@ -401,5 +417,6 @@
     private native static String _getImageFileName(long splashPtr);
     private native static String _getImageJarName(long SplashPtr);
     private native static boolean _setImageData(long SplashPtr, byte[] data);
+    private native static float _getScaleFactor(long SplashPtr);
 
 };
--- a/src/share/classes/java/beans/BeanDescriptor.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/beans/BeanDescriptor.java	Fri Jul 18 08:25:58 2014 -0700
@@ -22,10 +22,10 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package java.beans;
 
 import java.lang.ref.Reference;
+import javax.swing.SwingContainer;
 
 /**
  * A BeanDescriptor provides global information about a "bean",
@@ -69,6 +69,23 @@
             name = name.substring(name.indexOf('.')+1);
         }
         setName(name);
+
+        JavaBean annotation = beanClass.getAnnotation(JavaBean.class);
+        if (annotation != null) {
+            setPreferred(true);
+            String description = annotation.description();
+            if (!description.isEmpty()) {
+                setShortDescription(description);
+            }
+        }
+        SwingContainer container = beanClass.getAnnotation(SwingContainer.class);
+        if (container != null) {
+            setValue("isContainer", container.value());
+            String delegate = container.delegate();
+            if (!delegate.isEmpty()) {
+                setValue("containerDelegate", delegate);
+            }
+        }
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/java/beans/BeanProperty.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.beans;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.METHOD;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation used to specify some property-related information
+ * for the automatically generated {@link BeanInfo} classes.
+ * This annotation is not used if the annotated class
+ * has a corresponding user-defined {@code BeanInfo} class,
+ * which does not imply the automatic analysis.
+ *
+ * @see BeanInfo#getPropertyDescriptors
+ * @since 1.9
+ *
+ * @author Sergey A. Malenkov
+ */
+@Documented
+@Target({METHOD})
+@Retention(RUNTIME)
+public @interface BeanProperty {
+    /**
+     * The value that indicates whether the annotated property can be
+     * a {@link PropertyDescriptor#isBound bound} property or not.
+     * This value applies only to the beans that have the
+     * {@link PropertyChangeListener propertyChange} event set.
+     *
+     * @return {@code true} if the annotated property can be a bound property;
+     *         {@code false} otherwise.
+     */
+    boolean bound() default true;
+
+    /**
+     * The value that indicates whether the annotated property is
+     * an {@link PropertyDescriptor#isExpert expert} property or not.
+     *
+     * @return {@code true} if the annotated property is an expert property;
+     *         {@code false} otherwise.
+     */
+    boolean expert() default false;
+
+    /**
+     * The value that indicates whether the annotated property is
+     * a {@link PropertyDescriptor#isHidden hidden} property or not.
+     *
+     * @return {@code true} if the annotated property is a hidden property;
+     *         {@code false} otherwise.
+     */
+    boolean hidden() default false;
+
+    /**
+     * The value that indicates whether the annotated property is
+     * a {@link PropertyDescriptor#isPreferred preferred} property or not.
+     *
+     * @return {@code true} if the annotated property is a preferred property;
+     *         {@code false} otherwise.
+     */
+    boolean preferred() default false;
+
+    /**
+     * The value that indicates whether the annotated property is
+     * a required property or not.
+     *
+     * @return {@code true} if the annotated property is a required property;
+     *         {@code false} otherwise.
+     */
+    boolean required() default false;
+
+    /**
+     * The value that indicates whether the corresponding component
+     * is repainted after the annotated property got changed or not.
+     *
+     * @return {@code true} if the corresponding component is repainted;
+     *         {@code false} otherwise.
+     */
+    boolean visualUpdate() default false;
+
+    /**
+     * The {@link PropertyDescriptor#getShortDescription short description}
+     * for the {@link BeanInfo#getPropertyDescriptors descriptor}
+     * of the annotated property.
+     *
+     * @return the property description,
+     *         or an empty string if the description is not set.
+     */
+    String description() default "";
+
+    /**
+     * The array of names for the public static fields
+     * that contains the valid values of the annotated property.
+     * These names are used to generate the {@code enumerationValues}
+     * {@link java.beans.BeanDescriptor#getValue feature attribute}
+     * that must contain the following items per each property value:
+     * a displayable name for the property value, the actual property value,
+     * and a Java code piece used for the code generator.
+     *
+     * @return the names of the valid values of the annotated property,
+     *         or an empty array if the names are not provided.
+     */
+    String[] enumerationValues() default {};
+}
--- a/src/share/classes/java/beans/EventSetDescriptor.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/beans/EventSetDescriptor.java	Fri Jul 18 08:25:58 2014 -0700
@@ -22,13 +22,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package java.beans;
 
 import java.lang.ref.Reference;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
 
+import com.sun.beans.introspect.EventSetInfo;
+
 /**
  * An EventSetDescriptor describes a group of events that a given Java
  * bean fires.
@@ -255,6 +256,16 @@
         setListenerType(listenerType);
     }
 
+    EventSetDescriptor(String base, EventSetInfo info, Method... methods) {
+        setName(Introspector.decapitalize(base));
+        setListenerMethods(methods);
+        setAddListenerMethod(info.getAddMethod());
+        setRemoveListenerMethod(info.getRemoveMethod());
+        setGetListenerMethod(info.getGetMethod());
+        setListenerType(info.getListenerType());
+        setUnicast(info.isUnicast());
+    }
+
     /**
      * Creates an <TT>EventSetDescriptor</TT> from scratch using
      * <TT>java.lang.reflect.MethodDescriptor</TT> and <TT>java.lang.Class</TT>
--- a/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/beans/IndexedPropertyDescriptor.java	Fri Jul 18 08:25:58 2014 -0700
@@ -22,11 +22,13 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package java.beans;
 
 import java.lang.ref.Reference;
 import java.lang.reflect.Method;
+import java.util.Map.Entry;
+
+import com.sun.beans.introspect.PropertyInfo;
 
 /**
  * An IndexedPropertyDescriptor describes a property that acts like an
@@ -143,27 +145,21 @@
     }
 
     /**
-     * Creates <code>PropertyDescriptor</code> for the specified bean
-     * with the specified name and methods to read/write the property value.
+     * Creates {@code IndexedPropertyDescriptor} from the specified property info.
      *
-     * @param bean          the type of the target bean
-     * @param base          the base name of the property (the rest of the method name)
-     * @param read          the method used for reading the property value
-     * @param write         the method used for writing the property value
-     * @param readIndexed   the method used for reading an indexed property value
-     * @param writeIndexed  the method used for writing an indexed property value
-     * @exception IntrospectionException if an exception occurs during introspection
+     * @param entry  the key-value pair,
+     *               where the {@code key} is the base name of the property (the rest of the method name)
+     *               and the {@code value} is the automatically generated property info
+     * @param bound  the flag indicating whether it is possible to treat this property as a bound property
      *
-     * @since 1.7
+     * @since 1.9
      */
-    IndexedPropertyDescriptor(Class<?> bean, String base, Method read, Method write, Method readIndexed, Method writeIndexed) throws IntrospectionException {
-        super(bean, base, read, write);
-
-        setIndexedReadMethod0(readIndexed);
-        setIndexedWriteMethod0(writeIndexed);
-
-        // Type checking
-        setIndexedPropertyType(findIndexedPropertyType(readIndexed, writeIndexed));
+    IndexedPropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
+        super(entry, bound);
+        PropertyInfo info = entry.getValue().getIndexed();
+        setIndexedReadMethod0(info.getReadMethod());
+        setIndexedWriteMethod0(info.getWriteMethod());
+        setIndexedPropertyType(info.getPropertyType());
     }
 
     /**
--- a/src/share/classes/java/beans/Introspector.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/beans/Introspector.java	Fri Jul 18 08:25:58 2014 -0700
@@ -22,32 +22,30 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package java.beans;
 
 import com.sun.beans.TypeResolver;
 import com.sun.beans.WeakCache;
 import com.sun.beans.finder.ClassFinder;
-import com.sun.beans.finder.MethodFinder;
+import com.sun.beans.introspect.ClassInfo;
+import com.sun.beans.introspect.EventSetInfo;
+import com.sun.beans.introspect.PropertyInfo;
 
 import java.awt.Component;
 
 import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
 import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
 import java.lang.reflect.Type;
 
 import java.util.Map;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.EventListener;
 import java.util.EventObject;
 import java.util.List;
 import java.util.TreeMap;
 
-import sun.misc.JavaBeansIntrospectorAccess;
 import sun.misc.SharedSecrets;
 import sun.reflect.misc.ReflectUtil;
 
@@ -122,7 +120,6 @@
     private BeanInfo additionalBeanInfo[];
 
     private boolean propertyChangeSource = false;
-    private static Class<EventListener> eventListenerType = EventListener.class;
 
     // These should be removed.
     private String defaultEventName;
@@ -501,78 +498,15 @@
             addPropertyDescriptors(explicitProperties);
 
         } else {
-
             // Apply some reflection to the current class.
-
-            // First get an array of all the public methods at this level
-            Method methodList[] = getPublicDeclaredMethods(beanClass);
-
-            // Now analyze each method.
-            for (int i = 0; i < methodList.length; i++) {
-                Method method = methodList[i];
-                if (method == null) {
-                    continue;
-                }
-                // skip static methods.
-                int mods = method.getModifiers();
-                if (Modifier.isStatic(mods)) {
-                    continue;
-                }
-                String name = method.getName();
-                Class<?>[] argTypes = method.getParameterTypes();
-                Class<?> resultType = method.getReturnType();
-                int argCount = argTypes.length;
-                PropertyDescriptor pd = null;
-
-                if (name.length() <= 3 && !name.startsWith(IS_PREFIX)) {
-                    // Optimization. Don't bother with invalid propertyNames.
-                    continue;
-                }
-
-                try {
-
-                    if (argCount == 0) {
-                        if (name.startsWith(GET_PREFIX)) {
-                            // Simple getter
-                            pd = new PropertyDescriptor(this.beanClass, name.substring(3), method, null);
-                        } else if (resultType == boolean.class && name.startsWith(IS_PREFIX)) {
-                            // Boolean getter
-                            pd = new PropertyDescriptor(this.beanClass, name.substring(2), method, null);
-                        }
-                    } else if (argCount == 1) {
-                        if (int.class.equals(argTypes[0]) && name.startsWith(GET_PREFIX)) {
-                            pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, method, null);
-                        } else if (void.class.equals(resultType) && name.startsWith(SET_PREFIX)) {
-                            // Simple setter
-                            pd = new PropertyDescriptor(this.beanClass, name.substring(3), null, method);
-                            if (throwsException(method, PropertyVetoException.class)) {
-                                pd.setConstrained(true);
-                            }
-                        }
-                    } else if (argCount == 2) {
-                            if (void.class.equals(resultType) && int.class.equals(argTypes[0]) && name.startsWith(SET_PREFIX)) {
-                            pd = new IndexedPropertyDescriptor(this.beanClass, name.substring(3), null, null, null, method);
-                            if (throwsException(method, PropertyVetoException.class)) {
-                                pd.setConstrained(true);
-                            }
-                        }
-                    }
-                } catch (IntrospectionException ex) {
-                    // This happens if a PropertyDescriptor or IndexedPropertyDescriptor
-                    // constructor fins that the method violates details of the deisgn
-                    // pattern, e.g. by having an empty name, or a getter returning
-                    // void , or whatever.
-                    pd = null;
-                }
-
-                if (pd != null) {
-                    // If this class or one of its base classes is a PropertyChange
-                    // source, then we assume that any properties we discover are "bound".
-                    if (propertyChangeSource) {
-                        pd.setBound(true);
-                    }
-                    addPropertyDescriptor(pd);
-                }
+            for (Map.Entry<String,PropertyInfo> entry : ClassInfo.get(this.beanClass).getProperties().entrySet()) {
+                addPropertyDescriptor(null != entry.getValue().getIndexed()
+                        ? new IndexedPropertyDescriptor(entry, this.propertyChangeSource)
+                        : new PropertyDescriptor(entry, this.propertyChangeSource));
+            }
+            JavaBean annotation = this.beanClass.getAnnotation(JavaBean.class);
+            if ((annotation != null) && !annotation.defaultProperty().isEmpty()) {
+                this.defaultPropertyName = annotation.defaultProperty();
             }
         }
         processPropertyDescriptors();
@@ -589,7 +523,6 @@
                 }
             }
         }
-
         return result;
     }
 
@@ -1003,143 +936,24 @@
             }
 
         } else {
-
             // Apply some reflection to the current class.
-
-            // Get an array of all the public beans methods at this level
-            Method methodList[] = getPublicDeclaredMethods(beanClass);
-
-            // Find all suitable "add", "remove" and "get" Listener methods
-            // The name of the listener type is the key for these hashtables
-            // i.e, ActionListener
-            Map<String, Method> adds = null;
-            Map<String, Method> removes = null;
-            Map<String, Method> gets = null;
-
-            for (int i = 0; i < methodList.length; i++) {
-                Method method = methodList[i];
-                if (method == null) {
-                    continue;
-                }
-                // skip static methods.
-                int mods = method.getModifiers();
-                if (Modifier.isStatic(mods)) {
-                    continue;
-                }
-                String name = method.getName();
-                // Optimization avoid getParameterTypes
-                if (!name.startsWith(ADD_PREFIX) && !name.startsWith(REMOVE_PREFIX)
-                    && !name.startsWith(GET_PREFIX)) {
-                    continue;
-                }
-
-                if (name.startsWith(ADD_PREFIX)) {
-                    Class<?> returnType = method.getReturnType();
-                    if (returnType == void.class) {
-                        Type[] parameterTypes = method.getGenericParameterTypes();
-                        if (parameterTypes.length == 1) {
-                            Class<?> type = TypeResolver.erase(TypeResolver.resolveInClass(beanClass, parameterTypes[0]));
-                            if (Introspector.isSubclass(type, eventListenerType)) {
-                                String listenerName = name.substring(3);
-                                if (listenerName.length() > 0 &&
-                                    type.getName().endsWith(listenerName)) {
-                                    if (adds == null) {
-                                        adds = new HashMap<>();
-                                    }
-                                    adds.put(listenerName, method);
-                                }
-                            }
-                        }
+            for (Map.Entry<String,EventSetInfo> entry : ClassInfo.get(this.beanClass).getEventSets().entrySet()) {
+                    // generate a list of Method objects for each of the target methods:
+                List<Method> methods = new ArrayList<>();
+                for (Method method : ClassInfo.get(entry.getValue().getListenerType()).getMethods()) {
+                    if (isEventHandler(method)) {
+                        methods.add(method);
                     }
                 }
-                else if (name.startsWith(REMOVE_PREFIX)) {
-                    Class<?> returnType = method.getReturnType();
-                    if (returnType == void.class) {
-                        Type[] parameterTypes = method.getGenericParameterTypes();
-                        if (parameterTypes.length == 1) {
-                            Class<?> type = TypeResolver.erase(TypeResolver.resolveInClass(beanClass, parameterTypes[0]));
-                            if (Introspector.isSubclass(type, eventListenerType)) {
-                                String listenerName = name.substring(6);
-                                if (listenerName.length() > 0 &&
-                                    type.getName().endsWith(listenerName)) {
-                                    if (removes == null) {
-                                        removes = new HashMap<>();
-                                    }
-                                    removes.put(listenerName, method);
-                                }
-                            }
-                        }
-                    }
-                }
-                else if (name.startsWith(GET_PREFIX)) {
-                    Class<?>[] parameterTypes = method.getParameterTypes();
-                    if (parameterTypes.length == 0) {
-                        Class<?> returnType = FeatureDescriptor.getReturnType(beanClass, method);
-                        if (returnType.isArray()) {
-                            Class<?> type = returnType.getComponentType();
-                            if (Introspector.isSubclass(type, eventListenerType)) {
-                                String listenerName  = name.substring(3, name.length() - 1);
-                                if (listenerName.length() > 0 &&
-                                    type.getName().endsWith(listenerName)) {
-                                    if (gets == null) {
-                                        gets = new HashMap<>();
-                                    }
-                                    gets.put(listenerName, method);
-                                }
-                            }
-                        }
-                    }
-                }
+                addEvent(new EventSetDescriptor(
+                        entry.getKey(),
+                        entry.getValue(),
+                        methods.toArray(new Method[methods.size()])));
             }
-
-            if (adds != null && removes != null) {
-                // Now look for matching addFooListener+removeFooListener pairs.
-                // Bonus if there is a matching getFooListeners method as well.
-                Iterator<String> keys = adds.keySet().iterator();
-                while (keys.hasNext()) {
-                    String listenerName = keys.next();
-                    // Skip any "add" which doesn't have a matching "remove" or
-                    // a listener name that doesn't end with Listener
-                    if (removes.get(listenerName) == null || !listenerName.endsWith("Listener")) {
-                        continue;
-                    }
-                    String eventName = decapitalize(listenerName.substring(0, listenerName.length()-8));
-                    Method addMethod = adds.get(listenerName);
-                    Method removeMethod = removes.get(listenerName);
-                    Method getMethod = null;
-                    if (gets != null) {
-                        getMethod = gets.get(listenerName);
-                    }
-                    Class<?> argType = FeatureDescriptor.getParameterTypes(beanClass, addMethod)[0];
-
-                    // generate a list of Method objects for each of the target methods:
-                    Method allMethods[] = getPublicDeclaredMethods(argType);
-                    List<Method> validMethods = new ArrayList<>(allMethods.length);
-                    for (int i = 0; i < allMethods.length; i++) {
-                        if (allMethods[i] == null) {
-                            continue;
-                        }
-
-                        if (isEventHandler(allMethods[i])) {
-                            validMethods.add(allMethods[i]);
-                        }
-                    }
-                    Method[] methods = validMethods.toArray(new Method[validMethods.size()]);
-
-                    EventSetDescriptor esd = new EventSetDescriptor(eventName, argType,
-                                                                    methods, addMethod,
-                                                                    removeMethod,
-                                                                    getMethod);
-
-                    // If the adder method throws the TooManyListenersException then it
-                    // is a Unicast event source.
-                    if (throwsException(addMethod,
-                                        java.util.TooManyListenersException.class)) {
-                        esd.setUnicast(true);
-                    }
-                    addEvent(esd);
-                }
-            } // if (adds != null ...
+            JavaBean annotation = this.beanClass.getAnnotation(JavaBean.class);
+            if ((annotation != null) && !annotation.defaultEventSet().isEmpty()) {
+                this.defaultEventName = annotation.defaultEventSet();
+            }
         }
         EventSetDescriptor[] result;
         if (events.size() == 0) {
@@ -1148,7 +962,6 @@
             // Allocate and populate the result array.
             result = new EventSetDescriptor[events.size()];
             result = events.values().toArray(result);
-
             // Set the default index.
             if (defaultEventName != null) {
                 for (int i = 0; i < result.length; i++) {
@@ -1215,20 +1028,9 @@
             }
 
         } else {
-
             // Apply some reflection to the current class.
-
-            // First get an array of all the beans methods at this level
-            Method methodList[] = getPublicDeclaredMethods(beanClass);
-
-            // Now analyze each method.
-            for (int i = 0; i < methodList.length; i++) {
-                Method method = methodList[i];
-                if (method == null) {
-                    continue;
-                }
-                MethodDescriptor md = new MethodDescriptor(method);
-                addMethod(md);
+            for (Method method : ClassInfo.get(this.beanClass).getMethods()) {
+                addMethod(new MethodDescriptor(method));
             }
         }
 
@@ -1346,44 +1148,6 @@
         return isSubclass(TypeResolver.erase(TypeResolver.resolveInClass(beanClass, argTypes[0])), EventObject.class);
     }
 
-    /*
-     * Internal method to return *public* methods within a class.
-     */
-    private static Method[] getPublicDeclaredMethods(Class<?> clz) {
-        // Looking up Class.getDeclaredMethods is relatively expensive,
-        // so we cache the results.
-        if (!ReflectUtil.isPackageAccessible(clz)) {
-            return new Method[0];
-        }
-        synchronized (declaredMethodCache) {
-            Method[] result = declaredMethodCache.get(clz);
-            if (result == null) {
-                result = clz.getMethods();
-                for (int i = 0; i < result.length; i++) {
-                    Method method = result[i];
-                    if (!method.getDeclaringClass().equals(clz)) {
-                        result[i] = null; // ignore methods declared elsewhere
-                    }
-                    else {
-                        try {
-                            method = MethodFinder.findAccessibleMethod(method);
-                            Class<?> type = method.getDeclaringClass();
-                            result[i] = type.equals(clz) || type.isInterface()
-                                    ? method
-                                    : null; // ignore methods from superclasses
-                        }
-                        catch (NoSuchMethodException exception) {
-                            // commented out because of 6976577
-                            // result[i] = null; // ignore inaccessible methods
-                        }
-                    }
-                }
-                declaredMethodCache.put(clz, result);
-            }
-            return result;
-        }
-    }
-
     //======================================================================
     // Package private support methods.
     //======================================================================
@@ -1396,17 +1160,8 @@
                                                  int argCount, Class<?> args[]) {
         // For overriden methods we need to find the most derived version.
         // So we start with the given class and walk up the superclass chain.
-
-        Method method = null;
-
         for (Class<?> cl = start; cl != null; cl = cl.getSuperclass()) {
-            Method methods[] = getPublicDeclaredMethods(cl);
-            for (int i = 0; i < methods.length; i++) {
-                method = methods[i];
-                if (method == null) {
-                    continue;
-                }
-
+            for (Method method : ClassInfo.get(cl).getMethods()) {
                 // make sure method signature matches.
                 if (method.getName().equals(methodName)) {
                     Type[] params = method.getGenericParameterTypes();
@@ -1430,8 +1185,6 @@
                 }
             }
         }
-        method = null;
-
         // Now check any inherited interfaces.  This is necessary both when
         // the argument class is itself an interface, and when the argument
         // class is an abstract class.
@@ -1440,12 +1193,12 @@
             // Note: The original implementation had both methods calling
             // the 3 arg method. This is preserved but perhaps it should
             // pass the args array instead of null.
-            method = internalFindMethod(ifcs[i], methodName, argCount, null);
+            Method method = internalFindMethod(ifcs[i], methodName, argCount, null);
             if (method != null) {
-                break;
+                return method;
             }
         }
-        return method;
+        return null;
     }
 
     /**
@@ -1508,19 +1261,6 @@
     }
 
     /**
-     * Return true iff the given method throws the given exception.
-     */
-    private boolean throwsException(Method method, Class<?> exception) {
-        Class<?>[] exs = method.getExceptionTypes();
-        for (int i = 0; i < exs.length; i++) {
-            if (exs[i] == exception) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
      * Try to create an instance of a named class.
      * First try the classloader of "sibling", then try the system
      * classloader then the class loader of the current Thread.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/java/beans/JavaBean.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.beans;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation used to specify some class-related information
+ * for the automatically generated {@link BeanInfo} classes.
+ * This annotation is not used if the annotated class
+ * has a corresponding user-defined {@code BeanInfo} class,
+ * which does not imply the automatic analysis.
+ *
+ * @see BeanInfo#getBeanDescriptor
+ * @since 1.9
+ *
+ * @author Sergey A. Malenkov
+ */
+@Documented
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface JavaBean {
+    /**
+     * The {@link BeanDescriptor#getShortDescription short description}
+     * for the {@link BeanInfo#getBeanDescriptor bean descriptor}
+     * of the annotated class.
+     *
+     * @return the bean description,
+     *         or an empty string if the description is not set.
+     */
+    String description() default "";
+
+    /**
+     * The name of the default property is used to calculate its
+     * {@link BeanInfo#getDefaultPropertyIndex index} in the
+     * {@link BeanInfo#getPropertyDescriptors array} of properties
+     * defined in the annotated class. If the name is not set or
+     * the annotated class does not define a property
+     * with the specified name, the default property index
+     * will be calculated automatically by the
+     * {@link Introspector} depending on its state.
+     *
+     * @return the name of the default property,
+     *         or an empty string if the name is not set.
+     */
+    String defaultProperty() default "";
+
+    /**
+     * The name of the default event set is used to calculate its
+     * {@link BeanInfo#getDefaultEventIndex index} in the
+     * {@link BeanInfo#getEventSetDescriptors array} of event sets
+     * defined in the annotated class. If the name is not set or
+     * the annotated class does not define an event set
+     * with the specified name, the default event set index
+     * will be calculated automatically by the
+     * {@link Introspector} depending on its state.
+     *
+     * @return the name of the default event set,
+     *         or an empty string if the name is not set.
+     */
+    String defaultEventSet() default "";
+}
--- a/src/share/classes/java/beans/PropertyDescriptor.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/beans/PropertyDescriptor.java	Fri Jul 18 08:25:58 2014 -0700
@@ -22,12 +22,14 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package java.beans;
 
 import java.lang.ref.Reference;
 import java.lang.reflect.Method;
 import java.lang.reflect.Constructor;
+import java.util.Map.Entry;
+
+import com.sun.beans.introspect.PropertyInfo;
 
 /**
  * A PropertyDescriptor describes one property that a Java Bean
@@ -140,25 +142,47 @@
     }
 
     /**
-     * Creates <code>PropertyDescriptor</code> for the specified bean
-     * with the specified name and methods to read/write the property value.
+     * Creates {@code PropertyDescriptor} from the specified property info.
      *
-     * @param bean   the type of the target bean
-     * @param base   the base name of the property (the rest of the method name)
-     * @param read   the method used for reading the property value
-     * @param write  the method used for writing the property value
-     * @exception IntrospectionException if an exception occurs during introspection
+     * @param entry  the pair of values,
+     *               where the {@code key} is the base name of the property (the rest of the method name)
+     *               and the {@code value} is the automatically generated property info
+     * @param bound  the flag indicating whether it is possible to treat this property as a bound property
      *
-     * @since 1.7
+     * @since 1.9
      */
-    PropertyDescriptor(Class<?> bean, String base, Method read, Method write) throws IntrospectionException {
-        if (bean == null) {
-            throw new IntrospectionException("Target Bean class is null");
+    PropertyDescriptor(Entry<String,PropertyInfo> entry, boolean bound) {
+        String base = entry.getKey();
+        PropertyInfo info = entry.getValue();
+        setName(Introspector.decapitalize(base));
+        setReadMethod0(info.getReadMethod());
+        setWriteMethod0(info.getWriteMethod());
+        setPropertyType(info.getPropertyType());
+        setConstrained(info.isConstrained());
+        setBound(bound && info.is(PropertyInfo.Name.bound));
+        if (info.is(PropertyInfo.Name.expert)) {
+            setValue(PropertyInfo.Name.expert.name(), Boolean.TRUE); // compatibility
+            setExpert(true);
         }
-        setClass0(bean);
-        setName(Introspector.decapitalize(base));
-        setReadMethod(read);
-        setWriteMethod(write);
+        if (info.is(PropertyInfo.Name.hidden)) {
+            setValue(PropertyInfo.Name.hidden.name(), Boolean.TRUE); // compatibility
+            setHidden(true);
+        }
+        if (info.is(PropertyInfo.Name.preferred)) {
+            setPreferred(true);
+        }
+        Object visual = info.get(PropertyInfo.Name.visualUpdate);
+        if (visual != null) {
+            setValue(PropertyInfo.Name.visualUpdate.name(), visual);
+        }
+        Object description = info.get(PropertyInfo.Name.description);
+        if (description != null) {
+            setShortDescription(description.toString());
+        }
+        Object values = info.get(PropertyInfo.Name.enumerationValues);
+        if (values != null) {
+            setValue(PropertyInfo.Name.enumerationValues.name(), values);
+        }
         this.baseName = base;
     }
 
@@ -249,13 +273,17 @@
      */
     public synchronized void setReadMethod(Method readMethod)
                                 throws IntrospectionException {
+        // The property type is determined by the read method.
+        setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get()));
+        setReadMethod0(readMethod);
+    }
+
+    private void setReadMethod0(Method readMethod) {
         this.readMethodRef.set(readMethod);
         if (readMethod == null) {
             readMethodName = null;
             return;
         }
-        // The property type is determined by the read method.
-        setPropertyType(findPropertyType(readMethod, this.writeMethodRef.get()));
         setClass0(readMethod.getDeclaringClass());
 
         readMethodName = readMethod.getName();
@@ -320,13 +348,17 @@
      */
     public synchronized void setWriteMethod(Method writeMethod)
                                 throws IntrospectionException {
+        // Set the property type - which validates the method
+        setPropertyType(findPropertyType(getReadMethod(), writeMethod));
+        setWriteMethod0(writeMethod);
+    }
+
+    private void setWriteMethod0(Method writeMethod) {
         this.writeMethodRef.set(writeMethod);
         if (writeMethod == null) {
             writeMethodName = null;
             return;
         }
-        // Set the property type - which validates the method
-        setPropertyType(findPropertyType(getReadMethod(), writeMethod));
         setClass0(writeMethod.getDeclaringClass());
 
         writeMethodName = writeMethod.getName();
--- a/src/share/classes/java/lang/Class.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/lang/Class.java	Fri Jul 18 08:25:58 2014 -0700
@@ -134,10 +134,11 @@
      * This constructor is not used and prevents the default constructor being
      * generated.
      */
-    private Class(ClassLoader loader) {
+    private Class(ClassLoader loader, Class<?> arrayComponentType) {
         // Initialize final field for classLoader.  The initialization value of non-null
         // prevents future JIT optimizations from assuming this final field is null.
         classLoader = loader;
+        componentType = arrayComponentType;
     }
 
     /**
@@ -917,7 +918,16 @@
      * @see     java.lang.reflect.Array
      * @since 1.1
      */
-    public native Class<?> getComponentType();
+    public Class<?> getComponentType() {
+        // Only return for array types. Storage may be reused for Class for instance types.
+        if (isArray()) {
+            return componentType;
+        } else {
+            return null;
+        }
+    }
+
+    private final Class<?> componentType;
 
 
     /**
--- a/src/share/classes/java/lang/ConditionalSpecialCasing.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/lang/ConditionalSpecialCasing.java	Fri Jul 18 08:25:58 2014 -0700
@@ -147,7 +147,7 @@
     }
 
     private static char[] lookUpTable(String src, int index, Locale locale, boolean bLowerCasing) {
-        HashSet<Entry> set = entryTable.get(new Integer(src.codePointAt(index)));
+        HashSet<Entry> set = entryTable.get(src.codePointAt(index));
         char[] ret = null;
 
         if (set != null) {
--- a/src/share/classes/java/lang/ProcessBuilder.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/lang/ProcessBuilder.java	Fri Jul 18 08:25:58 2014 -0700
@@ -957,6 +957,7 @@
      * <li>The operating system program file was not found.
      * <li>Access to the program file was denied.
      * <li>The working directory does not exist.
+     * <li>Invalid character in command argument, such as NUL.
      * </ul>
      *
      * <p>In such cases an exception will be thrown.  The exact nature
@@ -1019,6 +1020,12 @@
 
         String dir = directory == null ? null : directory.toString();
 
+        for (int i = 1; i < cmdarray.length; i++) {
+            if (cmdarray[i].indexOf('\u0000') >= 0) {
+                throw new IOException("invalid null character in command");
+            }
+        }
+
         try {
             return ProcessImpl.start(cmdarray,
                                      environment,
--- a/src/share/classes/java/lang/invoke/MethodHandles.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/lang/invoke/MethodHandles.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1505,6 +1505,10 @@
                 // that is *not* the bytecode behavior.
                 mods ^= Modifier.PROTECTED | Modifier.PUBLIC;
             }
+            if (Modifier.isProtected(mods) && refKind == REF_newInvokeSpecial) {
+                // cannot "new" a protected ctor in a different package
+                mods ^= Modifier.PROTECTED;
+            }
             if (Modifier.isFinal(mods) &&
                     MethodHandleNatives.refKindIsSetter(refKind))
                 throw m.makeAccessException("unexpected set of a final field", this);
--- a/src/share/classes/java/lang/reflect/Proxy.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/lang/reflect/Proxy.java	Fri Jul 18 08:25:58 2014 -0700
@@ -362,12 +362,13 @@
                                          Class<?>... interfaces)
         throws IllegalArgumentException
     {
-        SecurityManager sm = System.getSecurityManager();
+        final Class<?>[] intfs = interfaces.clone();
+        final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            checkProxyAccess(Reflection.getCallerClass(), loader, interfaces);
+            checkProxyAccess(Reflection.getCallerClass(), loader, intfs);
         }
 
-        return getProxyClass0(loader, interfaces);
+        return getProxyClass0(loader, intfs);
     }
 
     /*
@@ -706,15 +707,16 @@
     {
         Objects.requireNonNull(h);
 
+        final Class<?>[] intfs = interfaces.clone();
         final SecurityManager sm = System.getSecurityManager();
         if (sm != null) {
-            checkProxyAccess(Reflection.getCallerClass(), loader, interfaces);
+            checkProxyAccess(Reflection.getCallerClass(), loader, intfs);
         }
 
         /*
          * Look up or generate the designated proxy class.
          */
-        Class<?> cl = getProxyClass0(loader, interfaces);
+        Class<?> cl = getProxyClass0(loader, intfs);
 
         /*
          * Invoke its constructor with the designated invocation handler.
--- a/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/net/AbstractPlainDatagramSocketImpl.java	Fri Jul 18 08:25:58 2014 -0700
@@ -322,13 +322,13 @@
 
         switch (optID) {
             case SO_TIMEOUT:
-                result = new Integer(timeout);
+                result = timeout;
                 break;
 
             case IP_TOS:
                 result = socketGetOption(optID);
                 if ( ((Integer)result).intValue() == -1) {
-                    result = new Integer(trafficClass);
+                    result = trafficClass;
                 }
                 break;
 
--- a/src/share/classes/java/net/AbstractPlainSocketImpl.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/net/AbstractPlainSocketImpl.java	Fri Jul 18 08:25:58 2014 -0700
@@ -279,7 +279,7 @@
             throw new SocketException("Socket Closed");
         }
         if (opt == SO_TIMEOUT) {
-            return new Integer(timeout);
+            return timeout;
         }
         int ret = 0;
         /*
@@ -299,7 +299,7 @@
             return Boolean.valueOf(ret != -1);
         case SO_LINGER:
             ret = socketGetOption(opt, null);
-            return (ret == -1) ? Boolean.FALSE: (Object)(new Integer(ret));
+            return (ret == -1) ? Boolean.FALSE: (Object)(ret);
         case SO_REUSEADDR:
             ret = socketGetOption(opt, null);
             return Boolean.valueOf(ret != -1);
@@ -310,13 +310,13 @@
         case SO_SNDBUF:
         case SO_RCVBUF:
             ret = socketGetOption(opt, null);
-            return new Integer(ret);
+            return ret;
         case IP_TOS:
             ret = socketGetOption(opt, null);
             if (ret == -1) { // ipv6 tos
-                return new Integer(trafficClass);
+                return trafficClass;
             } else {
-                return new Integer(ret);
+                return ret;
             }
         case SO_KEEPALIVE:
             ret = socketGetOption(opt, null);
--- a/src/share/classes/java/net/DatagramSocket.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/net/DatagramSocket.java	Fri Jul 18 08:25:58 2014 -0700
@@ -858,7 +858,7 @@
     public synchronized void setSoTimeout(int timeout) throws SocketException {
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+        getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
     }
 
     /**
@@ -920,7 +920,7 @@
         }
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+        getImpl().setOption(SocketOptions.SO_SNDBUF, size);
     }
 
     /**
@@ -978,7 +978,7 @@
         }
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+        getImpl().setOption(SocketOptions.SO_RCVBUF, size);
     }
 
     /**
@@ -1040,7 +1040,7 @@
             throw new SocketException("Socket is closed");
         // Integer instead of Boolean for compatibility with older DatagramSocketImpl
         if (oldImpl)
-            getImpl().setOption(SocketOptions.SO_REUSEADDR, new Integer(on?-1:0));
+            getImpl().setOption(SocketOptions.SO_REUSEADDR, on?-1:0);
         else
             getImpl().setOption(SocketOptions.SO_REUSEADDR, Boolean.valueOf(on));
     }
@@ -1141,7 +1141,7 @@
 
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
+        getImpl().setOption(SocketOptions.IP_TOS, tc);
     }
 
     /**
--- a/src/share/classes/java/net/ServerSocket.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/net/ServerSocket.java	Fri Jul 18 08:25:58 2014 -0700
@@ -650,7 +650,7 @@
     public synchronized void setSoTimeout(int timeout) throws SocketException {
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+        getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
     }
 
     /**
@@ -847,7 +847,7 @@
         }
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+        getImpl().setOption(SocketOptions.SO_RCVBUF, size);
     }
 
     /**
--- a/src/share/classes/java/net/Socket.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/net/Socket.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1024,7 +1024,7 @@
             }
             if (linger > 65535)
                 linger = 65535;
-            getImpl().setOption(SocketOptions.SO_LINGER, new Integer(linger));
+            getImpl().setOption(SocketOptions.SO_LINGER, linger);
         }
     }
 
@@ -1140,7 +1140,7 @@
         if (timeout < 0)
           throw new IllegalArgumentException("timeout can't be negative");
 
-        getImpl().setOption(SocketOptions.SO_TIMEOUT, new Integer(timeout));
+        getImpl().setOption(SocketOptions.SO_TIMEOUT, timeout);
     }
 
     /**
@@ -1196,7 +1196,7 @@
         }
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_SNDBUF, new Integer(size));
+        getImpl().setOption(SocketOptions.SO_SNDBUF, size);
     }
 
     /**
@@ -1270,7 +1270,7 @@
         }
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.SO_RCVBUF, new Integer(size));
+        getImpl().setOption(SocketOptions.SO_RCVBUF, size);
     }
 
     /**
@@ -1380,7 +1380,7 @@
 
         if (isClosed())
             throw new SocketException("Socket is closed");
-        getImpl().setOption(SocketOptions.IP_TOS, new Integer(tc));
+        getImpl().setOption(SocketOptions.IP_TOS, tc);
     }
 
     /**
--- a/src/share/classes/java/nio/charset/CoderResult.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/nio/charset/CoderResult.java	Fri Jul 18 08:25:58 2014 -0700
@@ -200,7 +200,7 @@
         private synchronized CoderResult get(int len) {
             if (len <= 0)
                 throw new IllegalArgumentException("Non-positive length");
-            Integer k = new Integer(len);
+            Integer k = len;
             WeakReference<CoderResult> w;
             CoderResult e = null;
             if (cache == null) {
--- a/src/share/classes/java/security/Provider.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/security/Provider.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1376,7 +1376,7 @@
      * <p>This class defines the methods {@link #supportsParameter
      * supportsParameter()} and {@link #newInstance newInstance()}
      * which are used by the Java security framework when it searches for
-     * suitable services and instantes them. The valid arguments to those
+     * suitable services and instantiates them. The valid arguments to those
      * methods depend on the type of service. For the service types defined
      * within Java SE, see the
      * <a href="../../../technotes/guides/security/crypto/CryptoSpec.html">
@@ -1566,7 +1566,7 @@
          *
          * @throws InvalidParameterException if the value of
          * constructorParameter is invalid for this type of service.
-         * @throws NoSuchAlgorithmException if instantation failed for
+         * @throws NoSuchAlgorithmException if instantiation failed for
          * any other reason.
          */
         public Object newInstance(Object constructorParameter)
@@ -1594,7 +1594,9 @@
                             + " engines");
                     }
                     Class<?> clazz = getImplClass();
-                    return clazz.newInstance();
+                    Class<?>[] empty = {};
+                    Constructor<?> con = clazz.getConstructor(empty);
+                    return con.newInstance();
                 } else {
                     Class<?> paramClass = cap.getConstructorParameterClass();
                     if (constructorParameter != null) {
@@ -1637,13 +1639,18 @@
                     } else {
                         clazz = cl.loadClass(className);
                     }
+                    if (!Modifier.isPublic(clazz.getModifiers())) {
+                        throw new NoSuchAlgorithmException
+                            ("class configured for " + type + " (provider: " +
+                            provider.getName() + ") is not public.");
+                    }
                     classRef = new WeakReference<Class<?>>(clazz);
                 }
                 return clazz;
             } catch (ClassNotFoundException e) {
                 throw new NoSuchAlgorithmException
-                    ("class configured for " + type + "(provider: " +
-                    provider.getName() + ")" + "cannot be found.", e);
+                    ("class configured for " + type + " (provider: " +
+                    provider.getName() + ") cannot be found.", e);
             }
         }
 
@@ -1656,15 +1663,21 @@
                 throws Exception {
             Class<?> clazz = getImplClass();
             if (constructorParameter == null) {
-                Object o = clazz.newInstance();
-                return o;
+                // create instance with public no-arg constructor if it exists
+                try {
+                    Class<?>[] empty = {};
+                    Constructor<?> con = clazz.getConstructor(empty);
+                    return con.newInstance();
+                } catch (NoSuchMethodException e) {
+                    throw new NoSuchAlgorithmException("No public no-arg "
+                        + "constructor found in class " + className);
+                }
             }
             Class<?> argClass = constructorParameter.getClass();
             Constructor<?>[] cons = clazz.getConstructors();
             // find first public constructor that can take the
             // argument as parameter
-            for (int i = 0; i < cons.length; i++) {
-                Constructor<?> con = cons[i];
+            for (Constructor<?> con : cons) {
                 Class<?>[] paramTypes = con.getParameterTypes();
                 if (paramTypes.length != 1) {
                     continue;
@@ -1672,10 +1685,9 @@
                 if (paramTypes[0].isAssignableFrom(argClass) == false) {
                     continue;
                 }
-                Object o = con.newInstance(new Object[] {constructorParameter});
-                return o;
+                return con.newInstance(constructorParameter);
             }
-            throw new NoSuchAlgorithmException("No constructor matching "
+            throw new NoSuchAlgorithmException("No public constructor matching "
                 + argClass.getName() + " found in class " + className);
         }
 
--- a/src/share/classes/java/security/SignedObject.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/security/SignedObject.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -211,7 +211,9 @@
      * @param verificationKey the public key for verification.
      * @param verificationEngine the signature verification engine.
      *
-     * @exception SignatureException if signature verification failed.
+     * @exception SignatureException if signature verification failed (an
+     *     exception prevented the signature verification engine from completing
+     *     normally).
      * @exception InvalidKeyException if the verification key is invalid.
      *
      * @return {@code true} if the signature
--- a/src/share/classes/java/util/Locale.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/Locale.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1924,7 +1924,7 @@
         // the qualifier; if there are no qualifiers, the third element is
         // unused by the format pattern.
         Object[] displayNames = {
-            new Integer(qualifierNames.length != 0 ? 2 : 1),
+            qualifierNames.length != 0 ? 2 : 1,
             mainName,
             // We could also just call formatList() and have it handle the empty
             // list case, but this is more efficient, and we want it to be
@@ -2078,7 +2078,7 @@
         // Rebuild the argument list with the list length as the first element
         Object[] args = new Object[stringList.length + 1];
         System.arraycopy(stringList, 0, args, 1, stringList.length);
-        args[0] = new Integer(stringList.length);
+        args[0] = stringList.length;
 
         // Format it using the pattern in the resource
         MessageFormat format = new MessageFormat(listPattern);
--- a/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Fri Jul 18 08:25:58 2014 -0700
@@ -334,6 +334,8 @@
 
             if (vclass != fieldClass)
                 throw new ClassCastException();
+            if (vclass.isPrimitive())
+                throw new IllegalArgumentException("Must be reference type");
 
             if (!Modifier.isVolatile(modifiers))
                 throw new IllegalArgumentException("Must be volatile type");
--- a/src/share/classes/java/util/prefs/XmlSupport.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/prefs/XmlSupport.java	Fri Jul 18 08:25:58 2014 -0700
@@ -262,7 +262,7 @@
         try {
             TransformerFactory tf = TransformerFactory.newInstance();
             try {
-                tf.setAttribute("indent-number", new Integer(2));
+                tf.setAttribute("indent-number", 2);
             } catch (IllegalArgumentException iae) {
                 //Ignore the IAE. Should not fail the writeout even the
                 //transformer provider does not support "indent-number".
--- a/src/share/classes/java/util/regex/Pattern.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/regex/Pattern.java	Fri Jul 18 08:25:58 2014 -0700
@@ -917,6 +917,13 @@
      */
     public static final int UNICODE_CHARACTER_CLASS = 0x100;
 
+    /**
+     * Contains all possible flags for compile(regex, flags).
+     */
+    private static final int ALL_FLAGS = CASE_INSENSITIVE | MULTILINE |
+            DOTALL | UNICODE_CASE | CANON_EQ | UNIX_LINES | LITERAL |
+            UNICODE_CHARACTER_CLASS | COMMENTS;
+
     /* Pattern has only two serialized components: The pattern string
      * and the flags, which are all that is needed to recompile the pattern
      * when it is deserialized.
@@ -1336,6 +1343,10 @@
      * only a Start node and a LastNode node.
      */
     private Pattern(String p, int f) {
+        if ((f & ~ALL_FLAGS) != 0) {
+            throw new IllegalArgumentException("Unknown flag 0x"
+                                               + Integer.toHexString(f));
+        }
         pattern = p;
         flags = f;
 
--- a/src/share/classes/java/util/stream/AbstractPipeline.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/AbstractPipeline.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -322,6 +322,7 @@
     @Override
     @SuppressWarnings("unchecked")
     public S onClose(Runnable closeHandler) {
+        Objects.requireNonNull(closeHandler);
         Runnable existingHandler = sourceStage.sourceCloseAction;
         sourceStage.sourceCloseAction =
                 (existingHandler == null)
@@ -406,7 +407,7 @@
                         // Clear the short circuit flag for next pipeline stage
                         // This stage encapsulates short-circuiting, the next
                         // stage may not have any short-circuit operations, and
-                        // if so spliterator.forEachRemaining should be be used
+                        // if so spliterator.forEachRemaining should be used
                         // for traversal
                         thisOpFlags = thisOpFlags & ~StreamOpFlag.IS_SHORT_CIRCUIT;
                     }
--- a/src/share/classes/java/util/stream/BaseStream.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/BaseStream.java	Fri Jul 18 08:25:58 2014 -0700
@@ -53,7 +53,7 @@
  * parallelism, which governs the behavior of all stream types.
  *
  * @param <T> the type of the stream elements
- * @param <S> the type of of the stream implementing {@code BaseStream}
+ * @param <S> the type of the stream implementing {@code BaseStream}
  * @since 1.8
  * @see Stream
  * @see IntStream
--- a/src/share/classes/java/util/stream/DoublePipeline.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/DoublePipeline.java	Fri Jul 18 08:25:58 2014 -0700
@@ -254,6 +254,7 @@
 
     @Override
     public final DoubleStream flatMap(DoubleFunction<? extends DoubleStream> mapper) {
+        Objects.requireNonNull(mapper);
         return new StatelessOp<Double>(this, StreamShape.DOUBLE_VALUE,
                                         StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
             @Override
@@ -469,6 +470,7 @@
     public final <R> R collect(Supplier<R> supplier,
                                ObjDoubleConsumer<R> accumulator,
                                BiConsumer<R, R> combiner) {
+        Objects.requireNonNull(combiner);
         BinaryOperator<R> operator = (left, right) -> {
             combiner.accept(left, right);
             return left;
--- a/src/share/classes/java/util/stream/DoubleStream.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/DoubleStream.java	Fri Jul 18 08:25:58 2014 -0700
@@ -768,7 +768,7 @@
      *  to the element at position {@code n - 1}.
      *
      * @param seed the initial element
-     * @param f a function to be applied to to the previous element to produce
+     * @param f a function to be applied to the previous element to produce
      *          a new element
      * @return a new sequential {@code DoubleStream}
      */
--- a/src/share/classes/java/util/stream/IntPipeline.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/IntPipeline.java	Fri Jul 18 08:25:58 2014 -0700
@@ -290,6 +290,7 @@
 
     @Override
     public final IntStream flatMap(IntFunction<? extends IntStream> mapper) {
+        Objects.requireNonNull(mapper);
         return new StatelessOp<Integer>(this, StreamShape.INT_VALUE,
                                         StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
             @Override
@@ -465,6 +466,7 @@
     public final <R> R collect(Supplier<R> supplier,
                                ObjIntConsumer<R> accumulator,
                                BiConsumer<R, R> combiner) {
+        Objects.requireNonNull(combiner);
         BinaryOperator<R> operator = (left, right) -> {
             combiner.accept(left, right);
             return left;
--- a/src/share/classes/java/util/stream/IntStream.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/IntStream.java	Fri Jul 18 08:25:58 2014 -0700
@@ -734,7 +734,7 @@
      * element at position {@code n - 1}.
      *
      * @param seed the initial element
-     * @param f a function to be applied to to the previous element to produce
+     * @param f a function to be applied to the previous element to produce
      *          a new element
      * @return A new sequential {@code IntStream}
      */
--- a/src/share/classes/java/util/stream/LongPipeline.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/LongPipeline.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 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
@@ -271,6 +271,7 @@
 
     @Override
     public final LongStream flatMap(LongFunction<? extends LongStream> mapper) {
+        Objects.requireNonNull(mapper);
         return new StatelessOp<Long>(this, StreamShape.LONG_VALUE,
                                      StreamOpFlag.NOT_SORTED | StreamOpFlag.NOT_DISTINCT | StreamOpFlag.NOT_SIZED) {
             @Override
@@ -447,6 +448,7 @@
     public final <R> R collect(Supplier<R> supplier,
                                ObjLongConsumer<R> accumulator,
                                BiConsumer<R, R> combiner) {
+        Objects.requireNonNull(combiner);
         BinaryOperator<R> operator = (left, right) -> {
             combiner.accept(left, right);
             return left;
--- a/src/share/classes/java/util/stream/LongStream.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/LongStream.java	Fri Jul 18 08:25:58 2014 -0700
@@ -727,7 +727,7 @@
      * element at position {@code n - 1}.
      *
      * @param seed the initial element
-     * @param f a function to be applied to to the previous element to produce
+     * @param f a function to be applied to the previous element to produce
      *          a new element
      * @return a new sequential {@code LongStream}
      */
--- a/src/share/classes/java/util/stream/PipelineHelper.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/PipelineHelper.java	Fri Jul 18 08:25:58 2014 -0700
@@ -74,7 +74,7 @@
     /**
      * Returns the exact output size of the portion of the output resulting from
      * applying the pipeline stages described by this {@code PipelineHelper} to
-     * the the portion of the input described by the provided
+     * the portion of the input described by the provided
      * {@code Spliterator}, if known.  If not known or known infinite, will
      * return {@code -1}.
      *
--- a/src/share/classes/java/util/stream/SliceOps.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/SliceOps.java	Fri Jul 18 08:25:58 2014 -0700
@@ -693,7 +693,7 @@
          * size.
          *
          * @param target the target size
-         * @return return the number of completed elements
+         * @return the number of completed elements
          */
         private long completedSize(long target) {
             if (completed)
--- a/src/share/classes/java/util/stream/Stream.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/Stream.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1013,7 +1013,7 @@
      *
      * @param <T> the type of stream elements
      * @param seed the initial element
-     * @param f a function to be applied to to the previous element to produce
+     * @param f a function to be applied to the previous element to produce
      *          a new element
      * @return a new sequential {@code Stream}
      */
--- a/src/share/classes/java/util/stream/StreamOpFlag.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/java/util/stream/StreamOpFlag.java	Fri Jul 18 08:25:58 2014 -0700
@@ -115,7 +115,7 @@
  * characteristics that stream has; when describing a stream operation, one need
  * describe whether the operation preserves, injects, or clears that
  * characteristic.  Accordingly, two bits are used for each flag, so as to allow
- * representing not only the presence of of a characteristic, but how an
+ * representing not only the presence of a characteristic, but how an
  * operation modifies that characteristic.  There are two common forms in which
  * flag bits are combined into an {@code int} bit set.  <em>Stream flags</em>
  * are a unioned bit set constructed by ORing the enum characteristic values of
--- a/src/share/classes/javax/accessibility/AccessibleBundle.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/accessibility/AccessibleBundle.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -49,7 +49,7 @@
  */
 public abstract class AccessibleBundle {
 
-    private static Hashtable table = new Hashtable();
+    private static Hashtable<Locale, Hashtable<String, Object>> table = new Hashtable<>();
     private final String defaultResourceBundleName
         = "com.sun.accessibility.internal.resources.accessibility";
 
@@ -85,14 +85,12 @@
         loadResourceBundle(resourceBundleName, locale);
 
         // returns the localized string
-        Object o = table.get(locale);
-        if (o != null && o instanceof Hashtable) {
-                Hashtable resourceTable = (Hashtable) o;
-                o = resourceTable.get(key);
-
-                if (o != null && o instanceof String) {
-                    return (String)o;
-                }
+        Hashtable<String, Object> ht = table.get(locale);
+        if (ht != null) {
+            Object o = ht.get(key);
+            if (o != null && o instanceof String) {
+                return (String)o;
+            }
         }
         return key;
     }
@@ -134,13 +132,13 @@
         if (! table.contains(locale)) {
 
             try {
-                Hashtable resourceTable = new Hashtable();
+                Hashtable<String, Object> resourceTable = new Hashtable<>();
 
                 ResourceBundle bundle = ResourceBundle.getBundle(resourceBundleName, locale);
 
-                Enumeration iter = bundle.getKeys();
+                Enumeration<String> iter = bundle.getKeys();
                 while(iter.hasMoreElements()) {
-                    String key = (String)iter.nextElement();
+                    String key = iter.nextElement();
                     resourceTable.put(key, bundle.getObject(key));
                 }
 
--- a/src/share/classes/javax/accessibility/AccessibleRelationSet.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/accessibility/AccessibleRelationSet.java	Fri Jul 18 08:25:58 2014 -0700
@@ -71,7 +71,7 @@
      */
     public AccessibleRelationSet(AccessibleRelation[] relations) {
         if (relations.length != 0) {
-            this.relations = new Vector(relations.length);
+            this.relations = new Vector<>(relations.length);
             for (int i = 0; i < relations.length; i++) {
                 add(relations[i]);
             }
@@ -90,7 +90,7 @@
      */
     public boolean add(AccessibleRelation relation) {
         if (relations == null) {
-            relations = new Vector();
+            relations = new Vector<>();
         }
 
         // Merge the relation targets if the key exists
@@ -125,7 +125,7 @@
     public void addAll(AccessibleRelation[] relations) {
         if (relations.length != 0) {
             if (this.relations == null) {
-                this.relations = new Vector(relations.length);
+                this.relations = new Vector<>(relations.length);
             }
             for (int i = 0; i < relations.length; i++) {
                 add(relations[i]);
--- a/src/share/classes/javax/accessibility/AccessibleStateSet.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/accessibility/AccessibleStateSet.java	Fri Jul 18 08:25:58 2014 -0700
@@ -68,7 +68,7 @@
      */
     public AccessibleStateSet(AccessibleState[] states) {
         if (states.length != 0) {
-            this.states = new Vector(states.length);
+            this.states = new Vector<>(states.length);
             for (int i = 0; i < states.length; i++) {
                 if (!this.states.contains(states[i])) {
                     this.states.addElement(states[i]);
@@ -92,7 +92,7 @@
         // to always use a vector of states.  It could be improved by
         // caching the states as a bit set.]]]
         if (states == null) {
-            states = new Vector();
+            states = new Vector<>();
         }
 
         if (!states.contains(state)) {
@@ -111,7 +111,7 @@
     public void addAll(AccessibleState[] states) {
         if (states.length != 0) {
             if (this.states == null) {
-                this.states = new Vector(states.length);
+                this.states = new Vector<>(states.length);
             }
             for (int i = 0; i < states.length; i++) {
                 if (!this.states.contains(states[i])) {
--- a/src/share/classes/javax/crypto/CryptoPolicyParser.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/crypto/CryptoPolicyParser.java	Fri Jul 18 08:25:58 2014 -0700
@@ -256,11 +256,11 @@
             while (peek(",")) {
                 match(",");
                 if (peek("number")) {
-                    paramsV.addElement(new Integer(match()));
+                    paramsV.addElement(match());
                 } else {
                     if (peek("*")) {
                         match("*");
-                        paramsV.addElement(new Integer(Integer.MAX_VALUE));
+                        paramsV.addElement(Integer.MAX_VALUE);
                     } else {
                         throw new ParsingException(st.lineno(),
                                                    "Expecting an integer");
--- a/src/share/classes/javax/management/loading/MLet.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/management/loading/MLet.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1313,7 +1313,7 @@
         if (type.compareTo("java.lang.Long") == 0)
              return Long.valueOf(param);
         if (type.compareTo("java.lang.Integer") == 0)
-             return new Integer(param);
+             return param;
         if (type.compareTo("java.lang.Float") == 0)
              return new Float(param);
         if (type.compareTo("java.lang.Double") == 0)
--- a/src/share/classes/javax/management/relation/RelationService.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/management/relation/RelationService.java	Fri Jul 18 08:25:58 2014 -0700
@@ -3208,7 +3208,7 @@
                 // End of check :)
                 RELATION_LOGGER.exiting(RelationService.class.getName(),
                         "checkRoleInt");
-                return new Integer(0);
+                return 0;
             }
         }
 
@@ -3218,7 +3218,7 @@
             if (!isWritable) {
                 RELATION_LOGGER.exiting(RelationService.class.getName(),
                         "checkRoleInt");
-                return new Integer(RoleStatus.ROLE_NOT_WRITABLE);
+                return RoleStatus.ROLE_NOT_WRITABLE;
             }
         }
 
@@ -3229,7 +3229,7 @@
         if (!chkMinFlag) {
             RELATION_LOGGER.exiting(RelationService.class.getName(),
                     "checkRoleInt");
-            return new Integer(RoleStatus.LESS_THAN_MIN_ROLE_DEGREE);
+            return RoleStatus.LESS_THAN_MIN_ROLE_DEGREE;
         }
 
         // Checks maximum cardinality
@@ -3237,7 +3237,7 @@
         if (!chkMaxFlag) {
             RELATION_LOGGER.exiting(RelationService.class.getName(),
                     "checkRoleInt");
-            return new Integer(RoleStatus.MORE_THAN_MAX_ROLE_DEGREE);
+            return RoleStatus.MORE_THAN_MAX_ROLE_DEGREE;
         }
 
         // Verifies that each referenced MBean is registered in the MBean
@@ -3254,7 +3254,7 @@
             if (currObjName == null) {
                 RELATION_LOGGER.exiting(RelationService.class.getName(),
                         "checkRoleInt");
-                return new Integer(RoleStatus.REF_MBEAN_NOT_REGISTERED);
+                return RoleStatus.REF_MBEAN_NOT_REGISTERED;
             }
 
             // Checks if it is of the correct class
@@ -3265,19 +3265,19 @@
                 if (!classSts) {
                     RELATION_LOGGER.exiting(RelationService.class.getName(),
                             "checkRoleInt");
-                    return new Integer(RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS);
+                    return RoleStatus.REF_MBEAN_OF_INCORRECT_CLASS;
                 }
 
             } catch (InstanceNotFoundException exc) {
                 RELATION_LOGGER.exiting(RelationService.class.getName(),
                         "checkRoleInt");
-                return new Integer(RoleStatus.REF_MBEAN_NOT_REGISTERED);
+                return RoleStatus.REF_MBEAN_NOT_REGISTERED;
             }
         }
 
         RELATION_LOGGER.exiting(RelationService.class.getName(),
                 "checkRoleInt");
-        return new Integer(0);
+        return 0;
     }
 
 
--- a/src/share/classes/javax/swing/AbstractButton.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/AbstractButton.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1123,7 +1123,7 @@
         }
     }
 
-    private boolean isListener(Class c, ActionListener a) {
+    private boolean isListener(Class<?> c, ActionListener a) {
         boolean isListener = false;
         Object[] listeners = listenerList.getListenerList();
         for (int i = listeners.length-2; i>=0; i-=2) {
--- a/src/share/classes/javax/swing/ArrayTable.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/ArrayTable.java	Fri Jul 18 08:25:58 2014 -0700
@@ -133,7 +133,9 @@
                 if ((size==ARRAY_BOUNDARY) && isArray()) {
                     grow();
                 }
-                ((Hashtable<Object,Object>)table).put(key, value);
+                @SuppressWarnings("unchecked")
+                Hashtable<Object,Object> tmp = (Hashtable<Object,Object>)table;
+                tmp.put(key, value);
             }
         }
     }
--- a/src/share/classes/javax/swing/DebugGraphics.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/DebugGraphics.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1463,7 +1463,5 @@
         }
         return debugGraphicsInfo;
     }
-    private static final Class debugGraphicsInfoKey = DebugGraphicsInfo.class;
-
-
+    private static final Class<DebugGraphicsInfo> debugGraphicsInfoKey = DebugGraphicsInfo.class;
 }
--- a/src/share/classes/javax/swing/DefaultCellEditor.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/DefaultCellEditor.java	Fri Jul 18 08:25:58 2014 -0700
@@ -131,7 +131,7 @@
      *
      * @param comboBox  a <code>JComboBox</code> object
      */
-    public DefaultCellEditor(final JComboBox comboBox) {
+    public DefaultCellEditor(final JComboBox<?> comboBox) {
         editorComponent = comboBox;
         comboBox.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE);
         delegate = new EditorDelegate() {
--- a/src/share/classes/javax/swing/DefaultRowSorter.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/DefaultRowSorter.java	Fri Jul 18 08:25:58 2014 -0700
@@ -128,7 +128,7 @@
     /**
      * Comparators specified by column.
      */
-    private Comparator[] comparators;
+    private Comparator<?>[] comparators;
 
     /**
      * Whether or not the specified column is sortable, by column.
@@ -143,7 +143,7 @@
     /**
      * Cached comparators for the current sort
      */
-    private Comparator[] sortComparators;
+    private Comparator<?>[] sortComparators;
 
     /**
      * Developer supplied Filter.
@@ -695,7 +695,7 @@
      */
     private void cacheSortKeys(List<? extends SortKey> keys) {
         int keySize = keys.size();
-        sortComparators = new Comparator[keySize];
+        sortComparators = new Comparator<?>[keySize];
         for (int i = 0; i < keySize; i++) {
             sortComparators[i] = getComparator0(keys.get(i).getColumn());
         }
@@ -762,7 +762,7 @@
     public void setComparator(int column, Comparator<?> comparator) {
         checkColumn(column);
         if (comparators == null) {
-            comparators = new Comparator[getModelWrapper().getColumnCount()];
+            comparators = new Comparator<?>[getModelWrapper().getColumnCount()];
         }
         comparators[column] = comparator;
     }
@@ -788,8 +788,8 @@
 
     // Returns the Comparator to use during sorting.  Where as
     // getComparator() may return null, this will never return null.
-    private Comparator getComparator0(int column) {
-        Comparator comparator = getComparator(column);
+    private Comparator<?> getComparator0(int column) {
+        Comparator<?> comparator = getComparator(column);
         if (comparator != null) {
             return comparator;
         }
@@ -967,7 +967,9 @@
                 } else if (v2 == null) {
                     result = 1;
                 } else {
-                    result = sortComparators[counter].compare(v1, v2);
+                    Comparator<Object> c =
+                        (Comparator<Object>)sortComparators[counter];
+                    result = c.compare(v1, v2);
                 }
                 if (sortOrder == SortOrder.DESCENDING) {
                     result *= -1;
@@ -1366,10 +1368,10 @@
      */
     // NOTE: this class is static so that it can be placed in an array
     private static class Row implements Comparable<Row> {
-        private DefaultRowSorter sorter;
+        private DefaultRowSorter<?, ?> sorter;
         int modelIndex;
 
-        public Row(DefaultRowSorter sorter, int index) {
+        public Row(DefaultRowSorter<?, ?> sorter, int index) {
             this.sorter = sorter;
             modelIndex = index;
         }
--- a/src/share/classes/javax/swing/JComboBox.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JComboBox.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1100,7 +1100,7 @@
         }
     }
 
-    private boolean isListener(Class c, ActionListener a) {
+    private boolean isListener(Class<?> c, ActionListener a) {
         boolean isListener = false;
         Object[] listeners = listenerList.getListenerList();
         for (int i = listeners.length-2; i>=0; i-=2) {
@@ -1530,11 +1530,11 @@
          * @return an int equal to the selected row, where 0 is the
          *         first item and -1 is none.
          */
-        int selectionForKey(char aKey,ComboBoxModel aModel);
+        int selectionForKey(char aKey,ComboBoxModel<?> aModel);
     }
 
     class DefaultKeySelectionManager implements KeySelectionManager, Serializable {
-        public int selectionForKey(char aKey,ComboBoxModel aModel) {
+        public int selectionForKey(char aKey,ComboBoxModel<?> aModel) {
             int i,c;
             int currentSelection = -1;
             Object selectedItem = aModel.getSelectedItem();
@@ -1656,7 +1656,7 @@
     implements AccessibleAction, AccessibleSelection {
 
 
-        private JList popupList; // combo box popup list
+        private JList<?> popupList; // combo box popup list
         private Accessible previousSelectedAccessible = null;
 
         /**
@@ -1980,7 +1980,7 @@
                 a instanceof javax.swing.plaf.basic.ComboPopup) {
 
                 // get the popup list
-                JList list = ((javax.swing.plaf.basic.ComboPopup)a).getList();
+                JList<?> list = ((javax.swing.plaf.basic.ComboPopup)a).getList();
 
                 // return the i-th selection in the popup list
                 AccessibleContext ac = list.getAccessibleContext();
--- a/src/share/classes/javax/swing/JComponent.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JComponent.java	Fri Jul 18 08:25:58 2014 -0700
@@ -2111,6 +2111,7 @@
     private void registerWithKeyboardManager(boolean onlyIfNew) {
         InputMap inputMap = getInputMap(WHEN_IN_FOCUSED_WINDOW, false);
         KeyStroke[] strokes;
+        @SuppressWarnings("unchecked")
         Hashtable<KeyStroke, KeyStroke> registered =
                 (Hashtable<KeyStroke, KeyStroke>)getClientProperty
                                 (WHEN_IN_FOCUSED_WINDOW_BINDINGS);
@@ -2164,6 +2165,7 @@
      * <code>WHEN_IN_FOCUSED_WINDOW</code> <code>KeyStroke</code> bindings.
      */
     private void unregisterWithKeyboardManager() {
+        @SuppressWarnings("unchecked")
         Hashtable<KeyStroke, KeyStroke> registered =
                 (Hashtable<KeyStroke, KeyStroke>)getClientProperty
                                 (WHEN_IN_FOCUSED_WINDOW_BINDINGS);
@@ -4126,16 +4128,20 @@
                 setFlag(AUTOSCROLLS_SET, false);
             }
         } else if (propertyName == "focusTraversalKeysForward") {
+            @SuppressWarnings("unchecked")
+            Set<AWTKeyStroke> strokeSet = (Set<AWTKeyStroke>) value;
             if (!getFlag(FOCUS_TRAVERSAL_KEYS_FORWARD_SET)) {
                 super.setFocusTraversalKeys(KeyboardFocusManager.
                                             FORWARD_TRAVERSAL_KEYS,
-                                            (Set<AWTKeyStroke>)value);
+                                            strokeSet);
             }
         } else if (propertyName == "focusTraversalKeysBackward") {
+            @SuppressWarnings("unchecked")
+            Set<AWTKeyStroke> strokeSet = (Set<AWTKeyStroke>) value;
             if (!getFlag(FOCUS_TRAVERSAL_KEYS_BACKWARD_SET)) {
                 super.setFocusTraversalKeys(KeyboardFocusManager.
                                             BACKWARD_TRAVERSAL_KEYS,
-                                            (Set<AWTKeyStroke>)value);
+                                            strokeSet);
             }
         } else {
             throw new IllegalArgumentException("property \""+
@@ -4713,6 +4719,7 @@
      * @see #getVetoableChangeListeners
      * @see #getAncestorListeners
      */
+    @SuppressWarnings("unchecked") // Casts to (T[])
     public <T extends EventListener> T[] getListeners(Class<T> listenerType) {
         T[] result;
         if (listenerType == AncestorListener.class) {
--- a/src/share/classes/javax/swing/JEditorPane.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JEditorPane.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1191,7 +1191,7 @@
             String classname = getKitTypeRegistry().get(type);
             ClassLoader loader = getKitLoaderRegistry().get(type);
             try {
-                Class c;
+                Class<?> c;
                 if (loader != null) {
                     c = loader.loadClass(classname);
                 } else {
@@ -1265,18 +1265,26 @@
 
     private static Hashtable<String, String> getKitTypeRegistry() {
         loadDefaultKitsIfNecessary();
-        return (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey);
+        @SuppressWarnings("unchecked")
+        Hashtable<String, String> tmp =
+            (Hashtable)SwingUtilities.appContextGet(kitTypeRegistryKey);
+        return tmp;
     }
 
     private static Hashtable<String, ClassLoader> getKitLoaderRegistry() {
         loadDefaultKitsIfNecessary();
-        return (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey);
+        @SuppressWarnings("unchecked")
+        Hashtable<String, ClassLoader> tmp =
+            (Hashtable)SwingUtilities.appContextGet(kitLoaderRegistryKey);
+        return tmp;
     }
 
     private static Hashtable<String, EditorKit> getKitRegisty() {
-        Hashtable ht = (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);
+        @SuppressWarnings("unchecked")
+        Hashtable<String, EditorKit> ht =
+            (Hashtable)SwingUtilities.appContextGet(kitRegistryKey);
         if (ht == null) {
-            ht = new Hashtable(3);
+            ht = new Hashtable<>(3);
             SwingUtilities.appContextPut(kitRegistryKey, ht);
         }
         return ht;
@@ -1302,9 +1310,9 @@
                                             "javax.swing.text.rtf.RTFEditorKit");
                 }
             }
-            Hashtable ht = new Hashtable();
+            Hashtable<Object, Object> ht = new Hashtable<>();
             SwingUtilities.appContextPut(kitTypeRegistryKey, ht);
-            ht = new Hashtable();
+            ht = new Hashtable<>();
             SwingUtilities.appContextPut(kitLoaderRegistryKey, ht);
             for (String key : defaultEditorKitMap.keySet()) {
                 registerEditorKitForContentType(key,defaultEditorKitMap.get(key));
--- a/src/share/classes/javax/swing/JLayer.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JLayer.java	Fri Jul 18 08:25:58 2014 -0700
@@ -721,7 +721,7 @@
                         AWTEvent.HIERARCHY_EVENT_MASK |
                         AWTEvent.HIERARCHY_BOUNDS_EVENT_MASK;
 
-        @SuppressWarnings("unchecked")
+        @SuppressWarnings({"unchecked", "rawtypes"})
         public void eventDispatched(AWTEvent event) {
             Object source = event.getSource();
             if (source instanceof Component) {
@@ -729,7 +729,7 @@
                 while (component != null) {
                     if (component instanceof JLayer) {
                         JLayer l = (JLayer) component;
-                        LayerUI ui = l.getUI();
+                        LayerUI<?> ui = l.getUI();
                         if (ui != null &&
                                 isEventEnabled(l.getLayerEventMask(), event.getID()) &&
                                 (!(event instanceof InputEvent) || !((InputEvent)event).isConsumed())) {
--- a/src/share/classes/javax/swing/JOptionPane.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JOptionPane.java	Fri Jul 18 08:25:58 2014 -0700
@@ -2387,7 +2387,7 @@
         throws IOException, ClassNotFoundException {
         s.defaultReadObject();
 
-        Vector          values = (Vector)s.readObject();
+        Vector<?>       values = (Vector)s.readObject();
         int             indexCounter = 0;
         int             maxCounter = values.size();
 
--- a/src/share/classes/javax/swing/JSlider.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JSlider.java	Fri Jul 18 08:25:58 2014 -0700
@@ -138,7 +138,7 @@
     /**
      * {@code Dictionary} of what labels to draw at which values
      */
-    private Dictionary labelTable;
+    private Dictionary<Integer, JComponent> labelTable;
 
 
     /**
@@ -773,10 +773,10 @@
         }
 
         // Check that there is a label with such image
-        Enumeration elements = labelTable.elements();
+        Enumeration<JComponent> elements = labelTable.elements();
 
         while (elements.hasMoreElements()) {
-            Component component = (Component) elements.nextElement();
+            JComponent component = elements.nextElement();
 
             if (component instanceof JLabel) {
                 JLabel label = (JLabel) component;
@@ -797,7 +797,7 @@
      * @return the <code>Dictionary</code> containing labels and
      *    where to draw them
      */
-    public Dictionary getLabelTable() {
+    public Dictionary<Integer, JComponent> getLabelTable() {
 /*
         if ( labelTable == null && getMajorTickSpacing() > 0 ) {
             setLabelTable( createStandardLabels( getMajorTickSpacing() ) );
@@ -830,8 +830,8 @@
      *    attribute: visualUpdate true
      *  description: Specifies what labels will be drawn for any given value.
      */
-    public void setLabelTable( Dictionary labels ) {
-        Dictionary oldTable = labelTable;
+    public void setLabelTable( Dictionary<Integer, JComponent> labels ) {
+        Dictionary<Integer, JComponent> oldTable = labelTable;
         labelTable = labels;
         updateLabelUIs();
         firePropertyChange("labelTable", oldTable, labelTable );
@@ -852,25 +852,25 @@
      * @see JComponent#updateUI
      */
     protected void updateLabelUIs() {
-        Dictionary labelTable = getLabelTable();
+        Dictionary<Integer, JComponent> labelTable = getLabelTable();
 
         if (labelTable == null) {
             return;
         }
-        Enumeration labels = labelTable.keys();
+        Enumeration<Integer> labels = labelTable.keys();
         while ( labels.hasMoreElements() ) {
-            JComponent component = (JComponent) labelTable.get(labels.nextElement());
+            JComponent component = labelTable.get(labels.nextElement());
             component.updateUI();
             component.setSize(component.getPreferredSize());
         }
     }
 
     private void updateLabelSizes() {
-        Dictionary labelTable = getLabelTable();
+        Dictionary<Integer, JComponent> labelTable = getLabelTable();
         if (labelTable != null) {
-            Enumeration labels = labelTable.elements();
+            Enumeration<JComponent> labels = labelTable.elements();
             while (labels.hasMoreElements()) {
-                JComponent component = (JComponent) labels.nextElement();
+                JComponent component = labels.nextElement();
                 component.setSize(component.getPreferredSize());
             }
         }
@@ -898,7 +898,7 @@
      * @throws IllegalArgumentException if {@code increment} is less than or
      *          equal to zero
      */
-    public Hashtable createStandardLabels( int increment ) {
+    public Hashtable<Integer, JComponent> createStandardLabels( int increment ) {
         return createStandardLabels( increment, getMinimum() );
     }
 
@@ -926,7 +926,7 @@
      *          out of range, or if {@code increment} is less than or equal
      *          to zero
      */
-    public Hashtable createStandardLabels( int increment, int start ) {
+    public Hashtable<Integer, JComponent> createStandardLabels( int increment, int start ) {
         if ( start > getMaximum() || start < getMinimum() ) {
             throw new IllegalArgumentException( "Slider label start point out of range." );
         }
@@ -935,7 +935,7 @@
             throw new IllegalArgumentException( "Label incremement must be > 0" );
         }
 
-        class SmartHashtable extends Hashtable<Object, Object> implements PropertyChangeListener {
+        class SmartHashtable extends Hashtable<Integer, JComponent> implements PropertyChangeListener {
             int increment = 0;
             int start = 0;
             boolean startAtMin = false;
@@ -982,13 +982,13 @@
                 if ( e.getPropertyName().equals( "minimum" ) ||
                      e.getPropertyName().equals( "maximum" ) ) {
 
-                    Enumeration keys = getLabelTable().keys();
-                    Hashtable<Object, Object> hashtable = new Hashtable<Object, Object>();
+                    Enumeration<Integer> keys = getLabelTable().keys();
+                    Hashtable<Integer, JComponent> hashtable = new Hashtable<>();
 
                     // Save the labels that were added by the developer
                     while ( keys.hasMoreElements() ) {
-                        Object key = keys.nextElement();
-                        Object value = labelTable.get(key);
+                        Integer key = keys.nextElement();
+                        JComponent value = labelTable.get(key);
                         if ( !(value instanceof LabelUIResource) ) {
                             hashtable.put( key, value );
                         }
@@ -1000,7 +1000,7 @@
                     // Add the saved labels
                     keys = hashtable.keys();
                     while ( keys.hasMoreElements() ) {
-                        Object key = keys.nextElement();
+                        Integer key = keys.nextElement();
                         put( key, hashtable.get( key ) );
                     }
 
@@ -1017,7 +1017,7 @@
 
         SmartHashtable table = new SmartHashtable( increment, start );
 
-        Dictionary labelTable = getLabelTable();
+        Dictionary<Integer, JComponent> labelTable = getLabelTable();
 
         if (labelTable != null && (labelTable instanceof PropertyChangeListener)) {
             removePropertyChangeListener((PropertyChangeListener) labelTable);
--- a/src/share/classes/javax/swing/JSpinner.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JSpinner.java	Fri Jul 18 08:25:58 2014 -0700
@@ -907,7 +907,7 @@
 
     /**
      * This subclass of javax.swing.DateFormatter maps the minimum/maximum
-     * properties to te start/end properties of a SpinnerDateModel.
+     * properties to the start/end properties of a SpinnerDateModel.
      */
     private static class DateEditorFormatter extends DateFormatter {
         private final SpinnerDateModel model;
@@ -917,19 +917,25 @@
             this.model = model;
         }
 
-        public void setMinimum(Comparable min) {
-            model.setStart(min);
+        @Override
+        @SuppressWarnings("unchecked")
+        public void setMinimum(Comparable<?> min) {
+            model.setStart((Comparable<Date>)min);
         }
 
-        public Comparable getMinimum() {
+        @Override
+        public Comparable<Date> getMinimum() {
             return  model.getStart();
         }
 
-        public void setMaximum(Comparable max) {
-            model.setEnd(max);
+        @Override
+        @SuppressWarnings("unchecked")
+        public void setMaximum(Comparable<?> max) {
+            model.setEnd((Comparable<Date>)max);
         }
 
-        public Comparable getMaximum() {
+        @Override
+        public Comparable<Date> getMaximum() {
             return model.getEnd();
         }
     }
@@ -1095,19 +1101,23 @@
             setValueClass(model.getValue().getClass());
         }
 
-        public void setMinimum(Comparable min) {
+        @Override
+        public void setMinimum(Comparable<?> min) {
             model.setMinimum(min);
         }
 
-        public Comparable getMinimum() {
+        @Override
+        public Comparable<?> getMinimum() {
             return  model.getMinimum();
         }
 
-        public void setMaximum(Comparable max) {
+        @Override
+        public void setMaximum(Comparable<?> max) {
             model.setMaximum(max);
         }
 
-        public Comparable getMaximum() {
+        @Override
+        public Comparable<?> getMaximum() {
             return model.getMaximum();
         }
     }
--- a/src/share/classes/javax/swing/JTable.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JTable.java	Fri Jul 18 08:25:58 2014 -0700
@@ -354,19 +354,23 @@
     /** Identifies the row of the cell being edited. */
     transient protected int             editingRow;
 
-    /**
+   /**
      * A table of objects that display the contents of a cell,
      * indexed by class as declared in <code>getColumnClass</code>
      * in the <code>TableModel</code> interface.
      */
-    transient protected Hashtable defaultRenderersByColumnClass;
+    transient protected Hashtable<Object, Object> defaultRenderersByColumnClass;
+    // Logicaly, the above is a Hashtable<Class<?>, TableCellRenderer>.
+    // It is declared otherwise to accomodate using UIDefaults.
 
     /**
      * A table of objects that display and edit the contents of a cell,
      * indexed by class as declared in <code>getColumnClass</code>
      * in the <code>TableModel</code> interface.
      */
-    transient protected Hashtable defaultEditorsByColumnClass;
+    transient protected Hashtable<Object, Object> defaultEditorsByColumnClass;
+    // Logicaly, the above is a Hashtable<Class<?>, TableCellEditor>.
+    // It is declared otherwise to accomodate using UIDefaults.
 
     /** The foreground color of selected cells. */
     protected Color selectionForeground;
@@ -665,7 +669,7 @@
      * @param rowData           the data for the new table
      * @param columnNames       names of each column
      */
-    public JTable(Vector rowData, Vector columnNames) {
+    public JTable(Vector<Vector<Object>> rowData, Vector<Object> columnNames) {
         this(new DefaultTableModel(rowData, columnNames));
     }
 
@@ -1338,7 +1342,7 @@
                 return (TableCellRenderer)renderer;
             }
             else {
-                Class c = columnClass.getSuperclass();
+                Class<?> c = columnClass.getSuperclass();
                 if (c == null && columnClass != Object.class) {
                     c = Object.class;
                 }
@@ -2621,7 +2625,7 @@
      * @since 1.6
      */
     public int convertRowIndexToView(int modelRowIndex) {
-        RowSorter sorter = getRowSorter();
+        RowSorter<?> sorter = getRowSorter();
         if (sorter != null) {
             return sorter.convertRowIndexToView(modelRowIndex);
         }
@@ -2643,7 +2647,7 @@
      * @since 1.6
      */
     public int convertRowIndexToModel(int viewRowIndex) {
-        RowSorter sorter = getRowSorter();
+        RowSorter<?> sorter = getRowSorter();
         if (sorter != null) {
             return sorter.convertRowIndexToModel(viewRowIndex);
         }
@@ -2661,7 +2665,7 @@
      * @see #getColumnCount
      */
     public int getRowCount() {
-        RowSorter sorter = getRowSorter();
+        RowSorter<?> sorter = getRowSorter();
         if (sorter != null) {
             return sorter.getViewRowCount();
         }
@@ -3631,13 +3635,13 @@
         }
 
         // Update the UIs of all the default renderers.
-        Enumeration defaultRenderers = defaultRenderersByColumnClass.elements();
+        Enumeration<?> defaultRenderers = defaultRenderersByColumnClass.elements();
         while (defaultRenderers.hasMoreElements()) {
             SwingUtilities.updateRendererOrEditorUI(defaultRenderers.nextElement());
         }
 
         // Update the UIs of all the default editors.
-        Enumeration defaultEditors = defaultEditorsByColumnClass.elements();
+        Enumeration<?> defaultEditors = defaultEditorsByColumnClass.elements();
         while (defaultEditors.hasMoreElements()) {
             SwingUtilities.updateRendererOrEditorUI(defaultEditors.nextElement());
         }
@@ -5451,8 +5455,8 @@
      */
     static class GenericEditor extends DefaultCellEditor {
 
-        Class[] argTypes = new Class[]{String.class};
-        java.lang.reflect.Constructor constructor;
+        Class<?>[] argTypes = new Class<?>[]{String.class};
+        java.lang.reflect.Constructor<?> constructor;
         Object value;
 
         public GenericEditor() {
--- a/src/share/classes/javax/swing/JTextField.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JTextField.java	Fri Jul 18 08:25:58 2014 -0700
@@ -587,7 +587,7 @@
         }
     }
 
-    private boolean isListener(Class c, ActionListener a) {
+    private boolean isListener(Class<?> c, ActionListener a) {
         boolean isListener = false;
         Object[] listeners = listenerList.getListenerList();
         for (int i = listeners.length-2; i>=0; i-=2) {
--- a/src/share/classes/javax/swing/JTree.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/JTree.java	Fri Jul 18 08:25:58 2014 -0700
@@ -4032,7 +4032,7 @@
         /**
          * Subclassed to load the children, if necessary.
          */
-        public Enumeration children() {
+        public Enumeration<TreeNode> children() {
             if(!loadedChildren)
                 loadChildren();
             return super.children();
--- a/src/share/classes/javax/swing/KeyboardManager.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/KeyboardManager.java	Fri Jul 18 08:25:58 2014 -0700
@@ -68,13 +68,13 @@
     /**
       * maps top-level containers to a sub-hashtable full of keystrokes
       */
-    Hashtable<Container, Hashtable> containerMap = new Hashtable<Container, Hashtable>();
+    Hashtable<Container, Hashtable<Object, Object>> containerMap = new Hashtable<>();
 
     /**
       * Maps component/keystroke pairs to a topLevel container
       * This is mainly used for fast unregister operations
       */
-    Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<ComponentKeyStrokePair, Container>();
+    Hashtable<ComponentKeyStrokePair, Container> componentKeyStrokeMap = new Hashtable<>();
 
     public static KeyboardManager getCurrentManager() {
         return currentManager;
@@ -95,7 +95,7 @@
          if (topContainer == null) {
              return;
          }
-         Hashtable keyMap = containerMap.get(topContainer);
+         Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
 
          if (keyMap ==  null) {  // lazy evaluate one
              keyMap = registerNewTopContainer(topContainer);
@@ -105,7 +105,8 @@
          if (tmp == null) {
              keyMap.put(k,c);
          } else if (tmp instanceof Vector) {  // if there's a Vector there then add to it.
-             Vector v = (Vector)tmp;
+             @SuppressWarnings("unchecked")
+             Vector<Object> v = (Vector)tmp;
              if (!v.contains(c)) {  // only add if this keystroke isn't registered for this component
                  v.addElement(c);
              }
@@ -114,7 +115,7 @@
            // Then add the old compoennt and the new compoent to the vector
            // then insert the vector in the table
            if (tmp != c) {  // this means this is already registered for this component, no need to dup
-               Vector<JComponent> v = new Vector<JComponent>();
+               Vector<JComponent> v = new Vector<>();
                v.addElement((JComponent) tmp);
                v.addElement(c);
                keyMap.put(k, v);
@@ -160,7 +161,7 @@
              return;
          }
 
-         Hashtable keyMap = containerMap.get(topContainer);
+         Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
          if  (keyMap == null) { // this should never happen, but I'm being safe
              Thread.dumpStack();
              return;
@@ -176,7 +177,7 @@
              keyMap.remove(ks);  // remove the KeyStroke from the Map
              //System.out.println("removed a stroke" + ks);
          } else if (tmp instanceof Vector ) {  // this means there is more than one component reg for this key
-             Vector v = (Vector)tmp;
+             Vector<?> v = (Vector)tmp;
              v.removeElement(c);
              if ( v.isEmpty() ) {
                  keyMap.remove(ks);  // remove the KeyStroke from the Map
@@ -227,7 +228,7 @@
                ks=KeyStroke.getKeyStroke(e.getKeyCode(), e.getModifiers(), !pressed);
          }
 
-         Hashtable keyMap = containerMap.get(topAncestor);
+         Hashtable<Object, Object> keyMap = containerMap.get(topAncestor);
          if (keyMap != null) { // this container isn't registered, so bail
 
              Object tmp = null;
@@ -250,7 +251,7 @@
                      fireBinding(c, ks, e, pressed);
                  }
              } else if ( tmp instanceof Vector) { //more than one comp registered for this
-                 Vector v = (Vector)tmp;
+                 Vector<?> v = (Vector)tmp;
                  // There is no well defined order for WHEN_IN_FOCUSED_WINDOW
                  // bindings, but we give precedence to those bindings just
                  // added. This is done so that JMenus WHEN_IN_FOCUSED_WINDOW
@@ -279,11 +280,12 @@
          // The're handled differently.  The key is to let any JMenuBars
          // process the event
          if ( keyMap != null) {
-             Vector v = (Vector)keyMap.get(JMenuBar.class);
+             @SuppressWarnings("unchecked")
+             Vector<JMenuBar> v = (Vector)keyMap.get(JMenuBar.class);
              if (v != null) {
-                 Enumeration iter = v.elements();
+                 Enumeration<JMenuBar> iter = v.elements();
                  while (iter.hasMoreElements()) {
-                     JMenuBar mb = (JMenuBar)iter.nextElement();
+                     JMenuBar mb = iter.nextElement();
                      if ( mb.isShowing() && mb.isEnabled() ) { // don't want to give these out
                          boolean extended = (ksE != null) && !ksE.equals(ks);
                          if (extended) {
@@ -315,17 +317,18 @@
         if (top == null) {
             return;
         }
-        Hashtable keyMap = containerMap.get(top);
+        Hashtable<Object, Object> keyMap = containerMap.get(top);
 
         if (keyMap ==  null) {  // lazy evaluate one
              keyMap = registerNewTopContainer(top);
         }
         // use the menubar class as the key
-        Vector menuBars = (Vector)keyMap.get(JMenuBar.class);
+        @SuppressWarnings("unchecked")
+        Vector<Object> menuBars = (Vector)keyMap.get(JMenuBar.class);
 
         if (menuBars == null) {  // if we don't have a list of menubars,
                                  // then make one.
-            menuBars = new Vector();
+            menuBars = new Vector<>();
             keyMap.put(JMenuBar.class, menuBars);
         }
 
@@ -340,9 +343,9 @@
         if (topContainer == null) {
             return;
         }
-        Hashtable keyMap = containerMap.get(topContainer);
+        Hashtable<Object, Object> keyMap = containerMap.get(topContainer);
         if (keyMap!=null) {
-            Vector v = (Vector)keyMap.get(JMenuBar.class);
+            Vector<?> v = (Vector)keyMap.get(JMenuBar.class);
             if (v != null) {
                 v.removeElement(mb);
                 if (v.isEmpty()) {
@@ -355,8 +358,8 @@
             }
         }
     }
-    protected Hashtable registerNewTopContainer(Container topContainer) {
-             Hashtable keyMap = new Hashtable();
+    protected Hashtable<Object, Object> registerNewTopContainer(Container topContainer) {
+             Hashtable<Object, Object> keyMap = new Hashtable<>();
              containerMap.put(topContainer, keyMap);
              return keyMap;
     }
--- a/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/LayoutFocusTraversalPolicy.java	Fri Jul 18 08:25:58 2014 -0700
@@ -98,7 +98,7 @@
         if (aContainer == null || aComponent == null) {
             throw new IllegalArgumentException("aContainer and aComponent cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
@@ -134,7 +134,7 @@
         if (aContainer == null || aComponent == null) {
             throw new IllegalArgumentException("aContainer and aComponent cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
@@ -158,7 +158,7 @@
         if (aContainer == null) {
             throw new IllegalArgumentException("aContainer cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
@@ -182,7 +182,7 @@
         if (aContainer == null) {
             throw new IllegalArgumentException("aContainer cannot be null");
         }
-        Comparator comparator = getComparator();
+        Comparator<? super Component> comparator = getComparator();
         if (comparator instanceof LayoutComparator) {
             ((LayoutComparator)comparator).
                 setComponentOrientation(aContainer.
@@ -233,7 +233,7 @@
             // to be focusable by returning true here.
             return true;
         } else if (SunToolkit.isInstanceOf(aComponent, "javax.swing.JComboBox")) {
-            JComboBox box = (JComboBox)aComponent;
+            JComboBox<?> box = (JComboBox)aComponent;
             return box.getUI().isFocusTraversable(box);
         } else if (aComponent instanceof JComponent) {
             JComponent jComponent = (JComponent)aComponent;
@@ -256,10 +256,11 @@
         out.writeObject(getComparator());
         out.writeBoolean(getImplicitDownCycleTraversal());
     }
+    @SuppressWarnings("unchecked") // Cast to (Comparator<? super Component>)
     private void readObject(ObjectInputStream in)
         throws IOException, ClassNotFoundException
     {
-        setComparator((Comparator)in.readObject());
+        setComparator((Comparator<? super Component>)in.readObject());
         setImplicitDownCycleTraversal(in.readBoolean());
     }
 }
--- a/src/share/classes/javax/swing/MenuSelectionManager.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/MenuSelectionManager.java	Fri Jul 18 08:25:58 2014 -0700
@@ -222,7 +222,6 @@
         MenuElement menuElement;
         MenuElement subElements[];
         MenuElement path[];
-        Vector<MenuElement> tmp;
         int selectionSize;
         p = event.getPoint();
 
@@ -251,7 +250,8 @@
         screenX = p.x;
         screenY = p.y;
 
-        tmp = (Vector<MenuElement>)selection.clone();
+        @SuppressWarnings("unchecked")
+        Vector<MenuElement> tmp = (Vector<MenuElement>)selection.clone();
         selectionSize = tmp.size();
         boolean success = false;
         for (i=selectionSize - 1;i >= 0 && success == false; i--) {
@@ -386,7 +386,6 @@
         int cWidth,cHeight;
         MenuElement menuElement;
         MenuElement subElements[];
-        Vector<MenuElement> tmp;
         int selectionSize;
 
         SwingUtilities.convertPointToScreen(p,source);
@@ -394,7 +393,8 @@
         screenX = p.x;
         screenY = p.y;
 
-        tmp = (Vector<MenuElement>)selection.clone();
+        @SuppressWarnings("unchecked")
+        Vector<MenuElement> tmp = (Vector<MenuElement>)selection.clone();
         selectionSize = tmp.size();
         for(i=selectionSize - 1 ; i >= 0 ; i--) {
             menuElement = tmp.elementAt(i);
--- a/src/share/classes/javax/swing/MultiUIDefaults.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/MultiUIDefaults.java	Fri Jul 18 08:25:58 2014 -0700
@@ -192,7 +192,7 @@
     public synchronized String toString() {
         StringBuilder sb = new StringBuilder();
         sb.append("{");
-        Enumeration keys = keys();
+        Enumeration<?> keys = keys();
         while (keys.hasMoreElements()) {
             Object key = keys.nextElement();
             sb.append(key + "=" + get(key) + ", ");
--- a/src/share/classes/javax/swing/PopupFactory.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/PopupFactory.java	Fri Jul 18 08:25:58 2014 -0700
@@ -243,7 +243,8 @@
         case HEAVY_WEIGHT_POPUP:
             Popup popup = getHeavyWeightPopup(owner, contents, ownerX, ownerY);
             if ((AccessController.doPrivileged(OSInfo.getOSTypeAction()) ==
-                OSInfo.OSType.MACOSX) && (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
+                OSInfo.OSType.MACOSX) && (owner != null) &&
+                (EmbeddedFrame.getAppletIfAncestorOf(owner) != null)) {
                 ((HeavyWeightPopup)popup).setCacheEnabled(false);
             }
             return popup;
@@ -401,13 +402,14 @@
          * <code>Window</code> to a <code>List</code> of
          * <code>HeavyWeightPopup</code>s.
          */
+        @SuppressWarnings("unchecked")
         private static Map<Window, List<HeavyWeightPopup>> getHeavyWeightPopupCache() {
             synchronized (HeavyWeightPopup.class) {
                 Map<Window, List<HeavyWeightPopup>> cache = (Map<Window, List<HeavyWeightPopup>>)SwingUtilities.appContextGet(
                                   heavyWeightPopupCacheKey);
 
                 if (cache == null) {
-                    cache = new HashMap<Window, List<HeavyWeightPopup>>(2);
+                    cache = new HashMap<>(2);
                     SwingUtilities.appContextPut(heavyWeightPopupCacheKey,
                                                  cache);
                 }
@@ -698,11 +700,12 @@
         /**
          * Returns the cache to use for heavy weight popups.
          */
+        @SuppressWarnings("unchecked")
         private static List<LightWeightPopup> getLightWeightPopupCache() {
             List<LightWeightPopup> cache = (List<LightWeightPopup>)SwingUtilities.appContextGet(
                                    lightWeightPopupCacheKey);
             if (cache == null) {
-                cache = new ArrayList<LightWeightPopup>();
+                cache = new ArrayList<>();
                 SwingUtilities.appContextPut(lightWeightPopupCacheKey, cache);
             }
             return cache;
@@ -854,12 +857,13 @@
         /**
          * Returns the cache to use for medium weight popups.
          */
+        @SuppressWarnings("unchecked")
         private static List<MediumWeightPopup> getMediumWeightPopupCache() {
             List<MediumWeightPopup> cache = (List<MediumWeightPopup>)SwingUtilities.appContextGet(
                                     mediumWeightPopupCacheKey);
 
             if (cache == null) {
-                cache = new ArrayList<MediumWeightPopup>();
+                cache = new ArrayList<>();
                 SwingUtilities.appContextPut(mediumWeightPopupCacheKey, cache);
             }
             return cache;
--- a/src/share/classes/javax/swing/RowFilter.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/RowFilter.java	Fri Jul 18 08:25:58 2014 -0700
@@ -175,8 +175,7 @@
      */
     public static <M,I> RowFilter<M,I> regexFilter(String regex,
                                                        int... indices) {
-        return (RowFilter<M,I>)new RegexFilter(Pattern.compile(regex),
-                                               indices);
+        return new RegexFilter<M, I>(Pattern.compile(regex), indices);
     }
 
     /**
@@ -205,7 +204,7 @@
      */
     public static <M,I> RowFilter<M,I> dateFilter(ComparisonType type,
                                             Date date, int... indices) {
-        return (RowFilter<M,I>)new DateFilter(type, date.getTime(), indices);
+        return new DateFilter<M, I>(type, date.getTime(), indices);
     }
 
     /**
@@ -231,7 +230,7 @@
      */
     public static <M,I> RowFilter<M,I> numberFilter(ComparisonType type,
                                             Number number, int... indices) {
-        return (RowFilter<M,I>)new NumberFilter(type, number, indices);
+        return new NumberFilter<M, I>(type, number, indices);
     }
 
     /**
@@ -410,7 +409,7 @@
     }
 
 
-    private static abstract class GeneralFilter extends RowFilter<Object,Object> {
+    private static abstract class GeneralFilter<M, I> extends RowFilter<M, I> {
         private int[] columns;
 
         GeneralFilter(int[] columns) {
@@ -418,7 +417,8 @@
             this.columns = columns;
         }
 
-        public boolean include(Entry<? extends Object,? extends Object> value){
+        @Override
+        public boolean include(Entry<? extends M, ? extends I> value){
             int count = value.getValueCount();
             if (columns.length > 0) {
                 for (int i = columns.length - 1; i >= 0; i--) {
@@ -429,8 +429,7 @@
                         }
                     }
                 }
-            }
-            else {
+            } else {
                 while (--count >= 0) {
                     if (include(value, count)) {
                         return true;
@@ -441,11 +440,11 @@
         }
 
         protected abstract boolean include(
-              Entry<? extends Object,? extends Object> value, int index);
+              Entry<? extends M, ? extends I> value, int index);
     }
 
 
-    private static class RegexFilter extends GeneralFilter {
+    private static class RegexFilter<M, I> extends GeneralFilter<M, I> {
         private Matcher matcher;
 
         RegexFilter(Pattern regex, int[] columns) {
@@ -456,15 +455,16 @@
             matcher = regex.matcher("");
         }
 
+        @Override
         protected boolean include(
-                Entry<? extends Object,? extends Object> value, int index) {
+                Entry<? extends M, ? extends I> value, int index) {
             matcher.reset(value.getStringValue(index));
             return matcher.find();
         }
     }
 
 
-    private static class DateFilter extends GeneralFilter {
+    private static class DateFilter<M, I> extends GeneralFilter<M, I> {
         private long date;
         private ComparisonType type;
 
@@ -477,8 +477,9 @@
             this.date = date;
         }
 
+        @Override
         protected boolean include(
-                Entry<? extends Object,? extends Object> value, int index) {
+                Entry<? extends M, ? extends I> value, int index) {
             Object v = value.getValue(index);
 
             if (v instanceof Date) {
@@ -500,10 +501,7 @@
         }
     }
 
-
-
-
-    private static class NumberFilter extends GeneralFilter {
+    private static class NumberFilter<M, I> extends GeneralFilter<M, I> {
         private boolean isComparable;
         private Number number;
         private ComparisonType type;
@@ -519,15 +517,16 @@
             isComparable = (number instanceof Comparable);
         }
 
+        @Override
         @SuppressWarnings("unchecked")
         protected boolean include(
-                Entry<? extends Object,? extends Object> value, int index) {
+                Entry<? extends M, ? extends I> value, int index) {
             Object v = value.getValue(index);
 
             if (v instanceof Number) {
                 boolean compared = true;
                 int compareResult;
-                Class vClass = v.getClass();
+                Class<?> vClass = v.getClass();
                 if (number.getClass() == vClass && isComparable) {
                     compareResult = ((Comparable)number).compareTo(v);
                 }
--- a/src/share/classes/javax/swing/ScrollPaneLayout.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/ScrollPaneLayout.java	Fri Jul 18 08:25:58 2014 -0700
@@ -823,10 +823,7 @@
         Rectangle vsbR = new Rectangle(0, availR.y - vpbInsets.top, 0, 0);
 
         boolean vsbNeeded;
-        if (isEmpty) {
-            vsbNeeded = false;
-        }
-        else if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
+        if (vsbPolicy == VERTICAL_SCROLLBAR_ALWAYS) {
             vsbNeeded = true;
         }
         else if (vsbPolicy == VERTICAL_SCROLLBAR_NEVER) {
@@ -849,10 +846,7 @@
 
         Rectangle hsbR = new Rectangle(availR.x - vpbInsets.left, 0, 0, 0);
         boolean hsbNeeded;
-        if (isEmpty) {
-            hsbNeeded = false;
-        }
-        else if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
+        if (hsbPolicy == HORIZONTAL_SCROLLBAR_ALWAYS) {
             hsbNeeded = true;
         }
         else if (hsbPolicy == HORIZONTAL_SCROLLBAR_NEVER) {
--- a/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java	Fri Jul 18 08:25:58 2014 -0700
@@ -30,6 +30,11 @@
 import java.util.*;
 import java.awt.FocusTraversalPolicy;
 import sun.util.logging.PlatformLogger;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import sun.security.action.GetPropertyAction;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 /**
  * A FocusTraversalPolicy that determines traversal order by sorting the
@@ -89,6 +94,34 @@
     final private int FORWARD_TRAVERSAL = 0;
     final private int BACKWARD_TRAVERSAL = 1;
 
+    /*
+     * When true (by default), the legacy merge-sort algo is used to sort an FTP cycle.
+     * When false, the default (tim-sort) algo is used, which may lead to an exception.
+     * See: JDK-8048887
+     */
+    private static final boolean legacySortingFTPEnabled;
+    private static final Method legacyMergeSortMethod;
+
+    static {
+        legacySortingFTPEnabled = "true".equals(AccessController.doPrivileged(
+            new GetPropertyAction("swing.legacySortingFTPEnabled", "true")));
+        legacyMergeSortMethod = legacySortingFTPEnabled ?
+            AccessController.doPrivileged(new PrivilegedAction<Method>() {
+                public Method run() {
+                    try {
+                        Class c = Class.forName("java.util.Arrays");
+                        Method m = c.getDeclaredMethod("legacyMergeSort", new Class[]{Object[].class, Comparator.class});
+                        m.setAccessible(true);
+                        return m;
+                    } catch (ClassNotFoundException | NoSuchMethodException e) {
+                        // using default sorting algo
+                        return null;
+                    }
+                }
+            }) :
+            null;
+    }
+
     /**
      * Constructs a SortingFocusTraversalPolicy without a Comparator.
      * Subclasses must set the Comparator using <code>setComparator</code>
@@ -135,10 +168,32 @@
     private void enumerateAndSortCycle(Container focusCycleRoot, List<Component> cycle) {
         if (focusCycleRoot.isShowing()) {
             enumerateCycle(focusCycleRoot, cycle);
-            Collections.sort(cycle, comparator);
+            if (!legacySortingFTPEnabled ||
+                !legacySort(cycle, comparator))
+            {
+                Collections.sort(cycle, comparator);
+            }
         }
     }
 
+    private boolean legacySort(List<Component> l, Comparator<? super Component> c) {
+        if (legacyMergeSortMethod == null)
+            return false;
+
+        Object[] a = l.toArray();
+        try {
+            legacyMergeSortMethod.invoke(null, a, c);
+        } catch (IllegalAccessException | InvocationTargetException e) {
+            return false;
+        }
+        ListIterator<Component> i = l.listIterator();
+        for (Object e : a) {
+            i.next();
+            i.set((Component)e);
+        }
+        return true;
+    }
+
     private void enumerateCycle(Container container, List<Component> cycle) {
         if (!(container.isVisible() && container.isDisplayable())) {
             return;
--- a/src/share/classes/javax/swing/SpinnerDateModel.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/SpinnerDateModel.java	Fri Jul 18 08:25:58 2014 -0700
@@ -89,7 +89,7 @@
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 public class SpinnerDateModel extends AbstractSpinnerModel implements Serializable
 {
-    private Comparable start, end;
+    private Comparable<Date> start, end;
     private Calendar value;
     private int calendarField;
 
@@ -173,7 +173,7 @@
      * @see #setEnd
      * @see #setCalendarField
      */
-    public SpinnerDateModel(Date value, Comparable start, Comparable end, int calendarField) {
+    public SpinnerDateModel(Date value, Comparable<Date> start, Comparable<Date> end, int calendarField) {
         if (value == null) {
             throw new IllegalArgumentException("value is null");
         }
@@ -241,7 +241,7 @@
      * @see #setEnd
      * @see #addChangeListener
      */
-    public void setStart(Comparable start) {
+    public void setStart(Comparable<Date> start) {
         if ((start == null) ? (this.start != null) : !start.equals(this.start)) {
             this.start = start;
             fireStateChanged();
@@ -255,7 +255,7 @@
      * @return the value of the <code>start</code> property
      * @see #setStart
      */
-    public Comparable getStart() {
+    public Comparable<Date> getStart() {
         return start;
     }
 
@@ -282,7 +282,7 @@
      * @see #setStart
      * @see #addChangeListener
      */
-    public void setEnd(Comparable end) {
+    public void setEnd(Comparable<Date> end) {
         if ((end == null) ? (this.end != null) : !end.equals(this.end)) {
             this.end = end;
             fireStateChanged();
@@ -296,7 +296,7 @@
      * @return the value of the <code>end</code> property
      * @see #setEnd
      */
-    public Comparable getEnd() {
+    public Comparable<Date> getEnd() {
         return end;
     }
 
--- a/src/share/classes/javax/swing/SpinnerListModel.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/SpinnerListModel.java	Fri Jul 18 08:25:58 2014 -0700
@@ -59,7 +59,7 @@
 @SuppressWarnings("serial") // Superclass is not serializable across versions
 public class SpinnerListModel extends AbstractSpinnerModel implements Serializable
 {
-    private List list;
+    private List<?> list;
     private int index;
 
 
--- a/src/share/classes/javax/swing/SpinnerNumberModel.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/SpinnerNumberModel.java	Fri Jul 18 08:25:58 2014 -0700
@@ -84,7 +84,16 @@
 public class SpinnerNumberModel extends AbstractSpinnerModel implements Serializable
 {
     private Number stepSize, value;
-    private Comparable minimum, maximum;
+    // Both minimum and maximum are logically Comparable<? extends
+    // Number>, but that type is awkward to use since different
+    // instances of Number are not naturally Comparable. For example,
+    // a Double implements Comparable<Double> and an Integer
+    // implements Comparable<Integer>. Neither Integer nor Double will
+    // have a bridge method for Comparable<Number>. However, it safe
+    // to cast Comparable<?> to Comparable<Object> since all
+    // Comparables will have a compare(Object> method, possibly as a
+    // bridge.
+    private Comparable<?> minimum, maximum;
 
 
     /**
@@ -117,12 +126,16 @@
      *     <code>null</code> or if the following expression is false:
      *     <code>minimum &lt;= value &lt;= maximum</code>
      */
-    public SpinnerNumberModel(Number value, Comparable minimum, Comparable maximum, Number stepSize) {
+    @SuppressWarnings("unchecked") // Casts to Comparable<Object>
+    public SpinnerNumberModel(Number value,
+                               Comparable<?> minimum,
+                               Comparable<?> maximum,
+                               Number stepSize) {
         if ((value == null) || (stepSize == null)) {
             throw new IllegalArgumentException("value and stepSize must be non-null");
         }
-        if (!(((minimum == null) || (minimum.compareTo(value) <= 0)) &&
-              ((maximum == null) || (maximum.compareTo(value) >= 0)))) {
+        if (!(((minimum == null) || (((Comparable<Object>)minimum).compareTo(value) <= 0)) &&
+              ((maximum == null) || (((Comparable<Object>)maximum).compareTo(value) >= 0)))) {
             throw new IllegalArgumentException("(minimum <= value <= maximum) is false");
         }
         this.value = value;
@@ -212,7 +225,7 @@
      * @see #setMaximum
      * @see SpinnerModel#addChangeListener
      */
-    public void setMinimum(Comparable minimum) {
+    public void setMinimum(Comparable<?> minimum) {
         if ((minimum == null) ? (this.minimum != null) : !minimum.equals(this.minimum)) {
             this.minimum = minimum;
             fireStateChanged();
@@ -226,7 +239,7 @@
      * @return the value of the <code>minimum</code> property
      * @see #setMinimum
      */
-    public Comparable getMinimum() {
+    public Comparable<?> getMinimum() {
         return minimum;
     }
 
@@ -259,7 +272,7 @@
      * @see #setMinimum
      * @see SpinnerModel#addChangeListener
      */
-    public void setMaximum(Comparable maximum) {
+    public void setMaximum(Comparable<?> maximum) {
         if ((maximum == null) ? (this.maximum != null) : !maximum.equals(this.maximum)) {
             this.maximum = maximum;
             fireStateChanged();
@@ -273,7 +286,7 @@
      * @return the value of the <code>maximum</code> property
      * @see #setMaximum
      */
-    public Comparable getMaximum() {
+    public Comparable<?> getMaximum() {
         return maximum;
     }
 
@@ -317,7 +330,7 @@
         return stepSize;
     }
 
-
+    @SuppressWarnings("unchecked") // Casts to Comparable<Object>
     private Number incrValue(int dir)
     {
         Number newValue;
@@ -329,8 +342,7 @@
             else {
                 newValue = new Float(v);
             }
-        }
-        else {
+        } else {
             long v = value.longValue() + (stepSize.longValue() * (long)dir);
 
             if (value instanceof Long) {
@@ -347,10 +359,10 @@
             }
         }
 
-        if ((maximum != null) && (maximum.compareTo(newValue) < 0)) {
+        if ((maximum != null) && (((Comparable<Object>)maximum).compareTo(newValue) < 0)) {
             return null;
         }
-        if ((minimum != null) && (minimum.compareTo(newValue) > 0)) {
+        if ((minimum != null) && (((Comparable<Object>)minimum).compareTo(newValue) > 0)) {
             return null;
         }
         else {
--- a/src/share/classes/javax/swing/SpringLayout.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/SpringLayout.java	Fri Jul 18 08:25:58 2014 -0700
@@ -495,7 +495,7 @@
             };
         }
 
-        private boolean defined(List history, String s1, String s2) {
+        private boolean defined(List<?> history, String s1, String s2) {
             return history.contains(s1) && history.contains(s2);
         }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/javax/swing/SwingContainer.java	Fri Jul 18 08:25:58 2014 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package javax.swing;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+
+import static java.lang.annotation.ElementType.TYPE;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+/**
+ * An annotation used to specify some swing-related information
+ * for the automatically generated {@code BeanInfo} classes.
+ * This annotation is not used if the annotated class
+ * has a corresponding user-defined {@code BeanInfo} class,
+ * which does not imply the automatic analysis.
+ * <p>
+ * The {@code isContainer} {@link java.beans.BeanDescriptor#getValue
+ * feature attribute} was introduced primarily for the Swing library.
+ * All Swing components extend the {@link java.awt.Container Container}
+ * class by design, so the builder tool assumes that all Swing components
+ * are containers.  The {@link java.beans.BeanInfo BeanInfo} classes
+ * with the {@code isContainer} attribute allow to directly specify
+ * whether a Swing component is a container or not.
+ *
+ * @since 1.9
+ *
+ * @author Sergey A. Malenkov
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface SwingContainer {
+    /**
+     * The value that indicates whether the annotated class can be used
+     * as a container for other Swing components or not.
+     *
+     * @return {@code true} if the annotated class is a Swing container;
+     *         {@code false} otherwise.
+     */
+    boolean value() default true;
+
+    /**
+     * The name of the getter method in the annotated class,
+     * which returns the corresponding Swing container,
+     * if it is not recommended to add subcomponents
+     * to the annotated class directly.
+     *
+     * @return the name of the getter method in the annotated class,
+     *         which returns the corresponding Swing container,
+     *         or an empty string if the method name is not set.
+     */
+    String delegate() default "";
+}
--- a/src/share/classes/javax/swing/SwingWorker.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/SwingWorker.java	Fri Jul 18 08:25:58 2014 -0700
@@ -820,7 +820,9 @@
                 doSubmit = new DoSubmitAccumulativeRunnable();
                 appContext.put(DO_SUBMIT_KEY, doSubmit);
             }
-            return (AccumulativeRunnable<Runnable>) doSubmit;
+            @SuppressWarnings("unchecked")
+            AccumulativeRunnable<Runnable> tmp = (AccumulativeRunnable<Runnable>) doSubmit;
+            return tmp;
         }
     }
     private static class DoSubmitAccumulativeRunnable
--- a/src/share/classes/javax/swing/UIDefaults.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/UIDefaults.java	Fri Jul 18 08:25:58 2014 -0700
@@ -311,10 +311,10 @@
                     } else {
                         b = ResourceBundle.getBundle(bundleName, l);
                     }
-                    Enumeration keys = b.getKeys();
+                    Enumeration<String> keys = b.getKeys();
 
                     while (keys.hasMoreElements()) {
-                        String key = (String)keys.nextElement();
+                        String key = keys.nextElement();
 
                         if (values.get(key) == null) {
                             Object value = b.getObject(key);
@@ -682,7 +682,7 @@
             if (className != null) {
                 ReflectUtil.checkPackageAccess(className);
 
-                Class cls = (Class)get(className);
+                Class<?> cls = (Class)get(className);
                 if (cls == null) {
                     if (uiClassLoader == null) {
                         cls = SwingUtilities.loadSystemClass(className);
@@ -695,13 +695,12 @@
                         put(className, cls);
                     }
                 }
-                return cls;
+                @SuppressWarnings("unchecked")
+                Class<? extends ComponentUI> tmp = (Class<? extends ComponentUI>)cls;
+                return tmp;
             }
         }
-        catch (ClassNotFoundException e) {
-            return null;
-        }
-        catch (ClassCastException e) {
+        catch (ClassNotFoundException | ClassCastException e) {
             return null;
         }
         return null;
@@ -767,7 +766,7 @@
             try {
                 Method m = (Method)get(uiClass);
                 if (m == null) {
-                    m = uiClass.getMethod("createUI", new Class[]{JComponent.class});
+                    m = uiClass.getMethod("createUI", new Class<?>[]{JComponent.class});
                     put(uiClass, m);
                 }
                 uiObject = MethodUtil.invoke(m, null, new Object[]{target});
@@ -1106,12 +1105,12 @@
                         c = Class.forName(className, true, (ClassLoader)cl);
                         SwingUtilities2.checkAccess(c.getModifiers());
                         if (methodName != null) {
-                            Class[] types = getClassArray(args);
+                            Class<?>[] types = getClassArray(args);
                             Method m = c.getMethod(methodName, types);
                             return MethodUtil.invoke(m, c, args);
                         } else {
-                            Class[] types = getClassArray(args);
-                            Constructor constructor = c.getConstructor(types);
+                            Class<?>[] types = getClassArray(args);
+                            Constructor<?> constructor = c.getConstructor(types);
                             SwingUtilities2.checkAccess(constructor.getModifiers());
                             return constructor.newInstance(args);
                         }
@@ -1134,10 +1133,10 @@
          * and superclasses for subclasses used to add the
          * <code>UIResource</code> tag.
          */
-        private Class[] getClassArray(Object[] args) {
-            Class[] types = null;
+        private Class<?>[] getClassArray(Object[] args) {
+            Class<?>[] types = null;
             if (args!=null) {
-                types = new Class[args.length];
+                types = new Class<?>[args.length];
                 for (int i = 0; i< args.length; i++) {
                     /* PENDING(ges): At present only the primitive types
                        used are handled correctly; this should eventually
--- a/src/share/classes/javax/swing/UIManager.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/UIManager.java	Fri Jul 18 08:25:58 2014 -0700
@@ -581,7 +581,7 @@
             setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel());
         }
         else {
-            Class lnfClass = SwingUtilities.loadSystemClass(className);
+            Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
             setLookAndFeel((LookAndFeel)(lnfClass.newInstance()));
         }
     }
@@ -1049,7 +1049,7 @@
             String defaultName = "javax.swing.plaf.multi.MultiLookAndFeel";
             String className = getLAFState().swingProps.getProperty(multiplexingLAFKey, defaultName);
             try {
-                Class lnfClass = SwingUtilities.loadSystemClass(className);
+                Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
                 multiLookAndFeel = (LookAndFeel)lnfClass.newInstance();
             } catch (Exception exc) {
                 System.err.println("UIManager: failed loading " + className);
@@ -1339,10 +1339,11 @@
         // Try to get default LAF from system property, then from AppContext
         // (6653395), then use cross-platform one by default.
         String lafName = null;
-        HashMap lafData =
+        @SuppressWarnings("unchecked")
+        HashMap<Object, String> lafData =
                 (HashMap) AppContext.getAppContext().remove("swing.lafdata");
         if (lafData != null) {
-            lafName = (String) lafData.remove("defaultlaf");
+            lafName = lafData.remove("defaultlaf");
         }
         if (lafName == null) {
             lafName = getCrossPlatformLookAndFeelClassName();
@@ -1382,7 +1383,7 @@
         while (p.hasMoreTokens()) {
             String className = p.nextToken();
             try {
-                Class lnfClass = SwingUtilities.loadSystemClass(className);
+                Class<?> lnfClass = SwingUtilities.loadSystemClass(className);
                 LookAndFeel newLAF = (LookAndFeel)lnfClass.newInstance();
                 newLAF.initialize();
                 auxLookAndFeels.addElement(newLAF);
--- a/src/share/classes/javax/swing/event/EventListenerList.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/event/EventListenerList.java	Fri Jul 18 08:25:58 2014 -0700
@@ -141,11 +141,14 @@
     public <T extends EventListener> T[] getListeners(Class<T> t) {
         Object[] lList = listenerList;
         int n = getListenerCount(lList, t);
+        @SuppressWarnings("unchecked")
         T[] result = (T[])Array.newInstance(t, n);
         int j = 0;
         for (int i = lList.length-2; i>=0; i-=2) {
             if (lList[i] == t) {
-                result[j++] = (T)lList[i+1];
+                @SuppressWarnings("unchecked")
+                T tmp = (T)lList[i+1];
+                result[j++] = tmp;
             }
         }
         return result;
@@ -172,7 +175,7 @@
         return getListenerCount(lList, t);
     }
 
-    private int getListenerCount(Object[] list, Class t) {
+    private int getListenerCount(Object[] list, Class<?> t) {
         int count = 0;
         for (int i = 0; i < list.length; i+=2) {
             if (t == (Class)list[i])
@@ -288,7 +291,9 @@
             EventListener l = (EventListener)s.readObject();
             String name = (String) listenerTypeOrNull;
             ReflectUtil.checkPackageAccess(name);
-            add((Class<EventListener>)Class.forName(name, true, cl), l);
+            @SuppressWarnings("unchecked")
+            Class<EventListener> tmp = (Class<EventListener>)Class.forName(name, true, cl);
+            add(tmp, l);
         }
     }
 
--- a/src/share/classes/javax/swing/event/RowSorterEvent.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/event/RowSorterEvent.java	Fri Jul 18 08:25:58 2014 -0700
@@ -71,7 +71,7 @@
      * @throws IllegalArgumentException if <code>source</code> is
      *         <code>null</code>
      */
-    public RowSorterEvent(RowSorter source) {
+    public RowSorterEvent(RowSorter<?> source) {
         this(source, Type.SORT_ORDER_CHANGED, null);
     }
 
@@ -85,7 +85,7 @@
      * @throws IllegalArgumentException if source or <code>type</code> is
      *         <code>null</code>
      */
-    public RowSorterEvent(RowSorter source, Type type,
+    public RowSorterEvent(RowSorter<?> source, Type type,
                           int[] previousRowIndexToModel) {
         super(source);
         if (type == null) {
@@ -100,7 +100,8 @@
      *
      * @return the source of the event as a <code>RowSorter</code>
      */
-    public RowSorter getSource() {
+    @Override
+    public RowSorter<?> getSource() {
         return (RowSorter)super.getSource();
     }
 
--- a/src/share/classes/javax/swing/filechooser/FileSystemView.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/filechooser/FileSystemView.java	Fri Jul 18 08:25:58 2014 -0700
@@ -739,7 +739,8 @@
      * @return the Desktop folder.
      */
     public File getHomeDirectory() {
-        return getRoots()[0];
+        File[] roots = getRoots();
+        return (roots.length == 0) ? null : roots[0];
     }
 
     /**
--- a/src/share/classes/javax/swing/plaf/ComboBoxUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/ComboBoxUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -38,15 +38,15 @@
     /**
      * Set the visibility of the popup
      */
-    public abstract void setPopupVisible( JComboBox c, boolean v );
+    public abstract void setPopupVisible( JComboBox<?> c, boolean v );
 
     /**
      * Determine the visibility of the popup
      */
-    public abstract boolean isPopupVisible( JComboBox c );
+    public abstract boolean isPopupVisible( JComboBox<?> c );
 
     /**
      * Determine whether or not the combo box itself is traversable
      */
-    public abstract boolean isFocusTraversable( JComboBox c );
+    public abstract boolean isFocusTraversable( JComboBox<?> c );
 }
--- a/src/share/classes/javax/swing/plaf/LayerUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/LayerUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -610,7 +610,8 @@
      *                  baseline
      */
     public int getBaseline(JComponent c, int width, int height) {
-        JLayer l = (JLayer) c;
+        @SuppressWarnings("unchecked")
+        JLayer<?> l = (JLayer) c;
         if (l.getView() != null) {
             return l.getView().getBaseline(width, height);
         }
@@ -627,7 +628,8 @@
      *         size changes
      */
     public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c) {
-        JLayer l = (JLayer) c;
+        @SuppressWarnings("unchecked")
+        JLayer<?> l = (JLayer) c;
         if (l.getView() != null) {
             return l.getView().getBaselineResizeBehavior();
         }
@@ -659,7 +661,8 @@
      * @return preferred size for the passed {@code JLayer}
      */
     public Dimension getPreferredSize(JComponent c) {
-        JLayer l = (JLayer) c;
+        @SuppressWarnings("unchecked")
+        JLayer<?> l = (JLayer) c;
         Component view = l.getView();
         if (view != null) {
             return view.getPreferredSize();
@@ -676,7 +679,8 @@
      * @return minimal size for the passed {@code JLayer}
      */
     public Dimension getMinimumSize(JComponent c) {
-        JLayer l = (JLayer) c;
+        @SuppressWarnings("unchecked")
+        JLayer<?> l = (JLayer) c;
         Component view = l.getView();
         if (view != null) {
             return view.getMinimumSize();
@@ -693,7 +697,8 @@
      * @return maximum size for the passed {@code JLayer}
      */
     public Dimension getMaximumSize(JComponent c) {
-        JLayer l = (JLayer) c;
+        @SuppressWarnings("unchecked")
+        JLayer<?> l = (JLayer) c;
         Component view = l.getView();
         if (view != null) {
             return view.getMaximumSize();
--- a/src/share/classes/javax/swing/plaf/ListUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/ListUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -50,7 +50,7 @@
      * @return the cell index closest to the given location, or {@code -1}
      * @throws NullPointerException if {@code location} is null
      */
-    public abstract int locationToIndex(JList list, Point location);
+    public abstract int locationToIndex(JList<?> list, Point location);
 
 
     /**
@@ -62,7 +62,7 @@
      * @param index the cell index
      * @return the origin of the cell, or {@code null}
      */
-    public abstract Point indexToLocation(JList list, int index);
+    public abstract Point indexToLocation(JList<?> list, int index);
 
 
     /**
@@ -80,5 +80,5 @@
      * @param index2 the second index in the range
      * @return the bounding rectangle for the range of cells, or {@code null}
      */
-    public abstract Rectangle getCellBounds(JList list, int index1, int index2);
+    public abstract Rectangle getCellBounds(JList<?> list, int index1, int index2);
 }
--- a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxEditor.java	Fri Jul 18 08:25:58 2014 -0700
@@ -100,7 +100,7 @@
                 // Must take the value from the editor and get the value and cast it to the new type.
                 Class<?> cls = oldValue.getClass();
                 try {
-                    Method method = MethodUtil.getMethod(cls, "valueOf", new Class[]{String.class});
+                    Method method = MethodUtil.getMethod(cls, "valueOf", new Class<?>[]{String.class});
                     newValue = MethodUtil.invoke(method, oldValue, new Object[] { editor.getText()});
                 } catch (Exception ex) {
                     // Fail silently and return the newValue (a String object)
--- a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxRenderer.java	Fri Jul 18 08:25:58 2014 -0700
@@ -49,7 +49,7 @@
  */
 @SuppressWarnings("serial") // Same-version serialization only
 public class BasicComboBoxRenderer extends JLabel
-implements ListCellRenderer, Serializable {
+implements ListCellRenderer<Object>, Serializable {
 
    /**
     * An empty <code>Border</code>. This field might not be used. To change the
@@ -88,8 +88,8 @@
         return size;
     }
 
-    public Component getListCellRendererComponent(
-                                                 JList list,
+    @Override
+    public Component getListCellRendererComponent(JList<?> list,
                                                  Object value,
                                                  int index,
                                                  boolean isSelected,
--- a/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Thu Jul 17 09:50:33 2014 -0700
+++ b/src/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Fri Jul 18 08:25:58 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -61,7 +61,7 @@
  * @author Mark Davidson
  */
 public class BasicComboBoxUI extends ComboBoxUI {
-    protected JComboBox comboBox;
+    protected JComboBox<Object> comboBox;
     /**
      * This protected field is implementation specific. Do not access directly
      * or override.
@@ -74,7 +74,7 @@
     private static final String IS_TABLE_CELL_EDITOR = "JComboBox.isTableCellEditor";
 
     // This list is for drawing the current item in the combo box.
-    protected JList   listBox;
+    protected JList<Object>   listBox;
 
     // Used to render the currently selected item in the combo box.
     // It doesn't have anything to do with the popup's rendering.
@@ -203,8 +203,9 @@
     protected Insets padding;
 
     // Used for calculating the default size.
-    private static ListCellRenderer getDefaultListCellRenderer() {
-        ListCellRenderer renderer = (ListCellRenderer)AppContext.
+    private static ListCellRenderer<Object> getDefaultListCellRenderer() {
+        @SuppressWarnings("unchecked")
+        ListCellRenderer<Object> renderer = (ListCellRenderer)AppContext.
                          getAppContext().get(COMBO_UI_LIST_CELL_RENDERER_KEY);
 
         if (renderer == null) {
@@ -245,7 +246,9 @@
     public void installUI( JComponent c ) {
         isMinimumSizeDirty = true;
 
-        comboBox = (JComboBox)c;
+        @SuppressWarnings("unchecked")
+        JComboBox<Object> tmp = (JComboBox)c;
+        comboBox = tmp;
         installDefaults();
         popup = createPopup();
         listBox = popup.getList();
@@ -508,7 +511,7 @@
      * @return a <code>ListCellRender</code> used for the combo box
      * @see javax.swing.JComboBox#setRenderer
      */
-    protected ListCellRenderer createRenderer() {
+    protected ListCellRenderer<Object> createRenderer() {
         return new BasicComboBoxRenderer.UIResource();
     }
 
@@ -865,14 +868,14 @@
     /**
      * Tells if the popup is visible or not.
      */
-    public boolean isPopupVisible( JComboBox c ) {
+    public boolean isPopupVisible( JComboBox<?> c ) {
         return popup.isVisible();
     }
 
     /**
      * Hides the popup.
      */
-    public void setPopupVisible( JComboBox c, boolean v ) {
+    public void setPopupVisible( JComboBox<?> c, boolean v ) {
         if ( v ) {
             popup.show();
         } else {
@@ -884,7 +887,7 @@
      * Determines if the JComboBox is focus traversable.  If the JComboBox is editable
      * this returns false, otherwise it returns true.
      */
-    public boolean isFocusTraversable( JComboBox c ) {
+    public boolean isFocusTraversable( JComboBox<?> c ) {
         return !comboBox.isEditable();
     }
 
@@ -956,7 +959,7 @@
             Insets insets = c.getInsets();
             height = height - insets.top - insets.bottom;
             if (!comboBox.isEditable()) {
-                ListCellRenderer renderer = comboBox.getRenderer();
+                ListCellRenderer<Object> renderer = comboBox.getRenderer();
                 if (renderer == null)  {
                     renderer = new DefaultListCellRenderer();
                 }
@@ -1013,7 +1016,7 @@
             return editor.getBaselineResizeBehavior();
         }
         else if (sameBaseline) {
-            ListCellRenderer renderer = comboBox.getRenderer();
+            ListCellRenderer<Object> renderer = comboBox.getRenderer();
             if (renderer == null)  {
                 renderer = new DefaultListCellRenderer();
             }
@@ -1205,7 +1208,7 @@
      * Paints the currently selected item.
      */
     public void paintCurrentValue(Graphics g,Rectangle bounds,boolean hasFocus) {
-        ListCellRenderer renderer = comboBox.getRenderer();
+        ListCellRenderer<Object> renderer = comboBox.getRenderer();
         Component c;
 
         if ( hasFocus && !isPopupVisible(comboBox) ) {
@@ -1322,7 +1325,7 @@
         }
         Dimension result = new Dimension();
 
-        ListCellRenderer renderer = comboBox.getRenderer();
+        ListCellRenderer<Object> renderer = comboBox.getRenderer();
         if (renderer == null)  {
             renderer = new DefaultListCellRenderer();
         }
@@ -1338,7 +1341,7 @@
         } else {
             // Calculate the dimension by iterating over all the elements in the combo
             // box list.
-            ComboBoxModel model = comboBox.getModel();
+            ComboBoxModel<Object> model = comboBox.getModel();
             int modelSize = model.getSize();
             int baseline = -1;
             Dimension d;
@@ -1484,7 +1487,8 @@
 
         public void actionPerformed( ActionEvent e ) {
             String key = getName();
-            JComboBox comboBox = (JComboBox)e.getSource();
+            @SuppressWarnings("unchecked")
+            JComboBox<Object> comboBox = (JComboBox)e.getSource();
             BasicComboBoxUI ui = (BasicComboBoxUI)BasicLookAndFeel.getUIOfType(
                                   comboBox.getUI(), BasicComboBoxUI.class);
             if (key == HIDE) {
@@ -1625,7 +1629,7 @@
             }
         }
 
-        private int getNextIndex(JComboBox comboBox, String key) {
+        private int getNextIndex(JComboBox<?> comboBox, String key) {
             int listHeight = comboBox.getMaximumRowCount();
 
             int selectedIndex = comboBox.getSelectedIndex();
@@ -1685,10 +1689,13 @@
                     comboBox.revalidate();
                 }
             } else {
-                JComboBox comboBox = (JComboBox)e.getSource();
+                @SuppressWarnings("unchecked")
+                JComboBox<?> comboBox = (JComboBox)e.getSource();
                 if ( propertyName == "model" ) {
-                    ComboBoxModel newModel = (ComboBoxModel)e.getNewValue();
-                    ComboBoxModel oldModel = (ComboBoxModel)e.getOldValue();
+                    @SuppressWarnings("unchecked")
+                    ComboBoxModel<?> newModel = (ComboBoxModel)e.getNewValue();
+                    @SuppressWarnings("unchecked")
+                    ComboBoxModel<?> oldModel = (ComboBoxModel)e.getOldValue();
 
                     if ( oldModel != null && listDataListener != null ) {
                         oldModel.removeListDataListener( listDataListener );
@@ -1897,7 +1904,8 @@
         }
 
         public void layoutContainer(Container parent) {
-            JComboBox cb = (JComboBox)parent;
+            @SuppressWarnings("unchecked")
+            JComboBox<?> cb = (JComboBox)parent;
             int width = cb.getWidth();
             int height = cb.getHeight();
 
@@ -1959,7 +1967,7 @@
         private String prefix = "";
         private String typedString = "";
 
-        public int selectionForKey(char aKey,ComboBoxModel aModel) {
+        public int selectionForKey(char aKey,ComboBoxModel<?> aModel) {
             if (lastTime == 0L) {
                 prefix = "";
                 typedString = "";