<AWT Dev> [9] Review Request: 8074757 Remove java.awt.Toolkit methods which return peer types

Phil Race philip.race at oracle.com
Fri Apr 3 16:59:58 UTC 2015


HeadlessToolkit.java

  321     @Override
  322     @SuppressWarnings("deprecation")                <<<=== We don't need this any more do we ?
  323     public FontPeer getFontPeer(String name, int style) {
  324         if (componentFactory != null) {
  325             return componentFactory.getFontPeer(name, style);
  326         }
  327         return null;
  328     }


I expect there are others like this that can be removed too that I 
haven't spotted yet.

 > - The questionable moment is that I throw an AWTError in a some 
places if a
 >  default toolkit not implements ComponentFactory interface.

A current implementation of Toolkit that uses the peers isn't even going 
to get so far
as to receive this exception. If someone were to try to update their 
Toolkit to no
longer use the peers, would it be possible to support just the 
'headless' case, so
that they'd be able to implement a headless toolkit without peers but 
not a headful one ?

-phil.

On 04/02/2015 08:15 AM, Sergey Bylokhov wrote:
> Hello.
> Please review the fix for jdk 9.
> There are a number of public methods in the java.awt.Toolkit class, 
> which reference the unsupported java.awt.dnd.peer and java.awt.peer 
> interfaces.
>
> There is a decision to remove these references as described: 
> http://mail.openjdk.java.net/pipermail/awt-dev/2015-February/008924.html
> Changes description:
>  - All such methods were moved from Toolkit.java to the 
> ComponentFactory.java. Note that all our toolkits implement 
> ComponentFactory interface.
>  - HToolkit, HeadlessToolkit, SunToolkit were cleared because they 
> have the same implementation of these methods as in ComponentFactory.
>  - The questionable moment is that I throw an AWTError in a some 
> places if a default toolkit not implements ComponentFactory interface.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8074757
> Webrev can be found at: 
> http://cr.openjdk.java.net/~serb/8074757/webrev.04
>



More information about the awt-dev mailing list