<Swing Dev> [15] RFR JDK-8222759: com.sun.java.swing.plaf.gtk.GTKLookAndFeel Unneccessary casts to GTKStyleFactory

Phil Race philip.race at oracle.com
Fri Dec 20 17:01:02 UTC 2019


Looks fine. Please use the amended and corrected  bug synopsis in the 
commit message

-phil.

On 12/19/19 11:36 PM, Pankaj Bansal wrote:
>
> Hi All,
>
> Please review the following fix for jdk15.
>
>
> Bug:
>
> https://bugs.openjdk.java.net/browse/JDK-8222759
>
> webrev:
>
> http://cr.openjdk.java.net/~pbansal/8222759/webrev00/
>
> Issue:
>
> There are some unnecessary casts of 
> javax.swing.plaf.synth.SynthStyleFactory to 
> com.sun.java.swing.plaf.gtk.GTKStyleFactory in GTKLookAndFeel class. 
> There is only one function “getStyle” being called after this cast, 
> but that is declared in SynthStyleFactory as abstract and defined in 
> GTKStyleFactory. So this function can be called without this cast too.
>
> Because of this cast, if someone is trying to use a custom 
> SynthStyleFactory with GTKLookAndFeel, there is a ClassCastException.
>
> Fix:
>
> Removed the cast as it is not required here.
>
> Testing:
>
> I have run SwingSet2 with GTKLookAndFeel after this change. All works 
> fine. Added testcase fails without fix and passes after the fix.
>
>
> Regards,
> Pankaj Bansal
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/swing-dev/attachments/20191220/21bb7cb7/attachment.htm>


More information about the swing-dev mailing list