Skip to content

Commit 3a63f5e

Browse files
deps(java): bump com.google.errorprone:error_prone_core from 2.49.0 to 2.50.0 (#16291)
* deps(java): bump com.google.errorprone:error_prone_core Bumps [com.google.errorprone:error_prone_core](https://github.com/google/error-prone) from 2.49.0 to 2.50.0. - [Release notes](https://github.com/google/error-prone/releases) - [Commits](google/error-prone@v2.49.0...v2.50.0) --- updated-dependencies: - dependency-name: com.google.errorprone:error_prone_core dependency-version: 2.50.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> * Update lock file, add canonical name for JavaLangClash * Add new errorprone checks and fix violations. --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Dawid Weiss <dawid.weiss@carrotsearch.com>
1 parent bb88895 commit 3a63f5e

12 files changed

Lines changed: 28 additions & 20 deletions

File tree

build-tools/build-infra/src/main/java/org/apache/lucene/gradle/plugins/java/ErrorPronePlugin.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@ public void apply(Project project) {
298298
"AutoValueFinalMethods:OFF", // we don't use autovalue
299299
"AutoValueImmutableFields:OFF", // we don't use autovalue
300300
"AutoValueSubclassLeaked:OFF", // we don't use autovalue
301+
"AvoidCommonTypeNames:OFF", // TODO: there are problems
301302
"AvoidObjectArrays:OFF", // TODO: new, not checked if applicable to Lucene
302303
"AvoidValueSetter:ERROR",
303304
"BadAnnotationImplementation:ERROR",
@@ -317,6 +318,7 @@ public void apply(Project project) {
317318
"BooleanParameter:OFF", // TODO: new, not checked if applicable to Lucene
318319
"BoxedPrimitiveConstructor:OFF", // we have forbiddenapis for that
319320
"BoxedPrimitiveEquality:OFF", // TODO: there are problems
321+
"BoxingComparator:ERROR",
320322
"BugPatternNaming:OFF", // we don't use this annotation
321323
"BuilderReturnThis:OFF", // TODO: new, not checked if applicable to Lucene
322324
"BundleDeserializationCast:OFF", // we don't use android
@@ -417,6 +419,7 @@ public void apply(Project project) {
417419
"ExpectedExceptionChecker:OFF", // TODO: new, not checked if applicable to Lucene
418420
"ExpensiveLenientFormatString:OFF", // we use astgrep for this check.
419421
"ExplicitArrayForVarargs:OFF", // TODO: new, not checked if applicable to Lucene
422+
"ExposedPrivateType:OFF", // TODO: there are multiple violations
420423
"ExtendingJUnitAssert:OFF", // noisy
421424
"ExtendsAutoValue:OFF", // TODO: new, not checked if applicable to Lucene
422425
"ExtendsObject:OFF", // TODO: there are problems
@@ -547,14 +550,14 @@ public void apply(Project project) {
547550
"JUnitAmbiguousTestClass:OFF", // we don't use junit3
548551
"JUnitAssertSameCheck:ERROR",
549552
"JUnitIncompatibleType:WARN",
553+
"JUnitMethodInvoked:OFF", // irrelevant
550554
"JUnitParameterMethodNotFound:ERROR",
551555
"Java8ApiChecker:OFF", // TODO: new, not checked if applicable to Lucene
552556
"JavaDurationGetSecondsGetNano:OFF", // we don't use these Duration methods
553557
"JavaDurationGetSecondsToToSeconds:OFF", // we don't use these Duration methods
554558
"JavaDurationWithNanos:OFF", // we don't use these Duration methods
555559
"JavaDurationWithSeconds:OFF", // we don't use these Duration methods
556560
"JavaInstantGetSecondsGetNano:OFF", // we don't use these Instant methods
557-
"JavaLangClash:OFF", // TODO: there are problems
558561
"JavaLocalDateTimeGetNano:OFF", // we don't use LocalDateTime
559562
"JavaLocalTimeGetNano:OFF", // we don't use LocalTime
560563
"JavaPeriodGetDays:OFF", // we don't use Period
@@ -575,6 +578,7 @@ public void apply(Project project) {
575578
"LabelledBreakTarget:OFF", // stylistic
576579
"LambdaFunctionalInterface:OFF", // TODO: new, not checked if applicable to Lucene
577580
"LenientFormatStringValidation:OFF", // we don't use these google libraries
581+
"ListRemoveAmbiguous:OFF", // true potential bug but tiny probability
578582
"LiteByteStringUtf8:OFF", // we don't use protobuf
579583
"LiteEnumValueOf:OFF", // we don't use protobuf
580584
"LiteProtoToString:OFF", // we don't use protobuf
@@ -699,6 +703,7 @@ public void apply(Project project) {
699703
"PreconditionsInvalidPlaceholder:OFF", // we don't use guava
700704
"PreferInstanceofOverGetKind:OFF", // TODO: new, not checked if applicable to Lucene
701705
"PreferJavaTimeOverload:OFF", // TODO: new, not checked if applicable to Lucene
706+
"PreferTestParameter:OFF", // irrelevant
702707
"PreferThrowsTag:OFF", // TODO: perhaps worth considering
703708
"PreferredInterfaceType:OFF", // TODO: new, not checked if applicable to Lucene
704709
"PrimitiveArrayPassedToVarargsMethod:OFF", // TODO: new, not checked if applicable to Lucene
@@ -721,6 +726,8 @@ public void apply(Project project) {
721726
"RandomModInteger:ERROR",
722727
"ReachabilityFenceUsage:WARN",
723728
"RecordAccessorInCompactConstructor:ERROR",
729+
"RecordComponentAccessorAnnotationConflict:OFF", // not applicable in Lucene
730+
"RecordComponentOverride:OFF", // not applicable in Lucene
724731
"RectIntersectReturnValueIgnored:OFF", // we don't use android
725732
"RedundantControlFlow:OFF", // stylistic
726733
"RedundantNullCheck:ERROR",
@@ -799,6 +806,7 @@ public void apply(Project project) {
799806
"ThrowIfUncheckedKnownUnchecked:OFF", // we don't use these google libraries
800807
"ThrowNull:OFF", // noisy (LuceneTestCase)
801808
"ThrowSpecificExceptions:OFF", // TODO: new, not checked if applicable to Lucene
809+
"ThrowableEqualsHashCode:ERROR",
802810
"ThrowsUncheckedException:OFF", // TODO: new, not checked if applicable to Lucene
803811
"TimeInStaticInitializer:ERROR",
804812
"TimeUnitConversionChecker:WARN",
@@ -878,6 +886,7 @@ public void apply(Project project) {
878886
"UsingJsr305CheckReturnValue:OFF", // TODO: new, not checked if applicable to Lucene
879887
"Var:OFF", // TODO: new, not checked if applicable to Lucene
880888
"VarTypeName:ERROR",
889+
"VarWithPrimitive:OFF", // very subjective
881890
"VariableNameSameAsType:WARN",
882891
"Varifier:OFF", // TODO: new, not checked if applicable to Lucene
883892
"VoidMissingNullable:OFF", // TODO: new, not checked if applicable to Lucene

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ commons-compress = "1.28.0"
1111
# See ecj-lint.gradle (used for more linting).
1212
ecj = "3.44.0"
1313
# java linting
14-
errorprone = "2.49.0"
14+
errorprone = "2.50.0"
1515
# markdown documentation generation
1616
flexmark = "0.64.8"
1717
# @keep This is GJF version for java source code formatting

lucene/analysis/common/src/java/org/apache/lucene/analysis/hunspell/WordFormGenerator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ void registerStem(String stem) {
450450
EntrySuggestion compress() {
451451
Comparator<String> stemSorter =
452452
Comparator.comparing((String s) -> existingStems.contains(s))
453-
.thenComparing(s -> stemsToForms.get(s).size())
453+
.thenComparingInt(s -> stemsToForms.get(s).size())
454454
.reversed();
455455
List<String> sortedStems = stemsToForms.keySet().stream().sorted(stemSorter).toList();
456456
PriorityQueue<State> queue = new PriorityQueue<>(solutionFitness);

lucene/analysis/common/src/tools/java/org/apache/lucene/analysis/standard/GenerateJflexTLDMacros.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public static void main(String... args) throws Exception {
119119

120120
private final SortedMap<String, Boolean> processedTLDsLongestFirst =
121121
new TreeMap<>(
122-
Comparator.comparing(String::length).reversed().thenComparing(String::compareTo));
122+
Comparator.comparingInt(String::length).reversed().thenComparing(String::compareTo));
123123

124124
// list position indicates suffix length
125125
private final List<SortedSet<String>> TLDsBySuffixLength = new ArrayList<>();

lucene/core/src/java/org/apache/lucene/search/DisjunctionScoreBlockBoundaryPropagator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ final class DisjunctionScoreBlockBoundaryPropagator {
4040
throw new RuntimeException(e);
4141
}
4242
})
43-
.thenComparing(s -> s.iterator().cost());
43+
.thenComparingLong(s -> s.iterator().cost());
4444

4545
private final Scorer[] scorers;
4646
private final float[] maxScores;

lucene/facet/src/test/org/apache/lucene/facet/TestDrillSideways.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1374,7 +1374,7 @@ public int hashCode() {
13741374
ddq,
13751375
new SimpleCollectorManager(
13761376
numDocs,
1377-
Comparator.comparing(cr -> cr.docAndScore.doc),
1377+
Comparator.comparingInt(cr -> cr.docAndScore.doc),
13781378
ScoreMode.COMPLETE_NO_SCORES));
13791379

13801380
Sort sort = new Sort(new SortField("id", SortField.Type.STRING));

lucene/luke/src/java/org/apache/lucene/luke/app/desktop/util/TableUtils.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ public static <T extends TableColumnInfo> String[] columnNames(T[] columns) {
8383
public static <T extends TableColumnInfo> TreeMap<Integer, T> columnMap(T[] columns) {
8484
return Arrays.stream(columns)
8585
.collect(
86-
Collectors.toMap(T::getIndex, UnaryOperator.identity(), (e1, _) -> e1, TreeMap::new));
86+
Collectors.toMap(
87+
TableColumnInfo::getIndex, UnaryOperator.identity(), (e1, _) -> e1, TreeMap::new));
8788
}
8889

8990
private TableUtils() {}

lucene/queries/src/java/org/apache/lucene/queries/spans/SpanWeight.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ public Query getQuery() {
330330
void collectInnerTerms() throws IOException {
331331
termCollector.reset();
332332
spans.collect(termCollector);
333-
Arrays.sort(innerTerms, 0, innerTermCount, Comparator.comparing(a -> a.position));
333+
Arrays.sort(innerTerms, 0, innerTermCount, Comparator.comparingInt(a -> a.position));
334334
}
335335
};
336336
});

lucene/sandbox/src/java/org/apache/lucene/sandbox/search/LargeNumHitsTopDocsCollector.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
import java.io.IOException;
2323
import java.util.ArrayList;
24-
import java.util.Collections;
2524
import java.util.Comparator;
2625
import java.util.List;
2726
import org.apache.lucene.index.LeafReaderContext;
@@ -146,11 +145,10 @@ protected void populateResults(ScoreDoc[] results, int howMany) {
146145

147146
// Total number of hits collected were less than requestedHitCount
148147
assert totalHits <= requestedHitCount;
149-
Collections.sort(
150-
hits,
151-
Comparator.comparing((ScoreDoc scoreDoc) -> scoreDoc.score)
148+
hits.sort(
149+
Comparator.comparingDouble((ScoreDoc scoreDoc) -> scoreDoc.score)
152150
.reversed()
153-
.thenComparing(scoreDoc -> scoreDoc.doc));
151+
.thenComparingInt(scoreDoc -> scoreDoc.doc));
154152

155153
for (int i = 0; i < howMany; i++) {
156154
results[i] = hits.get(i);

lucene/sandbox/src/java/org/apache/lucene/sandbox/search/SortedNumericDocValuesMultiRangeQuery.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ private static NavigableSet<DocValuesMultiRangeQuery.LongRange> resolveOverlaps(
8989
Collection<DocValuesMultiRangeQuery.LongRange> clauses) {
9090
NavigableSet<DocValuesMultiRangeQuery.LongRange> sortedClauses =
9191
new TreeSet<>(
92-
Comparator.comparing(r -> r.lower)
92+
Comparator.comparingLong(r -> r.lower)
9393
// .thenComparing(r -> r.upper)// have to ignore upper boundary for .floor() lookups
9494
);
9595
List<Edge> clauseEdges = new ArrayList<>(clauses.size() * 2);

0 commit comments

Comments
 (0)