Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Many mostly automated code quality fixups #111

Merged
merged 6 commits into from
Jul 1, 2024

Conversation

StenAL
Copy link

@StenAL StenAL commented May 31, 2024

IntelliJ and Maven were complaining about lots of warnings and offering automatic fixups for most of them. This PR integrates the following fixes:

  • remove uses of deprecated boxed number constructors
  • fix most warnings about unchecked collection usage
  • remove redundant casts
  • remove all unused imports
  • use String.repeat() instead of for-loop for string building (available
    since Java 11)
  • use enchanced for loop (i.e. for (Class item: collection)) where
    possible (available since Java 5)
  • remove unnecessary unboxing of wrapped types, i.e. calls to
    .intValue() (available since Java 5)
  • use diamond shorthand (<>) in generics where available (available
    since Java 7)
  • replace C-style array declarations with Java style declarations
  • remove unnecessary character escapes
  • replace manual min/max calculations with Math.min/max calls
  • remove redundant array initializations
  • convert some Javadoc comments to normal multiline comments, remove
    other useless ones
  • remove some unused imports
  • remove redundant "throws" clauses
  • remove redundant semicolons from empty catch blocks
  • remove unnecessary toString calls
  • use magic constants (e.g. Font.PLAIN) instead of integers where
    possible

Maven and IntelliJ were complaining about missing generics so I added
them everywhere.
This is an automated change done by IntelliJ.
IntelliJ was complaining about many warnings and offered automatic fixes
for them so this commit applies the following changes:
- use String.repeat() instead of for-loop for string building (available
 since Java 11)
- use enchanced for loop (i.e. `for (Class item: collection)`) where
  possible (available since Java 5)
- remove unnecessary unboxing of wrapped types, i.e. calls to
  .intValue() (available since Java 5)
- use diamond shorthand (<>) in generics where available (available
  since Java 7)
- replace C-style array declarations with Java style declarations
- remove unnecessary character escapes
- replace manual min/max calculations with Math.min/max calls
- remove redundant array initializations
- convert some Javadoc comments to normal multiline comments, remove
other useless ones
- remove some unused imports
- remove redundant "throws" clauses
- remove redundant semicolons from empty catch blocks
- remove unnecessary toString calls
- use magic constants (e.g. Font.PLAIN) instead of integers where
  possible
All other files in the client project use LF line endings.
Done with `find client -type f | xargs dos2unix`
@PhilippvK PhilippvK merged commit a42cf4d into PhilippvK:master Jul 1, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants