<AWT Dev> AWT cleanup?

Chris seahen123 at gmail.com
Thu Oct 20 11:32:16 UTC 2016


While working on SkinJob, I ran IntelliJ's Code Inspector tool over OpenJDK
AWT, and I found lots of room for improvement, much of which could be
automated. Unused imports and weird indentation are the order of the day.
Raw types are often used in place of generics, leading to a lot of
unnecessary explicit casts. The deprecated Vector and Hashtable are used in
a number of places where I'm pretty sure ArrayList<> and HashMap<> would
work fine and perform better. Many abstract classes have only one
implementation. Switch statements are often missing a default case, which
means methods will fail silently if a parameter value comes from the wrong
pseudo-enum. When they do have a default case, it seems to be at the top as
often as the bottom. Magic numbers that I can easily see a developer
wanting to change (e.g. the default font size of 12) are copied in many
different places. Even when named constants for things like color-channel
bit masks exist, they aren't consistently used. There also seem to be a
fair number of unused methods that aren't public or are buried in sun.*
(and thus should be safe to delete), and a few inconsistencies involving
equals and hashCode.

Is there a project underway to clean up these sorts of issues? If so, I'd
like to help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20161020/40a968b8/attachment.html>


More information about the awt-dev mailing list