Skip to content

Commit

Permalink
Issue checkstyle#14137: Enable PrimitiveComparison check
Browse files Browse the repository at this point in the history
  • Loading branch information
rickie authored and romani committed Feb 2, 2024
1 parent 943576f commit 5b918db
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,14 @@
<fileName>src/main/java/com/puppycrawl/tools/checkstyle/TreeWalker.java</fileName>
<specifier>methodref.receiver</specifier>
<message>Incompatible receiver type</message>
<lineContent>.thenComparing(AbstractCheck::hashCode));</lineContent>
<lineContent>.thenComparingInt(AbstractCheck::hashCode));</lineContent>
<details>
found : @GuardSatisfied Object
required: @GuardedBy AbstractCheck
Consequence: method in @GuardedBy AbstractCheck
@GuardedBy int hashCode(@GuardSatisfied Object this)
is not a valid method reference for method in @GuardedBy Function&lt;@GuardedBy AbstractCheck, @GuardedBy Integer&gt;
@GuardedBy Integer apply(@GuardedBy Function&lt;@GuardedBy AbstractCheck, @GuardedBy Integer&gt; this, @GuardedBy AbstractCheck p0)
is not a valid method reference for method in @GuardedBy ToIntFunction&lt;@GuardedBy AbstractCheck&gt;
@GuardedBy int applyAsInt(@GuardedBy ToIntFunction&lt;@GuardedBy AbstractCheck&gt; this, @GuardedBy AbstractCheck p0)
</details>
</checkerFrameworkError>

Expand Down
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
-Xep:MockitoMockClassReference:ERROR
-Xep:MockitoStubbing:ERROR
-Xep:NestedOptionals:ERROR
-Xep:PrimitiveComparison:ERROR
-Xep:TimeZoneUsage:ERROR
<!-- Reason at https://github.com/checkstyle/checkstyle/issues/8252. -->
-Xep:JUnitClassModifiers:OFF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ private static SortedSet<AbstractCheck> createNewCheckSortedSet() {
Comparator.<AbstractCheck, String>comparing(check -> check.getClass().getName())
.thenComparing(AbstractCheck::getId,
Comparator.nullsLast(Comparator.naturalOrder()))
.thenComparing(AbstractCheck::hashCode));
.thenComparingInt(AbstractCheck::hashCode));
}

/**
Expand Down

0 comments on commit 5b918db

Please sign in to comment.