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

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Wed Jun 8 14:37:02 UTC 2016

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.

> 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.

>>> 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?
> --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

Best regards, Sergey.

More information about the awt-dev mailing list