Unneeded array assignments in client-libs
Anthony Goubard
anthony.goubard at gmail.com
Mon Nov 27 20:21:08 UTC 2023
Hello,
Last Friday, I decided to look if there were some classes that did
unneeded array assignments (e.g. to 0 / 0.0f / null / false) in the JDK and
found many in the client-libs.
Here are a few examples of unneeded assignments done in a for loop:
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java#L344
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/sun/java2d/cmm/lcms/LCMSTransform.java#L359
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/com/sun/imageio/plugins/jpeg/JPEGImageWriter.java#L1423
https://github.com/openjdk/jdk/blob/master/src/java.desktop/windows/classes/com/sun/java/swing/plaf/windows/WindowsFileChooserUI.java#L1180
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/com/sun/media/sound/SoftLanczosResampler.java#L61
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/text/rtf/AbstractFilter.java#L69
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeSelectionModel.java#L579
https://github.com/openjdk/jdk/blob/master/src/java.desktop/share/classes/com/sun/imageio/plugins/bmp/BMPImageWriter.java#L913
-> move to the else branch
Note that I listed here some of them found in the client-libs but I also
found others in other parts of OpenJDK.
I think you may be interested in removing these unneeded assignments. If
so, can you let me know how you would like to proceed?
* My idea would be that I create an issue in JBS per classes/category
along with a merge request from my github repository. I would need Author
access for this.
* I can also send the list to the different mailing lists.
* Or if you prefer, I can create one issue per part of the JDK with a
merge request.
I also found a few that were not in a for loop, let me know if you're also
interested to know about these ones.
Best regards,
Anthony Goubard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/client-libs-dev/attachments/20231127/98a67d11/attachment.htm>
More information about the client-libs-dev
mailing list