--- old/src/java.desktop/share/classes/java/awt/Component.java 2015-03-04 18:15:53.000000000 +0300 +++ new/src/java.desktop/share/classes/java/awt/Component.java 2015-03-04 18:15:53.000000000 +0300 @@ -198,7 +198,7 @@ * @see #addNotify * @see #removeNotify */ - transient ComponentPeer peer; + transient volatile ComponentPeer peer; /** * The parent of the object. It may be null @@ -924,8 +924,9 @@ public Cursor getCursor(Component comp) { return comp.getCursor_NoClientCode(); } - public ComponentPeer getPeer(Component comp) { - return comp.peer; + @SuppressWarnings("unchecked") + public T getPeer(Component comp) { + return (T) comp.peer; } public void setPeer(Component comp, ComponentPeer peer) { comp.peer = peer; @@ -1069,17 +1070,6 @@ } /** - * @deprecated As of JDK version 1.1, - * programs should not directly manipulate peers; - * replaced by boolean isDisplayable(). - * @return the peer for this component - */ - @Deprecated - public ComponentPeer getPeer() { - return peer; - } - - /** * Associate a DropTarget with this component. * The Component will receive drops only if it * is enabled. @@ -1179,7 +1169,7 @@ graphicsConfig = gc; - ComponentPeer peer = getPeer(); + ComponentPeer peer = this.peer; if (peer != null) { return peer.updateGraphicsData(gc); } @@ -1281,7 +1271,7 @@ * @since 1.2 */ public boolean isDisplayable() { - return getPeer() != null; + return peer != null; } /** @@ -2582,7 +2572,7 @@ * @since 1.2 */ public boolean isOpaque() { - if (getPeer() == null) { + if (peer == null) { return false; } else { @@ -2608,7 +2598,7 @@ * @since 1.2 */ public boolean isLightweight() { - return getPeer() instanceof LightweightPeer; + return peer instanceof LightweightPeer; } @@ -3126,7 +3116,6 @@ * obtained * @return the font metrics for font * @see #getFont - * @see #getPeer * @see java.awt.peer.ComponentPeer#getFontMetrics(Font) * @see Toolkit#getFontMetrics(Font) * @since 1.0 @@ -3186,7 +3175,7 @@ if (nativeContainer == null) return; - ComponentPeer cPeer = nativeContainer.getPeer(); + ComponentPeer cPeer = nativeContainer.peer; if (cPeer != null) { cPeer.updateCursorImmediately(); @@ -5016,7 +5005,7 @@ if (source != null) { Container target = source.getNativeContainer(); if (target != null) { - tpeer = target.getPeer(); + tpeer = target.peer; } } } @@ -9847,7 +9836,7 @@ } if (!isLightweight()) { - ComponentPeer peer = getPeer(); + ComponentPeer peer = this.peer; if (peer != null) { // The Region class has some optimizations. That's why // we should manually check whether it's empty and @@ -9971,7 +9960,7 @@ for (int i = indexAbove; i > -1; i--) { Component comp = cont.getComponent(i); if (comp != null && comp.isDisplayable() && !comp.isLightweight()) { - return comp.getPeer(); + return comp.peer; } } // traversing the hierarchy up to the closest HW container;