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

Pankaj Bansal pankaj.b.bansal at oracle.com
Fri Dec 20 07:36:51 UTC 2019


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/20191219/823a6e7f/attachment.htm>


More information about the swing-dev mailing list