<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 17:14:18 UTC 2015
On 04/03/2015 10:15 AM, Sergey Bylokhov wrote:
> 03.04.15 19:59, Phil Race wrote:
>> 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.
> ComponentFactory.getFontPeer() is deprecated as before the fix, so I
> need to suppress the warning.
It does not need to be deprecated. It can be 'undeprecated' It was
deprecated only because
it was the public Toolkit method that is now gone ..
>
>>
>> > - 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 ?
> Yes, it is possible. But in this case the new AWTError will not
> occurs, because usually we checks the headless property in the
> constructor of the component.
> for ex:
> public Button(String label) throws HeadlessException {
> GraphicsEnvironment.checkHeadless();
> this.label = label;
> }
So perhaps there's just a small adjustment needed in the case of where
we use createComponent() ??
-phil.
>>
>> -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
>>>
>>
>
>
> --
> Best regards, Sergey.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20150403/06199348/attachment.html>
More information about the awt-dev
mailing list