--- old/jdk/src/share/classes/java/awt/Window.java 2012-12-28 20:19:25.854060900 +0400 +++ new/jdk/src/share/classes/java/awt/Window.java 2012-12-28 20:19:25.302990900 +0400 @@ -441,7 +441,7 @@ transient Object anchor = new Object(); static class WindowDisposerRecord implements sun.java2d.DisposerRecord { final WeakReference owner; - final WeakReference weakThis; + final WeakReference weakThis; final WeakReference context; WindowDisposerRecord(AppContext context, Window victim) { owner = new WeakReference(victim.getOwner()); @@ -758,7 +758,7 @@ public void addNotify() { synchronized (getTreeLock()) { Container parent = this.parent; - if (parent != null && parent.getPeer() == null) { + if (parent != null && parent.peer == null) { parent.addNotify(); } if (peer == null) { @@ -800,7 +800,7 @@ */ public void pack() { Container parent = this.parent; - if (parent != null && parent.getPeer() == null) { + if (parent != null && parent.peer == null) { parent.addNotify(); } if (peer == null) { @@ -1069,8 +1069,8 @@ } static void updateChildFocusableWindowState(Window w) { - if (w.getPeer() != null && w.isShowing()) { - ((WindowPeer)w.getPeer()).updateFocusableWindowState(); + if (w.peer != null && w.isShowing()) { + ((WindowPeer)w.peer).updateFocusableWindowState(); } for (int i = 0; i < w.ownedWindowList.size(); i++) { Window child = w.ownedWindowList.elementAt(i).get(); @@ -1155,7 +1155,7 @@ */ void disposeImpl() { dispose(); - if (getPeer() != null) { + if (peer != null) { doDispose(); } } @@ -1542,6 +1542,7 @@ private static Window[] getWindows(AppContext appContext) { synchronized (Window.class) { Window realCopy[]; + @SuppressWarnings("unchecked") Vector> windowList = (Vector>)appContext.get(Window.class); if (windowList != null) { @@ -1866,7 +1867,7 @@ * @since 1.4 */ public synchronized WindowListener[] getWindowListeners() { - return (WindowListener[])(getListeners(WindowListener.class)); + return getListeners(WindowListener.class); } /** @@ -1882,7 +1883,7 @@ * @since 1.4 */ public synchronized WindowFocusListener[] getWindowFocusListeners() { - return (WindowFocusListener[])(getListeners(WindowFocusListener.class)); + return getListeners(WindowFocusListener.class); } /** @@ -1898,7 +1899,7 @@ * @since 1.4 */ public synchronized WindowStateListener[] getWindowStateListeners() { - return (WindowStateListener[])(getListeners(WindowStateListener.class)); + return getListeners(WindowStateListener.class); } @@ -2014,7 +2015,6 @@ break; case WindowEvent.WINDOW_STATE_CHANGED: processWindowStateEvent((WindowEvent)e); - default: break; } return; @@ -2382,12 +2382,14 @@ * KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS * @since 1.4 */ + @SuppressWarnings("unchecked") public Set getFocusTraversalKeys(int id) { if (id < 0 || id >= KeyboardFocusManager.TRAVERSAL_KEY_LENGTH) { throw new IllegalArgumentException("invalid focus traversal key identifier"); } // Okay to return Set directly because it is an unmodifiable view + @SuppressWarnings("rawtypes") Set keystrokes = (focusTraversalKeys != null) ? focusTraversalKeys[id] : null; @@ -2765,7 +2767,7 @@ /* * Support for tracking all windows owned by this window */ - void addOwnedWindow(WeakReference weakWindow) { + void addOwnedWindow(WeakReference weakWindow) { if (weakWindow != null) { synchronized(ownedWindowList) { // this if statement should really be an assert, but we don't @@ -2777,7 +2779,7 @@ } } - void removeOwnedWindow(WeakReference weakWindow) { + void removeOwnedWindow(WeakReference weakWindow) { if (weakWindow != null) { // synchronized block not required since removeElement is // already synchronized @@ -2792,6 +2794,7 @@ private void addToWindowList() { synchronized (Window.class) { + @SuppressWarnings("unchecked") Vector> windowList = (Vector>)appContext.get(Window.class); if (windowList == null) { windowList = new Vector>(); @@ -2801,8 +2804,9 @@ } } - private static void removeFromWindowList(AppContext context, WeakReference weakThis) { + private static void removeFromWindowList(AppContext context, WeakReference weakThis) { synchronized (Window.class) { + @SuppressWarnings("unchecked") Vector> windowList = (Vector>)context.get(Window.class); if (windowList != null) { windowList.remove(weakThis); @@ -2945,7 +2949,7 @@ // Deserialized Windows are not yet visible. visible = false; - weakThis = new WeakReference(this); + weakThis = new WeakReference<>(this); anchor = new Object(); sun.java2d.Disposer.addRecord(anchor, new WindowDisposerRecord(appContext, this)); @@ -2956,7 +2960,7 @@ private void deserializeResources(ObjectInputStream s) throws ClassNotFoundException, IOException, HeadlessException { - ownedWindowList = new Vector(); + ownedWindowList = new Vector<>(); if (windowSerializedDataVersion < 2) { // Translate old-style focus tracking to new model. For 1.4 and @@ -3600,9 +3604,9 @@ } } this.opacity = opacity; - WindowPeer peer = (WindowPeer)getPeer(); - if (peer != null) { - peer.setOpacity(opacity); + WindowPeer windowPeer = (WindowPeer)peer; + if (windowPeer != null) { + windowPeer.setOpacity(opacity); } } } @@ -3694,9 +3698,9 @@ } } this.shape = (shape == null) ? null : new Path2D.Float(shape); - WindowPeer peer = (WindowPeer)getPeer(); - if (peer != null) { - peer.applyShape(shape == null ? null : Region.getInstance(shape, null)); + WindowPeer windowPeer = (WindowPeer)peer; + if (windowPeer != null) { + windowPeer.applyShape(shape == null ? null : Region.getInstance(shape, null)); } } } @@ -3821,9 +3825,9 @@ } else if ((oldAlpha < 255) && (alpha == 255)) { setLayersOpaque(this, true); } - WindowPeer peer = (WindowPeer)getPeer(); - if (peer != null) { - peer.setOpaque(alpha == 255); + WindowPeer windowPeer = (WindowPeer)peer; + if (windowPeer != null) { + windowPeer.setOpaque(alpha == 255); } } @@ -3848,9 +3852,9 @@ private void updateWindow() { synchronized (getTreeLock()) { - WindowPeer peer = (WindowPeer)getPeer(); - if (peer != null) { - peer.updateWindow(); + WindowPeer windowPeer = (WindowPeer)peer; + if (windowPeer != null) { + windowPeer.updateWindow(); } } } @@ -4045,9 +4049,9 @@ window.securityWarningAlignmentY = alignmentY; synchronized (window.getTreeLock()) { - WindowPeer peer = (WindowPeer)window.getPeer(); - if (peer != null) { - peer.repositionSecurityWarning(); + WindowPeer windowPeer = (WindowPeer)window.peer; + if (windowPeer != null) { + windowPeer.repositionSecurityWarning(); } } }