--- old/src/share/classes/java/awt/AWTKeyStroke.java 2013-08-27 18:54:15.000000000 -0700 +++ new/src/share/classes/java/awt/AWTKeyStroke.java 2013-08-27 18:54:15.000000000 -0700 @@ -67,7 +67,7 @@ public class AWTKeyStroke implements Serializable { static final long serialVersionUID = -6430539691155161871L; - private static Map modifierKeywords; + private static Map modifierKeywords; /** * Associates VK_XXX (as a String) with code (as Integer). This is * done to avoid the overhead of the reflective call to find the @@ -85,8 +85,8 @@ * AWTKeyStroke class. * Must be called under locked AWTKeyStro */ - private static Class getAWTKeyStrokeClass() { - Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + private static Class getAWTKeyStrokeClass() { + Class clazz = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); if (clazz == null) { clazz = AWTKeyStroke.class; AppContext.getAppContext().put(AWTKeyStroke.class, AWTKeyStroke.class); @@ -182,7 +182,7 @@ throw new IllegalArgumentException("subclass cannot be null"); } synchronized (AWTKeyStroke.class) { - Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); + Class keyStrokeClass = (Class)AppContext.getAppContext().get(AWTKeyStroke.class); if (keyStrokeClass != null && keyStrokeClass.equals(subclass)){ // Already registered return; @@ -229,8 +229,8 @@ */ private static Constructor getCtor(final Class clazz) { - Object ctor = AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + Constructor ctor = AccessController.doPrivileged(new PrivilegedAction() { + public Constructor run() { try { Constructor ctor = clazz.getDeclaredConstructor((Class[]) null); if (ctor != null) { @@ -249,17 +249,17 @@ private static synchronized AWTKeyStroke getCachedStroke (char keyChar, int keyCode, int modifiers, boolean onKeyRelease) { - Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); + Map cache = (Map)AppContext.getAppContext().get(APP_CONTEXT_CACHE_KEY); AWTKeyStroke cacheKey = (AWTKeyStroke)AppContext.getAppContext().get(APP_CONTEXT_KEYSTROKE_KEY); if (cache == null) { - cache = new HashMap(); + cache = new HashMap<>(); AppContext.getAppContext().put(APP_CONTEXT_CACHE_KEY, cache); } if (cacheKey == null) { try { - Class clazz = getAWTKeyStrokeClass(); + Class clazz = getAWTKeyStrokeClass(); cacheKey = (AWTKeyStroke)getCtor(clazz).newInstance((Object[]) null); AppContext.getAppContext().put(APP_CONTEXT_KEYSTROKE_KEY, cacheKey); } catch (InstantiationException e) { @@ -513,7 +513,7 @@ synchronized (AWTKeyStroke.class) { if (modifierKeywords == null) { - Map uninitializedMap = new HashMap(8, 1.0f); + Map uninitializedMap = new HashMap<>(8, 1.0f); uninitializedMap.put("shift", Integer.valueOf(InputEvent.SHIFT_DOWN_MASK |InputEvent.SHIFT_MASK)); @@ -861,12 +861,12 @@ } class VKCollection { - Map code2name; - Map name2code; + Map code2name; + Map name2code; public VKCollection() { - code2name = new HashMap(); - name2code = new HashMap(); + code2name = new HashMap<>(); + name2code = new HashMap<>(); } public synchronized void put(String name, Integer code) { --- old/src/share/classes/java/awt/CardLayout.java 2013-08-27 18:54:17.000000000 -0700 +++ new/src/share/classes/java/awt/CardLayout.java 2013-08-27 18:54:16.000000000 -0700 @@ -66,7 +66,7 @@ * pairs of components and their names. * @see java.util.Vector */ - Vector vector = new Vector(); + Vector vector = new Vector<>(); /* * A pair of Component and String that represents its name. @@ -570,10 +570,10 @@ if (f.defaulted("vector")) { // pre-1.4 stream - Hashtable tab = (Hashtable)f.get("tab", null); - vector = new Vector(); + Hashtable tab = (Hashtable)f.get("tab", null); + vector = new Vector<>(); if (tab != null && !tab.isEmpty()) { - for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { + for (Enumeration e = tab.keys() ; e.hasMoreElements() ; ) { String key = (String)e.nextElement(); Component comp = (Component)tab.get(key); vector.add(new Card(key, comp)); @@ -594,7 +594,7 @@ private void writeObject(ObjectOutputStream s) throws IOException { - Hashtable tab = new Hashtable(); + Hashtable tab = new Hashtable<>(); int ncomponents = vector.size(); for (int i = 0; i < ncomponents; i++) { Card card = (Card)vector.get(i); --- old/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java 2013-08-27 18:54:18.000000000 -0700 +++ new/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java 2013-08-27 18:54:18.000000000 -0700 @@ -85,7 +85,7 @@ * list should be reused if possible. */ transient private Container cachedRoot; - transient private List cachedCycle; + transient private List cachedCycle; /* * We suppose to use getFocusTraversalCycle & getComponentIndex methods in order @@ -111,7 +111,7 @@ return cycle.indexOf(aComponent); } - private void enumerateCycle(Container container, List cycle) { + private void enumerateCycle(Container container, List cycle) { if (!(container.isVisible() && container.isDisplayable())) { return; } --- old/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2013-08-27 18:54:20.000000000 -0700 +++ new/src/share/classes/java/awt/DefaultKeyboardFocusManager.java 2013-08-27 18:54:19.000000000 -0700 @@ -808,13 +808,13 @@ } } boolean stopPostProcessing = false; - java.util.List processors = getKeyEventPostProcessors(); + java.util.List processors = getKeyEventPostProcessors(); if (processors != null) { - for (java.util.Iterator iter = processors.iterator(); + for (java.util.Iterator iter = processors.iterator(); !stopPostProcessing && iter.hasNext(); ) { - stopPostProcessing = (((KeyEventPostProcessor)(iter.next())). - postProcessKeyEvent(e)); + stopPostProcessing = iter.next(). + postProcessKeyEvent(e); } } if (!stopPostProcessing) { @@ -1059,12 +1059,12 @@ return true; } - java.util.List dispatchers = getKeyEventDispatchers(); + java.util.List dispatchers = getKeyEventDispatchers(); if (dispatchers != null) { - for (java.util.Iterator iter = dispatchers.iterator(); + for (java.util.Iterator iter = dispatchers.iterator(); iter.hasNext(); ) { - if (((KeyEventDispatcher)(iter.next())). + if (iter.next(). dispatchKeyEvent(ke)) { return true; @@ -1131,7 +1131,7 @@ oppStroke = AWTKeyStroke.getAWTKeyStroke(stroke.getKeyCode(), stroke.getModifiers(), !stroke.isOnKeyRelease()); - Set toTest; + Set toTest; boolean contains, containsOpp; toTest = focusedComponent.getFocusTraversalKeys( --- old/src/share/classes/java/awt/GradientPaintContext.java 2013-08-27 18:54:21.000000000 -0700 +++ new/src/share/classes/java/awt/GradientPaintContext.java 2013-08-27 18:54:21.000000000 -0700 @@ -41,7 +41,7 @@ new DirectColorModel(24, 0x000000ff, 0x0000ff00, 0x00ff0000); static ColorModel cachedModel; - static WeakReference cached; + static WeakReference cached; static synchronized Raster getCachedRaster(ColorModel cm, int w, int h) { if (cm == cachedModel) { @@ -76,7 +76,7 @@ } } cachedModel = cm; - cached = new WeakReference(ras); + cached = new WeakReference<>(ras); } double x1; --- old/src/share/classes/java/awt/GraphicsEnvironment.java 2013-08-27 18:54:22.000000000 -0700 +++ new/src/share/classes/java/awt/GraphicsEnvironment.java 2013-08-27 18:54:22.000000000 -0700 @@ -95,18 +95,18 @@ String nm = AccessController.doPrivileged(new GetPropertyAction("java.awt.graphicsenv", null)); try { // long t0 = System.currentTimeMillis(); - Class geCls; + Class geCls; try { // First we try if the bootclassloader finds the requested // class. This way we can avoid to run in a privileged block. - geCls = Class.forName(nm); + geCls = (Class)Class.forName(nm); } catch (ClassNotFoundException ex) { // If the bootclassloader fails, we try again with the // application classloader. ClassLoader cl = ClassLoader.getSystemClassLoader(); - geCls = Class.forName(nm, true, cl); + geCls = (Class)Class.forName(nm, true, cl); } - ge = (GraphicsEnvironment) geCls.newInstance(); + ge = geCls.newInstance(); // long t1 = System.currentTimeMillis(); // System.out.println("GE creation took " + (t1-t0)+ "ms."); if (isHeadless()) { @@ -161,7 +161,7 @@ private static boolean getHeadlessProperty() { if (headless == null) { java.security.AccessController.doPrivileged( - new java.security.PrivilegedAction() { + new java.security.PrivilegedAction() { public Object run() { String nm = System.getProperty("java.awt.headless"); --- old/src/share/classes/java/awt/KeyboardFocusManager.java 2013-08-27 18:54:24.000000000 -0700 +++ new/src/share/classes/java/awt/KeyboardFocusManager.java 2013-08-27 18:54:24.000000000 -0700 @@ -348,7 +348,7 @@ * Component of those Windows that has no such array of its own explicitly * set. */ - private Set[] defaultFocusTraversalKeys = new Set[4]; + private Set[] defaultFocusTraversalKeys = new Set[4]; /** * The current focus cycle root. If the focus owner is itself a focus cycle @@ -376,7 +376,7 @@ * KeyEventDispatchers are registered, this field may be null or refer to * a List of length 0. */ - private java.util.LinkedList keyEventDispatchers; + private java.util.LinkedList keyEventDispatchers; /** * This KeyboardFocusManager's KeyEventPostProcessor chain. The List does @@ -385,12 +385,12 @@ * If no other KeyEventPostProcessors are registered, this field may be * null or refer to a List of length 0. */ - private java.util.LinkedList keyEventPostProcessors; + private java.util.LinkedList keyEventPostProcessors; /** * Maps Windows to those Windows' most recent focus owners. */ - private static java.util.Map mostRecentFocusOwners = new WeakHashMap(); + private static java.util.Map> mostRecentFocusOwners = new WeakHashMap<>(); /** * We cache the permission used to verify that the calling thread is @@ -431,7 +431,7 @@ */ public KeyboardFocusManager() { for (int i = 0; i < TRAVERSAL_KEY_LENGTH; i++) { - Set work_set = new HashSet(); + Set work_set = new HashSet<>(); for (int j = 0; j < defaultFocusTraversalKeyStrokes[i].length; j++) { work_set.add(defaultFocusTraversalKeyStrokes[i][j]); } @@ -1125,7 +1125,7 @@ throw new IllegalArgumentException("cannot set null Set of default focus traversal keys"); } - Set oldKeys; + Set oldKeys; synchronized (this) { for (AWTKeyStroke keystroke : keystrokes) { @@ -1153,7 +1153,7 @@ oldKeys = defaultFocusTraversalKeys[id]; defaultFocusTraversalKeys[id] = - Collections.unmodifiableSet(new HashSet(keystrokes)); + Collections.unmodifiableSet(new HashSet<>(keystrokes)); } firePropertyChange(defaultFocusTraversalKeyPropertyNames[id], @@ -1699,7 +1699,7 @@ if (dispatcher != null) { synchronized (this) { if (keyEventDispatchers == null) { - keyEventDispatchers = new java.util.LinkedList(); + keyEventDispatchers = new java.util.LinkedList<>(); } keyEventDispatchers.add(dispatcher); } @@ -1787,7 +1787,7 @@ if (processor != null) { synchronized (this) { if (keyEventPostProcessors == null) { - keyEventPostProcessors = new java.util.LinkedList(); + keyEventPostProcessors = new java.util.LinkedList<>(); } keyEventPostProcessors.add(processor); } @@ -1865,9 +1865,9 @@ // of Component.parent fields. Since WeakHasMap refers to its // values strongly, we need to break the strong link from the // value (component) back to its key (window). - WeakReference weakValue = null; + WeakReference weakValue = null; if (component != null) { - weakValue = new WeakReference(component); + weakValue = new WeakReference<>(component); } mostRecentFocusOwners.put(window, weakValue); } @@ -1906,7 +1906,7 @@ * javax.swing.JComponent.runInputVerifier() using reflection. */ static synchronized Component getMostRecentFocusOwner(Window window) { - WeakReference weakValue = + WeakReference weakValue = (WeakReference)mostRecentFocusOwners.get(window); return weakValue == null ? null : (Component)weakValue.get(); } @@ -2648,11 +2648,11 @@ Component lastFocusOwner = null; Component currentFocusOwner = null; - for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) { + for (Iterator iter = localLightweightRequests.iterator(); iter.hasNext(); ) { currentFocusOwner = manager.getGlobalFocusOwner(); LightweightFocusRequest lwFocusRequest = - (LightweightFocusRequest)iter.next(); + iter.next(); /* * WARNING: This is based on DKFM's logic solely! @@ -2977,12 +2977,12 @@ if (hwFocusRequest != null) { heavyweightRequests.removeFirst(); if (hwFocusRequest.lightweightRequests != null) { - for (Iterator lwIter = hwFocusRequest.lightweightRequests. + for (Iterator lwIter = hwFocusRequest.lightweightRequests. iterator(); lwIter.hasNext(); ) { manager.dequeueKeyEvents - (-1, ((LightweightFocusRequest)lwIter.next()). + (-1, lwIter.next(). component); } } @@ -3062,8 +3062,8 @@ // Accessor to private field isProxyActive of KeyEvent private static boolean isProxyActiveImpl(KeyEvent e) { if (proxyActive == null) { - proxyActive = (Field) AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + proxyActive = AccessController.doPrivileged(new PrivilegedAction() { + public Field run() { Field field = null; try { field = KeyEvent.class.getDeclaredField("isProxyActive"); --- old/src/share/classes/java/awt/SequencedEvent.java 2013-08-27 18:54:26.000000000 -0700 +++ new/src/share/classes/java/awt/SequencedEvent.java 2013-08-27 18:54:25.000000000 -0700 @@ -49,7 +49,7 @@ private static final int ID = java.awt.event.FocusEvent.FOCUS_LAST + 1; - private static final LinkedList list = new LinkedList(); + private static final LinkedList list = new LinkedList<>(); private final AWTEvent nested; private AppContext appContext; --- old/src/share/classes/java/awt/TexturePaintContext.java 2013-08-27 18:54:27.000000000 -0700 +++ new/src/share/classes/java/awt/TexturePaintContext.java 2013-08-27 18:54:27.000000000 -0700 @@ -73,11 +73,11 @@ WritableRaster raster = bufImg.getRaster(); ColorModel cm = bufImg.getColorModel(); int maxw = devBounds.width; - Object val = hints.get(hints.KEY_INTERPOLATION); + Object val = hints.get(RenderingHints.KEY_INTERPOLATION); boolean filter = (val == null - ? (hints.get(hints.KEY_RENDERING) == hints.VALUE_RENDER_QUALITY) - : (val != hints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)); + ? (hints.get(RenderingHints.KEY_RENDERING) == RenderingHints.VALUE_RENDER_QUALITY) + : (val != RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR)); if (raster instanceof IntegerInterleavedRaster && (!filter || isFilterableDCM(cm))) { @@ -234,8 +234,8 @@ return outRas; } - private static WeakReference xrgbRasRef; - private static WeakReference argbRasRef; + private static WeakReference xrgbRasRef; + private static WeakReference argbRasRef; synchronized static WritableRaster makeRaster(ColorModel cm, Raster srcRas, @@ -278,13 +278,13 @@ return; } if (xrgbmodel == cm) { - xrgbRasRef = new WeakReference(outRas); + xrgbRasRef = new WeakReference<>(outRas); } else if (argbmodel == cm) { - argbRasRef = new WeakReference(outRas); + argbRasRef = new WeakReference<>(outRas); } } - private static WeakReference byteRasRef; + private static WeakReference byteRasRef; synchronized static WritableRaster makeByteRaster(Raster srcRas, int w, int h) @@ -307,7 +307,7 @@ if (outRas == null) { return; } - byteRasRef = new WeakReference(outRas); + byteRasRef = new WeakReference<>(outRas); } public abstract WritableRaster makeRaster(int w, int h); --- old/src/share/classes/java/awt/WaitDispatchSupport.java 2013-08-27 18:54:29.000000000 -0700 +++ new/src/share/classes/java/awt/WaitDispatchSupport.java 2013-08-27 18:54:28.000000000 -0700 @@ -224,8 +224,8 @@ // starts. Thus, the enter() method will not hang. // // Event pump should be privileged. See 6300270. - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() { + public Void run() { run.run(); return null; }