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

Anton V. Tarasov anton.tarasov at oracle.com
Fri Apr 10 08:52:36 UTC 2015

On 07.04.2015 17:28, Sergey Bylokhov wrote:
> On 03.04.15 20:14, Phil Race wrote:
>> 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 ..
> Ok, I'll update it.
>> So perhaps there's just a small adjustment needed in the case of where we use createComponent() ??
> It is used in 3 places:
>  - Indirectly in Canvas and Panel where our headless toolkits creates NullComponentPeer instead of 
> the native peer. So the question is this is implementation detail of our headless toolkit or all 
> such toolkits should use the same things.
>  - In Component class I can reuse NullComponentPeer, but it is unclear how we survive this later 
> when external tollkit is in use.
> If nobody objects then I suggest for now to use this new error as an assertion to find possible 
> usage of these methods, instead of silent usage of some empty stub, and fail sometime later with 
> unclear reason.

Hi Sergey,

I don't object throwing AWTError. However, if we still claim to support external toolkits at least 
in headless env, then doesn't it make sense to clarify the error message?

+        throw new AWTError("Unsupported toolkit: " + toolkit);

to something like "Unsupported headful toolkit" or "Only headless custom toolkits are supported"?


>> -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.
> -- 
> Best regards, Sergey.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20150410/184a629e/attachment-0001.html>

More information about the awt-dev mailing list