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()) ..
This recipe replaces the use of getPeer() method in java.awt.* classes. The method component.getPeer() != null
is replaced with component.isDisplayable() and
component.getPeer() instanceof LightweightPeer is replaced with component.isLightweight().
Copy the custom configuration to your application build file to enable the fix automation.
For more information, see the java.awt.peer Not Accessible and Class Component documentation.