<AWT Dev> [9] Review Request: 8074028 Remove API references to java.awt.peer

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Mar 4 12:37:44 UTC 2015

Please review the fix for jdk 9.
There are a number of public API whichreference the unsupported 
java.awt.peer interfaces.

public java.awt.Component.getPeer() @deprecated 1.1
public java.awt.Font.getPeer() @deprecated 1.1
public java.awt.MenuComponent.getPeer() @deprecated 1.1

There is a decision to remove this methods as described: 

Most important changes:
-    /**
-     * @deprecated As of JDK version 1.1,
-     * programs should not directly manipulate peers;
-     * replaced by <code>boolean isDisplayable()</code>.
-     * @return the peer for this component
-     */
-    @Deprecated
-    public ComponentPeer getPeer() {
-        return peer;
-    }

Component.getPeer was removed and its usage was replaced by:
  - dirrect access to the field if possible
  - (getPeer() !=/== null) is replaced by the isDisplayable()
  - All other places now use an AWTAccessor.

-    /**
-     * @deprecated As of JDK version 1.1,
-     * programs should not directly manipulate peers.
-     * @return the peer for this component
-     */
-    @Deprecated
-    public MenuComponentPeer getPeer() {
-        return peer;
-    }

MenuComponentPeer.getPeer was removed, now we use an AWTAccessor instead.

Font.getPeer() access was changed to the private, because it is not 
simple getter, and it is used in native code. On the java side now we 
use an AWTAccessor.

Also I tried to fix the open tests, but not sure that I cover all of 
them. I'll fix other tests in the separate CR.

Bug: https://bugs.openjdk.java.net/browse/JDK-8074028
Webrev can be found at: http://cr.openjdk.java.net/~serb/8074028/webrev.05

Best regards, Sergey.

More information about the awt-dev mailing list