<Swing Dev> [9] Review Request: 8048887 SortingFocusTraversalPolicy throws IllegalArgumentException from the sort method

Alexander Scherbatiy alexandr.scherbatiy at oracle.com
Wed Jul 2 14:43:41 UTC 2014

  The fix looks good to me.


On 7/1/2014 7:22 PM, Anton V. Tarasov wrote:
> Hello,
> Please review a fix:
> bug: https://bugs.openjdk.java.net/browse/JDK-8048887
> webrev: http://cr.openjdk.java.net/~ant/JDK-8048887/webrev.0
> The problem is that SortingFocusTraversalPolicy uses ROW_TOLERANCE 
> conception to alter a disposition of components in a focus cycle for 
> the sake of visually more appropriate traversal order. This however 
> breaks the transitivity rule, which in case of using the default 
> tim-sort algo leads to an exception.
> We've got a number of complaints filed against this issue, so I 
> eventually agreed to use reflection as suggested in JDK-7075600.
> I've tested performance in the following way. In a jframe I was adding 
> up to 10.000 components a) at random location (with frame's null 
> Layout) so that to completely untie traversal order from container 
> order (hard case for the sort), and b) sequentially, so that to have 
> the traversal order pre-sorted. Then I counted time spent in the 
> sorting procedure. The results of the legacy merge-sort and the 
> default tim-sort were pretty close. So, the fallback to the legacy 
> sorting algo shouldn't hit performance for Swing.
> Just for the case of any unpredictable issue (and for the testing 
> purpose), I left an ability to switch to the default tim-sort via 
> setting the (undocumented) "swing.legacySortingFTPEnabled" property to 
> false.
> Regards,
> Anton.

More information about the swing-dev mailing list