JDK-8037739 : Remove API references to java.awt.peer and java.awt.dnd.peer packages in the JDK 9 timeframe
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
See http://mail.openjdk.java.net/pipermail/awt-dev/2015-February/008924.html for the openjdk announcement.
This Task will be open until three sub-tasks (JDK-8074028, JDK-8074757, JDK-8074763) will not be pushed to the master ws (after PIT), following up some additional steps which might be needed.
Converting this issue to a Task and create Sub-Tasks is fine.
I will plan to split the fix in 3 subtasks.
- Removing of Component.getPeer()
- Removing of Toolkit.createXXX
- Everything else.
The first part will be sent to the review this week.
I think we should change the synopsis on this issue, it's really about removing the references to types in java.awt.peer from the APIs in Java SE. Yes, this will be at incompatible change but should not be a big surprise to anyone as these methods have been deprecated for >15 years.
These public SE APIs reference the unsupported java.awt.peer and java.awt.dnd.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
The following are not deprecated:
protected java.awt.dnd.DragSource.createDragSourceContext(java.awt.dnd.peer.DragSourceContextPeer, ...)
public java.awt.dnd.DragSourceContext(java.awt.dnd.peer.DragSourceContextPeer, ...) constructor
public java.awt.dnd.DropTarget.addNotify(ComponentPeer peer) and removeNotify(ComponentPeer peer)
public java.awt.dnd.DropTargetContext.addNotify(DropTargetContextPeer dtcp)
java.awt.Toolkit has many protected methods that return peer types:
createButton, createCanvas, createCheckbox....
There are two methods in java.awt.peer.ComponentPeer interface referencing sun.* API:
boolean requestFocus(Component lightweightChild, boolean temporary,
boolean focusedWindowChangeAllowed, long time,
void applyShape(sun.java2d.pipe.Region shape);
java.awt.Component.isLightweight() method can be used to check if it's a lightweight peer. This method should be used to replace
component.getPeer() instanceof java.awt.peer.LightweightPeer
to avoid the dependency on JDK internal API.
It would be great if these methods could be removed, do you think you can establish the compatibility impact?
XXXX.getPeer was marked as deprectaed in 1996/1998, do we have an option to remove it?