All methods that refer to types defined in the java.awt.peer package are removed in Java 11.
This rule flags the use of the getPeer() method on the java.awt.Component, java.awt.Font, and
java.awt.MenuComponent classes and direct known subclasses.
To see if a peer has been set, replace:
if (component.getPeer() != null) { .. }
with the following:
if (component.isDisplayable()) { .. }
To test if a component is lightweight, replace:
if (component.getPeer() instanceof LightweightPeer) ..
with the following:
if (component.isLightweight()) ..
For more information, see the java.awt.peer Not Accessible and Class Component documentation.