<AWT Dev> [9] Review Request: 8004693 TEST_BUG: java/awt/KeyboardFocusmanager/DefaultPolicyChange/DefaultPolicyChange_Swing.java fails

Semyon Sadetsky semyon.sadetsky at oracle.com
Wed Jun 8 16:53:54 UTC 2016


On 6/8/2016 5:37 PM, Sergey Bylokhov wrote:

> On 08.06.16 10:12, Semyon Sadetsky wrote:
>> Since method equals() is not specified in the FTP class, you cannot make
>> any assumption how it is implemented, it may return true for different
>> classes instances. So in the test the policy untouchability should be
>> checked by ==, without any additional assumptions about the equals()
>> method implementation.
>
> Above I describe that the different instances of the same policy is 
> fine, because this is the same policy. Also I do not get it why the 
> equals is not specified, you can open specification of Object.equals() 
> and read it.
Yes, but the Object#equlas() does not prohibit different class instances 
to be equal. The purpose of the test is to prove that existing 
component's FTP instances remain untouchable during the default FTP 
change regardless of the specific FTP implementation. This may be tested 
only by == operator. Or please provide a scenario when they are allowed 
be replaced by some equivalent FTP's.
>
>> I know. But this is not needed because it does not produce any valuable
>> information for a normal test execution (when it is passed).
>
> Why? It is useful to know what policy is used when the test passed.
Because the main purpose of the test is to automatically compare FTPs, 
so this verbose output is not necessary and this extra printout 
duplicates printout in case the test is failed.
>
>>>> That is what I asked. For what purpose this dummy content is added? 
>>>> Can
>>>> you clarify that?
>
> This is an emulation of the common dialog used by the application 
> which have some components which can be focused inside.
>
>
>>> By the same reason why JDialog, JWindow and JFrame are added, it
>>> increase the coverage if any side affects exists.
>> JDialog, JWindow and JFrame are focus traversal cycle roots by default,
>> but those "dummy" components are not, i.e. their FTPs are not used and
>> are nulls by default.
>> So could you point to the code related to the handling of the default
>> FTP change, that is additionally covered by the test due to those
>> "dummy" components?
Please answer the above question to avoid incoherence in the discussion.
>>
>> --Semyon
>>>
>>>>>> On 5/30/2016 7:39 PM, Sergey Bylokhov wrote:
>>>>>>> Hello.
>>>>>>> Please review the fix for jdk9.
>>>>>>>
>>>>>>> The test DefaultPolicyChange_Swing.java has two issues:
>>>>>>>  - It uses invokeLater(), so the test usually pass before the 
>>>>>>> code is
>>>>>>> executed on the EDT, because the main thread completes before.
>>>>>>>  - The test fetches the FocusTraversalPolicy from the current
>>>>>>> KeyboardFocusManager. But default FocusTraversalPolicy can be 
>>>>>>> changed
>>>>>>> during the Swing initialization(JDK-7125044). The test should save
>>>>>>> the
>>>>>>> state before setDefaultFocusTraversalPolicy() but after the Swing
>>>>>>> initialization, and validate that the FocusTraversalPolicy was not
>>>>>>> changed for windows which were already shown.
>>>>>>>
>>>>>>> The fix proposed in the CR is applied + small 
>>>>>>> cleanup(regtesthelpers
>>>>>>> removed and InvokeAndWait is used instead of InvokeLater+realSync)
>>>>>>>
>>>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8004693
>>>>>>> Webrev can be found at:
>>>>>>> http://cr.openjdk.java.net/~serb/8004693/webrev.01
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>>
>>
>
>



More information about the awt-dev mailing list