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

Update com.google.errorprone:* to 2.31.0 #2862

Merged
merged 8 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion gradle/validation/error-prone.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ allprojects { prj ->
'-Xep:MathRoundIntLong:ERROR',
// '-Xep:MislabeledAndroidString:OFF', // we don't use android
'-Xep:MisplacedScopeAnnotations:ERROR',
// '-Xep:MissingRuntimeRetention:ERROR', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use guice so this can be ignored.

// '-Xep:MissingSuperCall:OFF', // we don't use this annotation
// '-Xep:MissingTestCall:OFF', // we don't use this annotation
'-Xep:MisusedDayOfYear:ERROR',
Expand Down Expand Up @@ -218,12 +219,15 @@ allprojects { prj ->
'-Xep:RandomCast:ERROR',
'-Xep:RandomModInteger:ERROR',
// '-Xep:RectIntersectReturnValueIgnored:OFF', // we don't use android
// '-Xep:RedundantSetterCall:ERROR', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use AutoValue

// '-Xep:RequiredModifiers:OFF', // we don't use this annotation
// '-Xep:RestrictedApiChecker:OFF', // we don't use this annotation
// '-Xep:ReturnValueIgnored:OFF', // todo there are problems that should be fixed
// '-Xep:SelfAssertion:ERROR', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use truth so can be ignored

'-Xep:SelfAssignment:ERROR',
'-Xep:SelfComparison:ERROR',
'-Xep:SelfEquals:ERROR',
// '-Xep:SetUnrecognized:ERROR', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use proto so can be ignored

// '-Xep:ShouldHaveEvenArgs:OFF', // we don't use truth
'-Xep:SizeGreaterThanOrEqualsZero:ERROR',
'-Xep:StreamToString:ERROR',
Expand All @@ -236,7 +240,7 @@ allprojects { prj ->
// '-Xep:ThrowIfUncheckedKnownChecked:OFF', // we don't use this annotation
'-Xep:ThrowNull:ERROR',
'-Xep:TreeToString:ERROR',
// '-Xep:TruthSelfEquals:OFF', // we don't use truth
// '-Xep:SelfAssertion:OFF', // we don't use truth
malliaridis marked this conversation as resolved.
Show resolved Hide resolved
'-Xep:TryFailThrowable:ERROR',
'-Xep:TypeParameterQualifier:ERROR',
'-Xep:UnicodeDirectionalityCharacters:ERROR',
Expand Down Expand Up @@ -265,6 +269,7 @@ allprojects { prj ->
'-Xep:AssertionFailureIgnored:WARN',
'-Xep:AssistedInjectAndInjectOnSameConstructor:WARN',
'-Xep:AttemptedNegativeZero:WARN',
// '-Xep:AutoValueBoxedValues:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably useful

// '-Xep:AutoValueFinalMethods:OFF', // we don't use autovalue
// '-Xep:AutoValueImmutableFields:OFF', // we don't use autovalue
// '-Xep:AutoValueSubclassLeaked:OFF', // we don't use autovalue
Expand All @@ -285,6 +290,7 @@ allprojects { prj ->
'-Xep:ChainedAssertionLosesContext:WARN',
'-Xep:CharacterGetNumericValue:WARN',
'-Xep:ClassCanBeStatic:WARN',
// '-Xep:ClassInitializationDeadlock:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably useful

'-Xep:ClassNewInstance:WARN',
// '-Xep:CloseableProvides:OFF', // we don't use this annotation
'-Xep:ClosingStandardOutputStreams:WARN',
Expand All @@ -296,6 +302,8 @@ allprojects { prj ->
'-Xep:DateChecker:WARN',
'-Xep:DateFormatConstant:WARN',
// '-Xep:DefaultCharset:OFF', // we have forbiddenapis for that
//'-Xep:DeeplyNested:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be useful

//'-Xep:DefaultLocale:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not needed. its handled by forbidden apis

'-Xep:DefaultPackage:WARN',
'-Xep:DeprecatedVariable:WARN',
'-Xep:DirectInvocationOnMock:WARN',
Expand All @@ -309,6 +317,7 @@ allprojects { prj ->
'-Xep:EmptyBlockTag:WARN',
// '-Xep:EmptyCatch:OFF', // todo check if useful or comment why not - might be handled by ECJ?
// '-Xep:EmptySetMultibindingContributions:OFF', // we don't use this annotation
// '-Xep:EnumOrdinal:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be useful

'-Xep:EqualsGetClass:WARN',
'-Xep:EqualsIncompatibleType:WARN',
'-Xep:EqualsUnsafeCast:WARN',
Expand All @@ -330,6 +339,7 @@ allprojects { prj ->
// '-Xep:FragmentNotInstantiable:OFF', // we don't use android
// '-Xep:FutureReturnValueIgnored:OFF', // todo there are problems that should be fixed
'-Xep:GetClassOnEnum:WARN',
// '-Xep:GuiceNestedCombine:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use guice

'-Xep:HidingField:WARN',
'-Xep:ICCProfileGetInstance:WARN',
'-Xep:IdentityHashMapUsage:WARN',
Expand Down Expand Up @@ -383,6 +393,7 @@ allprojects { prj ->
'-Xep:JodaPlusMinusLong:WARN',
'-Xep:JodaTimeConverterManager:WARN',
'-Xep:JodaWithDurationAddedLong:WARN',
// '-Xep:JUnitIncompatibleType:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably useful

// '-Xep:LabelledBreakTarget:OFF', // stylistic
'-Xep:LiteEnumValueOf:WARN',
'-Xep:LiteProtoToString:WARN',
Expand All @@ -403,10 +414,12 @@ allprojects { prj ->
// '-Xep:MissingSummary:OFF', // style preference that we don't want to enforce
// '-Xep:MixedMutabilityReturnType:OFF', // todo check if useful or comment why not
'-Xep:MockNotUsedInProduction:WARN',
// '-Xep:MockitoDoSetup:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This might be useful

'-Xep:ModifiedButNotUsed:WARN',
'-Xep:ModifyCollectionInEnhancedForLoop:WARN',
'-Xep:ModifySourceCollectionInStream:WARN',
'-Xep:MultimapKeys:WARN',
// '-Xep:MultipleNullnessAnnotations:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

We don't use nullness annotations but might be useful

'-Xep:MultipleParallelOrSequentialCalls:WARN',
'-Xep:MultipleUnaryOperatorsInMethodCall:WARN',
// '-Xep:MutableGuiceModule:OFF', // we don't use guice
Expand All @@ -428,7 +441,9 @@ allprojects { prj ->
'-Xep:NullableOptional:WARN',
// '-Xep:NullablePrimitive:OFF', // we don't use this annotation
// '-Xep:NullablePrimitiveArray:OFF', // we don't use this annotation
// '-Xep:NullableTypeParameter:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be useful

// '-Xep:NullableVoid:OFF', // we don't use this annotation
// '-Xep:NullableWildcard:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be useful

'-Xep:ObjectEqualsForPrimitives:WARN',
// '-Xep:ObjectToString:OFF', // todo check if useful or comment why not
'-Xep:ObjectsHashCodePrimitive:WARN',
Expand All @@ -442,6 +457,7 @@ allprojects { prj ->
'-Xep:Overrides:WARN',
// '-Xep:OverridesGuiceInjectableMethod:OFF', // we don't use guice
'-Xep:ParameterName:WARN',
// '-Xep:PatternMatchingInstanceof:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure we need this since its subjective

'-Xep:PreconditionsCheckNotNullRepeated:WARN',
'-Xep:PrimitiveAtomicReference:WARN',
'-Xep:ProtectedMembersInFinalClass:WARN',
Expand All @@ -459,6 +475,7 @@ allprojects { prj ->
// '-Xep:SameNameButDifferent:OFF', // todo check if useful or comment why not
'-Xep:SelfAlwaysReturnsThis:WARN',
// '-Xep:ShortCircuitBoolean:OFF', // todo check if useful or comment why not
// '-Xep:StatementSwitchToExpressionSwitch:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is needed since its subjective

// '-Xep:StaticAssignmentInConstructor:OFF', // we assign SolrTestCaseJ4.configString in many tests, difficult to untangle
'-Xep:StaticAssignmentOfThrowable:WARN',
// '-Xep:StaticGuardedByInstance:OFF', // todo check if useful or comment why not
Expand All @@ -469,9 +486,12 @@ allprojects { prj ->
'-Xep:StringCharset:WARN',
'-Xep:StringFormatWithLiteral:WARN',
// '-Xep:StringSplitter:OFF', // todo check if useful or comment why not - might be able to use forbidden-apis for this?
// '-Xep:SunApi:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably useful

// '-Xep:SuperCallToObjectMethod:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably useful

'-Xep:SuperEqualsIsObjectEquals:WARN',
// '-Xep:SwigMemoryLeak:OFF', // we don't use swig
// '-Xep:SynchronizeOnNonFinalField:OFF', // todo check if useful or comment why not
// '-Xep:SystemConsoleNull:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

This is probably useful

// '-Xep:ThreadJoinLoop:OFF', // todo check if useful or comment why not
// '-Xep:ThreadLocalUsage:OFF', // todo check if useful or comment why not
// '-Xep:ThreadPriorityCheck:OFF', // todo check if useful or comment why not
Expand All @@ -493,6 +513,7 @@ allprojects { prj ->
// '-Xep:UnicodeEscape:OFF', // can't enable since Lucene/Solr tests use unicode a bunch
// '-Xep:UnnecessaryAssignment:OFF', // we don't use these annotations
'-Xep:UnnecessaryAsync:WARN',
// '-Xep:UnnecessaryBreakInSwitch:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure this is useful or just subjective

'-Xep:UnnecessaryLambda:WARN',
'-Xep:UnnecessaryLongToIntConversion:WARN',
'-Xep:UnnecessaryMethodInvocationMatcher:WARN',
Expand All @@ -513,6 +534,7 @@ allprojects { prj ->
// '-Xep:UseBinds:OFF', // we don't use this annotation
// '-Xep:UseCorrectAssertInTests:OFF', // we inherit from LuceneTestCase which extends Assert
'-Xep:VariableNameSameAsType:WARN',
// '-Xep:VoidUsed:WARN', // todo check if useful or comment why not
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be useful

// '-Xep:WaitNotInLoop:OFF', // todo check if useful or comment why not
// '-Xep:WakelockReleasedDangerously:OFF', // we don't use android
// '-Xep:WithSignatureDiscouraged:OFF', // we aren't using this error-prone internal api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ public SolrPackageLoader.SolrPackage.Version findPackageVersion(
return theVersion;
}

// Allow method reference to return a reference to a functional interface (Mapwriter),
// rather than a reference to a PgkVersion object
@SuppressWarnings("UnnecessaryMethodReference")
@Override
public MapWriter getPackageVersion(PluginInfo.ClassName cName) {
if (cName.pkg == null) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ public void init(final NamedList<?> args) {
String algorithmString = params.get(ALGORITHM_PARAM);
Algorithm classificationAlgorithm;
try {
if (algorithmString == null
|| Algorithm.valueOf(algorithmString.toUpperCase(Locale.ROOT)) == null) {
if (algorithmString == null) {
classificationAlgorithm = DEFAULT_ALGORITHM;
} else {
classificationAlgorithm = Algorithm.valueOf(algorithmString.toUpperCase(Locale.ROOT));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,6 @@ public void testIntegration() throws Exception {
(k, v) -> {
double size = fromHumanReadableUnits((String) v);
double sampledSize = fromHumanReadableUnits((String) sampledFieldsBySize.get(k));
assertNotNull(
"sampled size missing for field " + k + " in " + sampledFieldsBySize, sampledSize);
double delta = size * 0.5;
assertEquals("sampled size of " + k + " is wildly off", size, sampledSize, delta);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ public void setUp() throws Exception {
public void testValidReloadCoreAPIResponse() throws Exception {
SolrJerseyResponse response = reloadCoreAPI.reloadCore(coreName, new ReloadCoreRequestBody());
assertEquals(0, response.responseHeader.status);
assertNotNull(response.responseHeader.qTime);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public void setUp() throws Exception {
public void testValidUnloadCoreAPIResponse() throws Exception {
SolrJerseyResponse response = unloadCoreAPI.unloadCore(coreName, getUnloadCoreRequestBodyObj());
assertEquals(0, response.responseHeader.status);
assertNotNull(response.responseHeader.qTime);
}

@Test
Expand Down
1 change: 0 additions & 1 deletion solr/licenses/error_prone_annotations-2.28.0.jar.sha1

This file was deleted.

1 change: 1 addition & 0 deletions solr/licenses/error_prone_annotations-2.31.0.jar.sha1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
c3ba307b915d6d506e98ffbb49e6d2d12edad65b
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public String toString() {
}

/** A 'recipe' for computing a feature */
public abstract class FeatureScorer extends Scorer {
public abstract static class FeatureScorer extends Scorer {

protected final String name;
private DocInfo docInfo;
Expand Down Expand Up @@ -342,7 +342,7 @@ public DocIdSetIterator iterator() {
* A <code>FeatureScorer</code> that contains a <code>Scorer</code>, which it delegates to where
* appropriate.
*/
public abstract class FilterFeatureScorer extends FeatureScorer {
public abstract static class FilterFeatureScorer extends FeatureScorer {

protected final Scorer in;

Expand Down Expand Up @@ -380,7 +380,7 @@ public float getMaxScore(int upTo) throws IOException {
* Default FeatureScorer class that returns the score passed in. Can be used as a simple
* ValueFeature, or to return a default scorer in case an underlying feature's scorer is null.
*/
public class ValueFeatureScorer extends FeatureScorer {
public static class ValueFeatureScorer extends FeatureScorer {
float constScore;

public ValueFeatureScorer(FeatureWeight weight, float constScore, DocIdSetIterator itr) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public FeatureScorer scorer(LeafReaderContext context) throws IOException {
return new OriginalScoreScorer(this, originalScorer);
}

public class OriginalScoreScorer extends FilterFeatureScorer {
public static class OriginalScoreScorer extends FilterFeatureScorer {

public OriginalScoreScorer(FeatureWeight weight, Scorer originalScorer) {
super(weight, originalScorer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public FeatureScorer scorer(LeafReaderContext context) throws IOException {
}

/** Scorer for a SolrFeature */
public class SolrFeatureScorer extends FilterFeatureScorer {
public static class SolrFeatureScorer extends FilterFeatureScorer {

public SolrFeatureScorer(FeatureWeight weight, Scorer solrScorer) {
super(weight, solrScorer);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ public class SolrZkClient implements Closeable {
private Compressor compressor;
private int minStateByteLenForCompression;

// Allow method reference to return a reference to a functional interface (Mapwriter),
// rather than a reference to a ZkMetrics object
@SuppressWarnings("UnnecessaryMethodReference")
public MapWriter getMetrics() {
return metrics::writeMap;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ public void simple() throws IOException {
assertEquals("b", updateUnmarshalled.getParams().get("a"));
}

// Allow method reference to return a reference to a functional interface (Iterable<String>),
// rather than a reference to a List<String> object
@SuppressWarnings("UnnecessaryMethodReference")
@Test
public void testIterable() throws IOException {
final List<String> values = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ private void updateForFire(WatchedEvent event) {
}
}

private class TestZKDatabase extends ZKDatabase {
private static class TestZKDatabase extends ZKDatabase {

private final WatchLimiter limiter;

Expand Down
2 changes: 1 addition & 1 deletion versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ com.google.cloud:google-cloud-core-grpc:2.40.0 (1 constraints: 1a1001a6)
com.google.cloud:google-cloud-core-http:2.40.0 (1 constraints: 1a1001a6)
com.google.cloud:google-cloud-storage:2.40.1 (2 constraints: cf1cc626)
com.google.code.gson:gson:2.11.0 (6 constraints: 0c550bc0)
com.google.errorprone:error_prone_annotations:2.28.0 (15 constraints: a5c51259)
com.google.errorprone:error_prone_annotations:2.31.0 (15 constraints: a5c51259)
com.google.guava:failureaccess:1.0.2 (2 constraints: fb19bf37)
com.google.guava:guava:33.1.0-jre (27 constraints: 698fe64d)
com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava (2 constraints: 4b35b0a0)
Expand Down
2 changes: 1 addition & 1 deletion versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ com.github.ben-manes.caffeine:caffeine=3.1.8
com.github.spotbugs:*=4.8.6
com.github.stephenc.jcip:jcip-annotations=1.0-1
com.google.cloud:google-cloud-bom=0.224.0
com.google.errorprone:*=2.23.0
com.google.errorprone:*=2.31.0
com.google.guava:guava=32.1.3-jre
com.google.re2j:re2j=1.7
com.j256.simplemagic:simplemagic=1.17
Expand Down
Loading