8005255: [macosx] Cleanup warnings in sun.lwawt
authorserb
Mon, 23 Sep 2013 16:17:26 +0400
changeset 20153 d5bf90bfcb6d
parent 20152 3ef8620dce9b
child 20154 551a86159e69
8005255: [macosx] Cleanup warnings in sun.lwawt Reviewed-by: alexsch, anthony
jdk/make/sun/lwawt/FILES_export_macosx.gmk
jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java
jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java
jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java
jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java
jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java
jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java
jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java
jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java
jdk/src/macosx/classes/sun/lwawt/LWListPeer.java
jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java
jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java
jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java
jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java
jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java
jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java
jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java
jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java
jdk/src/macosx/classes/sun/lwawt/LWToolkit.java
jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java
jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java
--- a/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/make/sun/lwawt/FILES_export_macosx.gmk	Mon Sep 23 16:17:26 2013 +0400
@@ -110,7 +110,6 @@
         sun/lwawt/LWWindowPeer.java \
         sun/lwawt/PlatformWindow.java \
         sun/lwawt/SecurityWarningWindow.java \
-        sun/lwawt/SelectionClearListener.java \
         sun/lwawt/macosx/CPrinterDevice.java \
         sun/lwawt/macosx/CPrinterDialog.java \
         sun/lwawt/macosx/CPrinterDialogPeer.java \
--- a/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWButtonPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,6 +33,10 @@
 
 import javax.swing.JButton;
 
+/**
+ * Lightweight implementation of {@link ButtonPeer}. Delegates most of the work
+ * to the {@link JButton}.
+ */
 final class LWButtonPeer extends LWComponentPeer<Button, JButton>
         implements ButtonPeer, ActionListener {
 
@@ -42,7 +46,7 @@
     }
 
     @Override
-    protected JButton createDelegate() {
+    JButton createDelegate() {
         return new JButtonDelegate();
     }
 
@@ -74,6 +78,7 @@
         return true;
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JButtonDelegate extends JButton {
 
         // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWCanvasPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,6 +33,10 @@
 
 import javax.swing.JComponent;
 
+/**
+ * Lightweight implementation of {@link CanvasPeer}. This peer is empty, because
+ * all the components in lwawt use graphic object from the top level window.
+ */
 class LWCanvasPeer<T extends Component, D extends JComponent>
         extends LWComponentPeer<T, D> implements CanvasPeer {
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWCheckboxPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -41,6 +41,11 @@
 import javax.swing.JToggleButton;
 import javax.swing.SwingUtilities;
 
+/**
+ * Lightweight implementation of {@link CheckboxPeer}. Delegates most of the
+ * work to the {@link JCheckBox} and {@link JRadioButton}, which are placed
+ * inside an empty {@link JComponent}.
+ */
 final class LWCheckboxPeer
         extends LWComponentPeer<Checkbox, LWCheckboxPeer.CheckboxDelegate>
         implements CheckboxPeer, ItemListener {
@@ -51,12 +56,12 @@
     }
 
     @Override
-    protected CheckboxDelegate createDelegate() {
+    CheckboxDelegate createDelegate() {
         return new CheckboxDelegate();
     }
 
     @Override
-    protected Component getDelegateFocusOwner() {
+    Component getDelegateFocusOwner() {
         return getDelegate().getCurrentButton();
     }
 
@@ -137,6 +142,7 @@
         return true;
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     final class CheckboxDelegate extends JComponent {
 
         private final JCheckBox cb;
--- a/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWChoicePeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -34,6 +34,10 @@
 import javax.accessibility.Accessible;
 import javax.swing.*;
 
+/**
+ * Lightweight implementation of {@link ChoicePeer}. Delegates most of the work
+ * to the {@link JComboBox}.
+ */
 final class LWChoicePeer extends LWComponentPeer<Choice, JComboBox<String>>
         implements ChoicePeer, ItemListener {
 
@@ -50,7 +54,7 @@
     }
 
     @Override
-    protected JComboBox<String> createDelegate() {
+    JComboBox<String> createDelegate() {
         return new JComboBoxDelegate();
     }
 
@@ -128,6 +132,7 @@
         return true;
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JComboBoxDelegate extends JComboBox<String> {
 
         // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWComponentPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -72,19 +72,23 @@
 {
     private static final PlatformLogger focusLog = PlatformLogger.getLogger("sun.lwawt.focus.LWComponentPeer");
 
-    // State lock is to be used for modifications to this
-    // peer's fields (e.g. bounds, background, font, etc.)
-    // It should be the last lock in the lock chain
-    private final Object stateLock =
-            new StringBuilder("LWComponentPeer.stateLock");
+    /**
+     * State lock is to be used for modifications to this peer's fields (e.g.
+     * bounds, background, font, etc.) It should be the last lock in the lock
+     * chain
+     */
+    private final Object stateLock = new Object();
 
-    // The lock to operate with the peers hierarchy. AWT tree
-    // lock is not used as there are many peers related ops
-    // to be done on the toolkit thread, and we don't want to
-    // depend on a public lock on this thread
-    private static final Object peerTreeLock =
-            new StringBuilder("LWComponentPeer.peerTreeLock");
+    /**
+     * The lock to operate with the peers hierarchy. AWT tree lock is not used
+     * as there are many peers related ops to be done on the toolkit thread, and
+     * we don't want to depend on a public lock on this thread
+     */
+    private static final Object peerTreeLock = new Object();
 
+    /**
+     * The associated AWT object.
+     */
     private final T target;
 
     /**
@@ -95,7 +99,7 @@
      * the hierarchy. The exception is LWWindowPeers: their containers are
      * always null
      */
-    private final LWContainerPeer containerPeer;
+    private final LWContainerPeer<?, ?> containerPeer;
 
     /**
      * Handy reference to the top-level window peer. Window peer is borrowed
@@ -147,11 +151,18 @@
      */
     private Image backBuffer;
 
+    /**
+     * All Swing delegates use delegateContainer as a parent. This container
+     * intentionally do not use parent of the peer.
+     */
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class DelegateContainer extends Container {
         {
             enableEvents(0xFFFFFFFF);
         }
 
+        // Empty non private constructor was added because access to this
+        // class shouldn't be emulated by a synthetic accessor method.
         DelegateContainer() {
             super();
         }
@@ -182,7 +193,7 @@
         }
     }
 
-    public LWComponentPeer(T target, PlatformComponent platformComponent) {
+    LWComponentPeer(final T target, final PlatformComponent platformComponent) {
         targetPaintArea = new LWRepaintArea();
         this.target = target;
         this.platformComponent = platformComponent;
@@ -276,15 +287,18 @@
      * This method is called under getDelegateLock().
      * Overridden in subclasses.
      */
-    protected D createDelegate() {
+    D createDelegate() {
         return null;
     }
 
-    protected final D getDelegate() {
+    final D getDelegate() {
         return delegate;
     }
 
-    protected Component getDelegateFocusOwner() {
+    /**
+     * This method should be called under getDelegateLock().
+     */
+    Component getDelegateFocusOwner() {
         return getDelegate();
     }
 
@@ -356,7 +370,7 @@
     }
 
     // Just a helper method
-    protected final LWContainerPeer getContainerPeer() {
+    protected final LWContainerPeer<?, ?> getContainerPeer() {
         return containerPeer;
     }
 
@@ -390,7 +404,7 @@
 
     protected void disposeImpl() {
         destroyBuffers();
-        LWContainerPeer cp = getContainerPeer();
+        LWContainerPeer<?, ?> cp = getContainerPeer();
         if (cp != null) {
             cp.removeChildPeer(this);
         }
@@ -462,12 +476,13 @@
         sg2d.constrain(size.x, size.y, size.width, size.height, getVisibleRegion());
     }
 
-    public Region getVisibleRegion() {
+    Region getVisibleRegion() {
         return computeVisibleRect(this, getRegion());
     }
 
-    static final Region computeVisibleRect(LWComponentPeer c, Region region) {
-        final LWContainerPeer p = c.getContainerPeer();
+    static final Region computeVisibleRect(final LWComponentPeer<?, ?> c,
+                                           Region region) {
+        final LWContainerPeer<?, ?> p = c.getContainerPeer();
         if (p != null) {
             final Rectangle r = c.getBounds();
             region = region.getTranslatedRegion(r.x, r.y);
@@ -612,7 +627,7 @@
      * @param p Point relative to the peer.
      * @return Cursor of the peer or null if default cursor should be used.
      */
-    protected Cursor getCursor(final Point p) {
+    Cursor getCursor(final Point p) {
         return getTarget().getCursor();
     }
 
@@ -717,7 +732,7 @@
     @Override
     public void setEnabled(final boolean e) {
         boolean status = e;
-        final LWComponentPeer cp = getContainerPeer();
+        final LWComponentPeer<?, ?> cp = getContainerPeer();
         if (cp != null) {
             status &= cp.isEnabled();
         }
@@ -802,12 +817,12 @@
     }
 
     @Override
-    public void setZOrder(ComponentPeer above) {
-        LWContainerPeer cp = getContainerPeer();
+    public void setZOrder(final ComponentPeer above) {
+        LWContainerPeer<?, ?> cp = getContainerPeer();
         // Don't check containerPeer for null as it can only happen
         // for windows, but this method is overridden in
         // LWWindowPeer and doesn't call super()
-        cp.setChildPeerZOrder(this, (LWComponentPeer) above);
+        cp.setChildPeerZOrder(this, (LWComponentPeer<?, ?>) above);
     }
 
     @Override
@@ -923,7 +938,9 @@
                     LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
                     return false;
                 }
-                LWWindowPeer parentPeer = (LWWindowPeer) parentWindow.getPeer();
+                final LWWindowPeer parentPeer =
+                        (LWWindowPeer) AWTAccessor.getComponentAccessor()
+                                                  .getPeer(parentWindow);
                 if (parentPeer == null) {
                     focusLog.fine("request rejected, parentPeer is null");
                     LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
@@ -1138,7 +1155,7 @@
     }
 
     protected final void repaintParent(final Rectangle oldB) {
-        final LWContainerPeer cp = getContainerPeer();
+        final LWContainerPeer<?, ?> cp = getContainerPeer();
         if (cp != null) {
             // Repaint unobscured part of the parent
             cp.repaintPeer(cp.getContentSize().intersection(oldB));
@@ -1275,7 +1292,7 @@
     /**
      * Handler for FocusEvents.
      */
-    protected void handleJavaFocusEvent(FocusEvent e) {
+    void handleJavaFocusEvent(final FocusEvent e) {
         // Note that the peer receives all the FocusEvents from
         // its lightweight children as well
         KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
@@ -1311,7 +1328,7 @@
      * Finds a top-most visible component for the given point. The location is
      * specified relative to the peer's parent.
      */
-    public LWComponentPeer findPeerAt(final int x, final int y) {
+    LWComponentPeer<?, ?> findPeerAt(final int x, final int y) {
         final Rectangle r = getBounds();
         final Region sh = getRegion();
         final boolean found = isVisible() && sh.contains(x - r.x, y - r.y);
@@ -1328,7 +1345,7 @@
     }
 
     public Point windowToLocal(Point p, LWWindowPeer wp) {
-        LWComponentPeer cp = this;
+        LWComponentPeer<?, ?> cp = this;
         while (cp != wp) {
             Rectangle cpb = cp.getBounds();
             p.x -= cpb.x;
@@ -1349,7 +1366,7 @@
     }
 
     public Point localToWindow(Point p) {
-        LWComponentPeer cp = getContainerPeer();
+        LWComponentPeer<?, ?> cp = getContainerPeer();
         Rectangle r = getBounds();
         while (cp != null) {
             p.x += r.x;
@@ -1370,7 +1387,7 @@
         repaintPeer(getSize());
     }
 
-    public void repaintPeer(final Rectangle r) {
+    void repaintPeer(final Rectangle r) {
         final Rectangle toPaint = getSize().intersection(r);
         if (!isShowing() || toPaint.isEmpty()) {
             return;
@@ -1389,7 +1406,7 @@
     protected final boolean isShowing() {
         synchronized (getPeerTreeLock()) {
             if (isVisible()) {
-                final LWContainerPeer container = getContainerPeer();
+                final LWContainerPeer<?, ?> container = getContainerPeer();
                 return (container == null) || container.isShowing();
             }
         }
@@ -1397,8 +1414,7 @@
     }
 
     /**
-     * Paints the peer. Overridden in subclasses to delegate the actual painting
-     * to Swing components.
+     * Paints the peer. Delegate the actual painting to Swing components.
      */
     protected final void paintPeer(final Graphics g) {
         final D delegate = getDelegate();
--- a/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWContainerPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -41,32 +41,25 @@
 import javax.swing.JComponent;
 
 abstract class LWContainerPeer<T extends Container, D extends JComponent>
-    extends LWCanvasPeer<T, D>
-    implements ContainerPeer
-{
-    // List of child peers sorted by z-order from bottom-most
-    // to top-most
-    private List<LWComponentPeer> childPeers =
-        new LinkedList<LWComponentPeer>();
+        extends LWCanvasPeer<T, D> implements ContainerPeer {
 
-    LWContainerPeer(T target, PlatformComponent platformComponent) {
+    /**
+     * List of child peers sorted by z-order from bottom-most to top-most.
+     */
+    private final List<LWComponentPeer<?, ?>> childPeers = new LinkedList<>();
+
+    LWContainerPeer(final T target, final PlatformComponent platformComponent) {
         super(target, platformComponent);
     }
 
-    void addChildPeer(LWComponentPeer child) {
+    final void addChildPeer(final LWComponentPeer<?, ?> child) {
         synchronized (getPeerTreeLock()) {
-            addChildPeer(child, childPeers.size());
+            childPeers.add(childPeers.size(), child);
+            // TODO: repaint
         }
     }
 
-    void addChildPeer(LWComponentPeer child, int index) {
-        synchronized (getPeerTreeLock()) {
-            childPeers.add(index, child);
-        }
-        // TODO: repaint
-    }
-
-    void removeChildPeer(LWComponentPeer child) {
+    final void removeChildPeer(final LWComponentPeer<?, ?> child) {
         synchronized (getPeerTreeLock()) {
             childPeers.remove(child);
         }
@@ -74,7 +67,8 @@
     }
 
     // Used by LWComponentPeer.setZOrder()
-    void setChildPeerZOrder(LWComponentPeer peer, LWComponentPeer above) {
+    final void setChildPeerZOrder(final LWComponentPeer<?, ?> peer,
+                                  final LWComponentPeer<?, ?> above) {
         synchronized (getPeerTreeLock()) {
             childPeers.remove(peer);
             int index = (above != null) ? childPeers.indexOf(above) : childPeers.size();
@@ -98,25 +92,27 @@
     }
 
     @Override
-    public void beginValidate() {
-        // TODO: it seems that begin/endValidate() is only useful
-        // for heavyweight windows, when a batch movement for
-        // child windows  occurs. That's why no-op
-    }
-    @Override
-    public void endValidate() {
+    public final void beginValidate() {
         // TODO: it seems that begin/endValidate() is only useful
         // for heavyweight windows, when a batch movement for
         // child windows  occurs. That's why no-op
     }
 
     @Override
-    public void beginLayout() {
+    public final void endValidate() {
+        // TODO: it seems that begin/endValidate() is only useful
+        // for heavyweight windows, when a batch movement for
+        // child windows  occurs. That's why no-op
+    }
+
+    @Override
+    public final void beginLayout() {
         // Skip all painting till endLayout()
         setLayouting(true);
     }
+
     @Override
-    public void endLayout() {
+    public final void endLayout() {
         setLayouting(false);
 
         // Post an empty event to flush all the pending target paints
@@ -125,18 +121,19 @@
 
     // ---- PEER NOTIFICATIONS ---- //
 
-    /*
+    /**
      * Returns a copy of the childPeer collection.
      */
-    protected List<LWComponentPeer> getChildren() {
+    @SuppressWarnings("unchecked")
+    final List<LWComponentPeer<?, ?>> getChildren() {
         synchronized (getPeerTreeLock()) {
-            Object copy = ((LinkedList)childPeers).clone();
-            return (List<LWComponentPeer>)copy;
+            Object copy = ((LinkedList<?>) childPeers).clone();
+            return (List<LWComponentPeer<?, ?>>) copy;
         }
     }
 
     @Override
-    public final Region getVisibleRegion() {
+    final Region getVisibleRegion() {
         return cutChildren(super.getVisibleRegion(), null);
     }
 
@@ -144,9 +141,9 @@
      * Removes bounds of children above specific child from the region. If above
      * is null removes all bounds of children.
      */
-    protected final Region cutChildren(Region r, final LWComponentPeer above) {
+    final Region cutChildren(Region r, final LWComponentPeer<?, ?> above) {
         boolean aboveFound = above == null;
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!aboveFound && child == above) {
                 aboveFound = true;
                 continue;
@@ -170,8 +167,8 @@
      * specified relative to the peer's parent.
      */
     @Override
-    public final LWComponentPeer findPeerAt(int x, int y) {
-        LWComponentPeer peer = super.findPeerAt(x, y);
+    final LWComponentPeer<?, ?> findPeerAt(int x, int y) {
+        LWComponentPeer<?, ?> peer = super.findPeerAt(x, y);
         final Rectangle r = getBounds();
         // Translate to this container's coordinates to pass to children
         x -= r.x;
@@ -179,7 +176,7 @@
         if (peer != null && getContentSize().contains(x, y)) {
             synchronized (getPeerTreeLock()) {
                 for (int i = childPeers.size() - 1; i >= 0; --i) {
-                    LWComponentPeer p = childPeers.get(i).findPeerAt(x, y);
+                    LWComponentPeer<?, ?> p = childPeers.get(i).findPeerAt(x, y);
                     if (p != null) {
                         peer = p;
                         break;
@@ -195,7 +192,7 @@
     * peers should be repainted
     */
     @Override
-    public final void repaintPeer(final Rectangle r) {
+    final void repaintPeer(final Rectangle r) {
         final Rectangle toPaint = getSize().intersection(r);
         if (!isShowing() || toPaint.isEmpty()) {
             return;
@@ -208,13 +205,13 @@
         repaintChildren(toPaint);
     }
 
-    /*
-    * Paints all the child peers in the straight z-order, so the
-    * bottom-most ones are painted first.
-    */
+    /**
+     * Paints all the child peers in the straight z-order, so the
+     * bottom-most ones are painted first.
+     */
     private void repaintChildren(final Rectangle r) {
         final Rectangle content = getContentSize();
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             final Rectangle childBounds = child.getBounds();
             Rectangle toPaint = r.intersection(childBounds);
             toPaint = toPaint.intersection(content);
@@ -223,21 +220,21 @@
         }
     }
 
-    protected Rectangle getContentSize() {
+    Rectangle getContentSize() {
         return getSize();
     }
 
     @Override
     public void setEnabled(final boolean e) {
         super.setEnabled(e);
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             child.setEnabled(e && child.getTarget().isEnabled());
         }
     }
 
     @Override
     public void setBackground(final Color c) {
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!child.getTarget().isBackgroundSet()) {
                 child.setBackground(c);
             }
@@ -247,7 +244,7 @@
 
     @Override
     public void setForeground(final Color c) {
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!child.getTarget().isForegroundSet()) {
                 child.setForeground(c);
             }
@@ -257,7 +254,7 @@
 
     @Override
     public void setFont(final Font f) {
-        for (final LWComponentPeer child : getChildren()) {
+        for (final LWComponentPeer<?, ?> child : getChildren()) {
             if (!child.getTarget().isFontSet()) {
                 child.setFont(f);
             }
--- a/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWCursorManager.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -32,6 +32,7 @@
 
 import java.util.concurrent.atomic.AtomicBoolean;
 
+import sun.awt.AWTAccessor;
 import sun.awt.SunToolkit;
 
 public abstract class LWCursorManager {
@@ -109,7 +110,8 @@
                                                     cursorPos.y - p.y);
             }
             while (c != null) {
-                if (c.isVisible() && c.isEnabled() && (c.getPeer() != null)) {
+                final Object p = AWTAccessor.getComponentAccessor().getPeer(c);
+                if (c.isVisible() && c.isEnabled() && p != null) {
                     break;
                 }
                 c = c.getParent();
--- a/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWLabelPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,7 +44,7 @@
     }
 
     @Override
-    protected JLabel createDelegate() {
+    JLabel createDelegate() {
         return new JLabel();
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWListPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,7 +33,8 @@
 import java.util.Arrays;
 
 /**
- * Lightweight implementation of {@link ListPeer}.
+ * Lightweight implementation of {@link ListPeer}. Delegates most of the work to
+ * the {@link JList}, which is placed inside {@link JScrollPane}.
  */
 final class LWListPeer extends LWComponentPeer<List, LWListPeer.ScrollableJList>
         implements ListPeer {
@@ -56,7 +57,7 @@
     }
 
     @Override
-    protected ScrollableJList createDelegate() {
+    ScrollableJList createDelegate() {
         return new ScrollableJList();
     }
 
@@ -78,7 +79,7 @@
     }
 
     @Override
-    protected Component getDelegateFocusOwner() {
+    Component getDelegateFocusOwner() {
         return getDelegate().getView();
     }
 
@@ -193,6 +194,7 @@
         }
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     final class ScrollableJList extends JScrollPane implements ListSelectionListener {
 
         private boolean skipStateChangedEvent;
@@ -234,9 +236,10 @@
         }
 
         @Override
+        @SuppressWarnings("unchecked")
         public void valueChanged(final ListSelectionEvent e) {
             if (!e.getValueIsAdjusting() && !isSkipStateChangedEvent()) {
-                final JList source = (JList) e.getSource();
+                final JList<?> source = (JList<?>) e.getSource();
                 for(int i = 0 ; i < source.getModel().getSize(); i++) {
 
                     final boolean wasSelected = Arrays.binarySearch(oldSelectedIndices, i) >= 0;
@@ -255,6 +258,7 @@
             }
         }
 
+        @SuppressWarnings("unchecked")
         public JList<String> getView() {
             return (JList<String>) getViewport().getView();
         }
@@ -289,7 +293,7 @@
         private final class JListDelegate extends JList<String> {
 
             JListDelegate() {
-                super(ScrollableJList.this.model);
+                super(model);
             }
 
             @Override
--- a/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWMouseInfoPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -30,10 +30,9 @@
 
 import java.awt.peer.MouseInfoPeer;
 
-public class LWMouseInfoPeer implements MouseInfoPeer {
+import sun.awt.AWTAccessor;
 
-    public LWMouseInfoPeer() {
-    }
+public class LWMouseInfoPeer implements MouseInfoPeer {
 
     @Override
     public int fillPointWithCoords(Point point) {
@@ -52,7 +51,7 @@
             return false;
         }
 
-        LWWindowPeer windowPeer = (LWWindowPeer)w.getPeer();
+        final Object windowPeer = AWTAccessor.getComponentAccessor().getPeer(w);
         return LWWindowPeer.getWindowUnderCursor() == windowPeer;
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWPanelPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -31,6 +31,10 @@
 
 import javax.swing.JPanel;
 
+/**
+ * Lightweight implementation of {@link PanelPeer}. Delegates most of the work
+ * to the {@link JPanel}.
+ */
 final class LWPanelPeer extends LWContainerPeer<Panel, JPanel>
         implements PanelPeer {
 
@@ -39,7 +43,7 @@
     }
 
     @Override
-    public JPanel createDelegate() {
+    JPanel createDelegate() {
         return new JPanel();
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWRepaintArea.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -26,39 +26,38 @@
 
 package sun.lwawt;
 
-import sun.awt.RepaintArea;
-
 import java.awt.Component;
 import java.awt.Graphics;
 
+import sun.awt.AWTAccessor;
+import sun.awt.RepaintArea;
+
 /**
+ * Emulates appearance of heavyweight components before call of the user code.
+ *
  * @author Sergey Bylokhov
  */
 final class LWRepaintArea extends RepaintArea {
 
     @Override
     protected void updateComponent(final Component comp, final Graphics g) {
+        // We shouldn't paint native component as a result of UPDATE events,
+        // just flush onscreen back-buffer.
         if (comp != null) {
             super.updateComponent(comp, g);
-            flushBuffers((LWComponentPeer) comp.getPeer());
+            LWComponentPeer.flushOnscreenGraphics();
         }
     }
 
     @Override
     protected void paintComponent(final Component comp, final Graphics g) {
         if (comp != null) {
-            final LWComponentPeer peer = (LWComponentPeer) comp.getPeer();
+            Object peer = AWTAccessor.getComponentAccessor().getPeer(comp);
             if (peer != null) {
-                peer.paintPeer(g);
+                ((LWComponentPeer<?, ?>) peer).paintPeer(g);
             }
             super.paintComponent(comp, g);
-            flushBuffers(peer);
-        }
-    }
-
-    private static void flushBuffers(final LWComponentPeer peer) {
-        if (peer != null) {
-            peer.flushOnscreenGraphics();
+            LWComponentPeer.flushOnscreenGraphics();
         }
     }
 }
--- a/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollBarPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -34,10 +34,14 @@
 
 import javax.swing.JScrollBar;
 
+/**
+ * Lightweight implementation of {@link ScrollbarPeer}. Delegates most of the
+ * work to the {@link JScrollBar}.
+ */
 final class LWScrollBarPeer extends LWComponentPeer<Scrollbar, JScrollBar>
         implements ScrollbarPeer, AdjustmentListener {
 
-    //JScrollBar fires two changes with firePropertyChange (one for old value
+    // JScrollBar fires two changes with firePropertyChange (one for old value
     // and one for new one.
     // We save the last value and don't fire event if not changed.
     private int currentValue;
@@ -48,7 +52,7 @@
     }
 
     @Override
-    protected JScrollBar createDelegate() {
+    JScrollBar createDelegate() {
         return new JScrollBar();
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWScrollPanePeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,6 +33,10 @@
 import java.awt.peer.ScrollPanePeer;
 import java.util.List;
 
+/**
+ * Lightweight implementation of {@link ScrollPanePeer}. Delegates most of the
+ * work to the {@link JScrollPane}.
+ */
 final class LWScrollPanePeer extends LWContainerPeer<ScrollPane, JScrollPane>
         implements ScrollPanePeer, ChangeListener {
 
@@ -41,7 +45,8 @@
         super(target, platformComponent);
     }
 
-    protected JScrollPane createDelegate() {
+    @Override
+    JScrollPane createDelegate() {
         final JScrollPane sp = new JScrollPane();
         final JPanel panel = new JPanel();
         panel.setOpaque(false);
@@ -72,7 +77,7 @@
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
-                final LWComponentPeer viewPeer = getViewPeer();
+                final LWComponentPeer<?, ?> viewPeer = getViewPeer();
                 if (viewPeer != null) {
                     final Rectangle r;
                     synchronized (getDelegateLock()) {
@@ -96,14 +101,13 @@
         }
     }
 
-    LWComponentPeer getViewPeer() {
-        List<LWComponentPeer> peerList = getChildren();
+    LWComponentPeer<?, ?> getViewPeer() {
+        final List<LWComponentPeer<?, ?>> peerList = getChildren();
         return peerList.isEmpty() ? null : peerList.get(0);
     }
 
-
     @Override
-    protected Rectangle getContentSize() {
+    Rectangle getContentSize() {
         Rectangle viewRect = getDelegate().getViewport().getViewRect();
         return new Rectangle(viewRect.width, viewRect.height);
     }
@@ -112,7 +116,7 @@
     public void layout() {
         super.layout();
         synchronized (getDelegateLock()) {
-            LWComponentPeer viewPeer = getViewPeer();
+            final LWComponentPeer<?, ?> viewPeer = getViewPeer();
             if (viewPeer != null) {
                 Component view = getDelegate().getViewport().getView();
                 view.setBounds(viewPeer.getBounds());
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextAreaPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,7 +44,7 @@
 
 /**
  * Lightweight implementation of {@link TextAreaPeer}. Delegates most of the
- * work to the {@link JTextArea} inside JScrollPane.
+ * work to the {@link JTextArea} inside {@link JScrollPane}.
  */
 final class LWTextAreaPeer
         extends LWTextComponentPeer<TextArea, LWTextAreaPeer.ScrollableJTextArea>
@@ -66,7 +66,7 @@
     }
 
     @Override
-    protected ScrollableJTextArea createDelegate() {
+    ScrollableJTextArea createDelegate() {
         return new ScrollableJTextArea();
     }
 
@@ -85,7 +85,7 @@
     }
 
     @Override
-    protected Cursor getCursor(final Point p) {
+    Cursor getCursor(final Point p) {
         final boolean isContains;
         synchronized (getDelegateLock()) {
             isContains = getDelegate().getViewport().getBounds().contains(p);
@@ -94,7 +94,7 @@
     }
 
     @Override
-    protected Component getDelegateFocusOwner() {
+    Component getDelegateFocusOwner() {
         return getTextComponent();
     }
 
@@ -200,7 +200,7 @@
         }
     }
 
-    @SuppressWarnings("serial")
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     final class ScrollableJTextArea extends JScrollPane {
 
         ScrollableJTextArea() {
@@ -218,7 +218,6 @@
             super.setEnabled(enabled);
         }
 
-        @SuppressWarnings("serial")
         private final class JTextAreaDelegate extends JTextArea {
 
             // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextComponentPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -44,11 +44,14 @@
 import javax.swing.text.Document;
 import javax.swing.text.JTextComponent;
 
+/**
+ * Lightweight implementation of {@link TextComponentPeer}. Provides useful
+ * methods for {@link LWTextAreaPeer} and {@link LWTextFieldPeer}
+ */
 abstract class LWTextComponentPeer<T extends TextComponent, D extends JComponent>
         extends LWComponentPeer<T, D>
         implements DocumentListener, TextComponentPeer, InputMethodListener {
 
-
     private volatile boolean firstChangeSkipped;
 
     LWTextComponentPeer(final T target,
@@ -218,14 +221,14 @@
     }
 
     @Override
-    public void inputMethodTextChanged(InputMethodEvent event) {
+    public void inputMethodTextChanged(final InputMethodEvent event) {
         synchronized (getDelegateLock()) {
             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
         }
     }
 
     @Override
-    public void caretPositionChanged(InputMethodEvent event) {
+    public void caretPositionChanged(final InputMethodEvent event) {
         synchronized (getDelegateLock()) {
             AWTAccessor.getComponentAccessor().processEvent(getTextComponent(), event);
         }
--- a/jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWTextFieldPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -37,6 +37,10 @@
 import javax.swing.*;
 import javax.swing.text.JTextComponent;
 
+/**
+ * Lightweight implementation of {@link TextFieldPeer}. Delegates most of the
+ * work to the {@link JPasswordField}.
+ */
 final class LWTextFieldPeer
         extends LWTextComponentPeer<TextField, JPasswordField>
         implements TextFieldPeer, ActionListener {
@@ -47,7 +51,7 @@
     }
 
     @Override
-    protected JPasswordField createDelegate() {
+    JPasswordField createDelegate() {
         return new JPasswordFieldDelegate();
     }
 
@@ -107,7 +111,7 @@
      * @param e the focus event
      */
     @Override
-    protected void handleJavaFocusEvent(final FocusEvent e) {
+    void handleJavaFocusEvent(final FocusEvent e) {
         if (e.getID() == FocusEvent.FOCUS_LOST) {
             // In order to de-select the selection
             setCaretPosition(0);
@@ -115,6 +119,7 @@
         super.handleJavaFocusEvent(e);
     }
 
+    @SuppressWarnings("serial")// Safe: outer class is non-serializable.
     private final class JPasswordFieldDelegate extends JPasswordField {
 
         // Empty non private constructor was added because access to this
--- a/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWToolkit.java	Mon Sep 23 16:17:26 2013 +0400
@@ -557,16 +557,18 @@
     }
 
     @Override
-    public void grab(Window w) {
-        if (w.getPeer() != null) {
-            ((LWWindowPeer)w.getPeer()).grab();
+    public void grab(final Window w) {
+        final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
+        if (peer != null) {
+            ((LWWindowPeer) peer).grab();
         }
     }
 
     @Override
-    public void ungrab(Window w) {
-        if (w.getPeer() != null) {
-            ((LWWindowPeer)w.getPeer()).ungrab(false);
+    public void ungrab(final Window w) {
+        final Object peer = AWTAccessor.getComponentAccessor().getPeer(w);
+        if (peer != null) {
+            ((LWWindowPeer) peer).ungrab(false);
         }
     }
 
--- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Mon Sep 23 16:14:42 2013 +0400
+++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java	Mon Sep 23 16:17:26 2013 +0400
@@ -43,7 +43,7 @@
     extends LWContainerPeer<Window, JComponent>
     implements FramePeer, DialogPeer, FullScreenCapable, DisplayChangedListener, PlatformEventNotifier
 {
-    public static enum PeerType {
+    public enum PeerType {
         SIMPLEWINDOW,
         FRAME,
         DIALOG,
@@ -83,15 +83,15 @@
 
     // A peer where the last mouse event came to. Used by cursor manager to
     // find the component under cursor
-    private static volatile LWComponentPeer lastCommonMouseEventPeer = null;
+    private static volatile LWComponentPeer<?, ?> lastCommonMouseEventPeer;
 
     // A peer where the last mouse event came to. Used to generate
     // MOUSE_ENTERED/EXITED notifications
-    private volatile LWComponentPeer lastMouseEventPeer;
+    private volatile LWComponentPeer<?, ?> lastMouseEventPeer;
 
     // Peers where all dragged/released events should come to,
     // depending on what mouse button is being dragged according to Cocoa
-    private static LWComponentPeer mouseDownTarget[] = new LWComponentPeer[3];
+    private static final LWComponentPeer<?, ?>[] mouseDownTarget = new LWComponentPeer<?, ?>[3];
 
     // A bitmask that indicates what mouse buttons produce MOUSE_CLICKED events
     // on MOUSE_RELEASE. Click events are only generated if there were no drag
@@ -129,7 +129,8 @@
         this.peerType = peerType;
 
         Window owner = target.getOwner();
-        LWWindowPeer ownerPeer = (owner != null) ? (LWWindowPeer)owner.getPeer() : null;
+        LWWindowPeer ownerPeer = owner == null ? null :
+             (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
         PlatformWindow ownerDelegate = (ownerPeer != null) ? ownerPeer.getPlatformWindow() : null;
 
         // The delegate.initialize() needs a non-null GC on X11.
@@ -163,10 +164,10 @@
 
         // Init warning window(for applets)
         SecurityWarningWindow warn = null;
-        if (((Window)target).getWarningString() != null) {
+        if (target.getWarningString() != null) {
             // accessSystemTray permission allows to display TrayIcon, TrayIcon tooltip
             // and TrayIcon balloon windows without a warning window.
-            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow((Window)target)) {
+            if (!AWTAccessor.getWindowAccessor().isTrayIconWindow(target)) {
                 LWToolkit toolkit = (LWToolkit)Toolkit.getDefaultToolkit();
                 warn = toolkit.createSecurityWarning(target, this);
             }
@@ -210,6 +211,7 @@
     }
 
     // Just a helper method
+    @Override
     public PlatformWindow getPlatformWindow() {
         return platformWindow;
     }
@@ -391,7 +393,8 @@
     @Override
     public void setModalBlocked(Dialog blocker, boolean blocked) {
         synchronized (getPeerTreeLock()) {
-            this.blocker = blocked ? (LWWindowPeer)blocker.getPeer() : null;
+            this.blocker = !blocked ? null :
+            (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(blocker);
         }
 
         platformWindow.setModalBlocked(blocked);
@@ -458,6 +461,7 @@
         textured = isTextured;
     }
 
+    @Override
     public final boolean isTranslucent() {
         synchronized (getStateLock()) {
             /*
@@ -537,7 +541,8 @@
     public void blockWindows(List<Window> windows) {
         //TODO: LWX will probably need some collectJavaToplevels to speed this up
         for (Window w : windows) {
-            WindowPeer wp = (WindowPeer)w.getPeer();
+            WindowPeer wp =
+                    (WindowPeer) AWTAccessor.getComponentAccessor().getPeer(w);
             if (wp != null) {
                 wp.setModalBlocked((Dialog)getTarget(), true);
             }
@@ -694,7 +699,7 @@
         // TODO: fill "bdata" member of AWTEvent
         Rectangle r = getBounds();
         // findPeerAt() expects parent coordinates
-        LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y);
+        LWComponentPeer<?, ?> targetPeer = findPeerAt(r.x + x, r.y + y);
 
         if (id == MouseEvent.MOUSE_EXITED) {
             isMouseOver = false;
@@ -743,7 +748,7 @@
                         screenX, screenY, modifiers, clickCount, popupTrigger,
                         targetPeer);
             } else {
-                LWComponentPeer topmostTargetPeer =
+                LWComponentPeer<?, ?> topmostTargetPeer =
                         topmostWindowPeer != null ? topmostWindowPeer.findPeerAt(r.x + x, r.y + y) : null;
                 topmostWindowPeer.generateMouseEnterExitEventsForComponents(when, button, x, y,
                         screenX, screenY, modifiers, clickCount, popupTrigger,
@@ -840,7 +845,7 @@
     private void generateMouseEnterExitEventsForComponents(long when,
             int button, int x, int y, int screenX, int screenY,
             int modifiers, int clickCount, boolean popupTrigger,
-            LWComponentPeer targetPeer) {
+            final LWComponentPeer<?, ?> targetPeer) {
 
         if (!isMouseOver || targetPeer == lastMouseEventPeer) {
             return;
@@ -899,7 +904,7 @@
         // TODO: could we just use the last mouse event target here?
         Rectangle r = getBounds();
         // findPeerAt() expects parent coordinates
-        final LWComponentPeer targetPeer = findPeerAt(r.x + x, r.y + y);
+        final LWComponentPeer<?, ?> targetPeer = findPeerAt(r.x + x, r.y + y);
         if (targetPeer == null || !targetPeer.isEnabled()) {
             return;
         }
@@ -1157,8 +1162,9 @@
                 if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
                     focusLog.fine("requesting native focus to the owner " + owner);
                 }
-                LWWindowPeer currentActivePeer = (currentActive != null ?
-                    (LWWindowPeer)currentActive.getPeer() : null);
+                LWWindowPeer currentActivePeer = currentActive == null ? null :
+                (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(
+                        currentActive);
 
                 // Ensure the opposite is natively active and suppress sending events.
                 if (currentActivePeer != null && currentActivePeer.platformWindow.isActive()) {
@@ -1270,7 +1276,8 @@
         while (owner != null && !(owner instanceof Frame || owner instanceof Dialog)) {
             owner = owner.getOwner();
         }
-        return owner != null ? (LWWindowPeer)owner.getPeer() : null;
+        return owner == null ? null :
+               (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(owner);
     }
 
     /**
@@ -1289,11 +1296,13 @@
         }
     }
 
+    @Override
     public void enterFullScreenMode() {
         platformWindow.enterFullScreenMode();
         updateSecurityWarningVisibility();
     }
 
+    @Override
     public void exitFullScreenMode() {
         platformWindow.exitFullScreenMode();
         updateSecurityWarningVisibility();
--- a/jdk/src/macosx/classes/sun/lwawt/SelectionClearListener.java	Mon Sep 23 16:14:42 2013 +0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2011, 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 sun.lwawt;
-
-/*
- * Every time the TextField (or TextArea) change selection, every other text components
- * must immediately clear their selections.
- */
-interface SelectionClearListener {
-   void clearSelection();
-}