Skip to content

Conversation

@marcphilipp
Copy link
Member

@marcphilipp marcphilipp commented Jul 9, 2025

  • Classes with equals calling getClass() may potentially problematic.
    I made them final where they were "effectively" final by only
    having private or package-private constructors.

  • I switched from LinkedList to ArrayList or ArrayDeque based on
    ErrorProne's recommendations.


I hereby agree to the terms of the JUnit Contributor License Agreement.


Definition of Done

* Classes with equals calling `getClass()` may potentially problematic.
  I made them `final` where they were "effectively" `final` by only
  having private or package-private constructors.

* I switched from `LinkedList` to `ArrayList` or `ArrayDeque` based on
  ErrorProne's recommendations.
Comment on lines 25 to 32
"BadImport",
"UnnecessaryLambda",
"AnnotateFormatMethod",
"StringSplitter",
"DoNotCallSuggester",
"InlineMeSuggester",
"ImmutableEnumChecker",
"MissingSummary"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some of those checks do sound interesting, though, especially UnnecessaryLambda.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be worth adding a TODO comment for such "nice to fix" so somebody could pick them later.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added comments explaining my decision to disable these checks in 73e3dad.

Copy link
Member

@sormuras sormuras left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All textual updates, including in API documentation and suppressions, look reasonable.
Code changes seem to be covered by existing tests.

@vlsi
Copy link
Contributor

vlsi commented Jul 10, 2025

There's https://errorprone.info/bugpattern/PackageLocation which has "suggestion" level by default, and it is probably worth having as error("PackageLocation")

@marcphilipp
Copy link
Member Author

There's errorprone.info/bugpattern/PackageLocation which has "suggestion" level by default, and it is probably worth having as error("PackageLocation")

Thanks for the suggestion! Added in b8357c3

@marcphilipp marcphilipp marked this pull request as ready for review July 10, 2025 09:50
Comment on lines +119 to +124
var value = random.nextLong();
if (value == Long.MIN_VALUE) {
// ensure Math.abs returns positive value
value++;
}
return Math.abs(value);
Copy link
Contributor

@vlsi vlsi Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way, Java 17 has random.nextLong(Long.MAX_VALUE). Have you considered it instead?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcphilipp marcphilipp merged commit 9236ce0 into main Jul 10, 2025
15 checks passed
@marcphilipp marcphilipp deleted the marc/error-prone-checks branch July 10, 2025 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants