Skip to content

Commit

Permalink
Update dependency com.google.errorprone:error_prone_annotations to v2…
Browse files Browse the repository at this point in the history
….22.0 (#1701)

* Update dependency com.google.errorprone:error_prone_annotations to v2.22.0

Co-authored-by: Kevin Risden <[email protected]>
  • Loading branch information
solrbot and risdenk authored Oct 2, 2023
1 parent 3e7d11f commit 0bdf356
Show file tree
Hide file tree
Showing 35 changed files with 123 additions and 110 deletions.
24 changes: 23 additions & 1 deletion gradle/validation/error-prone.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ allprojects { prj ->
// '-Xep:AutoValueConstructorOrderChecker:OFF', // we don't use autovalue
'-Xep:BadAnnotationImplementation:ERROR',
'-Xep:BadShiftAmount:ERROR',
'-Xep:BanClassLoader:ERROR',
'-Xep:BanJNDI:ERROR', // todo - implement with forbidden APIs instead?
'-Xep:BoxedPrimitiveEquality:ERROR',
// '-Xep:BundleDeserializationCast:OFF', // we don't use android
Expand All @@ -104,6 +105,7 @@ allprojects { prj ->
'-Xep:DangerousLiteralNull:ERROR',
'-Xep:DeadException:ERROR',
'-Xep:DeadThread:ERROR',
'-Xep:DereferenceWithNullBranch:ERROR',
'-Xep:DiscardedPostfixExpression:ERROR',
// '-Xep:DoNotCall:OFF', // we don't use this annotation
'-Xep:DoNotMock:ERROR',
Expand Down Expand Up @@ -262,6 +264,7 @@ allprojects { prj ->
'-Xep:AssertThrowsMultipleStatements:WARN',
'-Xep:AssertionFailureIgnored:WARN',
'-Xep:AssistedInjectAndInjectOnSameConstructor:WARN',
'-Xep:AttemptedNegativeZero:WARN',
// '-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 @@ -284,6 +287,7 @@ allprojects { prj ->
'-Xep:ClassCanBeStatic:WARN',
'-Xep:ClassNewInstance:WARN',
// '-Xep:CloseableProvides:OFF', // we don't use this annotation
'-Xep:ClosingStandardOutputStreams:WARN',
'-Xep:CollectionUndefinedEquality:WARN',
'-Xep:CollectorShouldNotUseState:WARN',
'-Xep:ComparableAndComparator:WARN',
Expand All @@ -299,6 +303,7 @@ allprojects { prj ->
// '-Xep:DoNotCallSuggester:OFF', // we don't use this annotation
// '-Xep:DoNotClaimAnnotations:OFF', // we don't use this annotation
// '-Xep:DoNotMockAutoValue:OFF', // we don't use autovalue
// '-Xep:DoNotUseRuleChain:OFF', // todo could be fixed but not easy
// '-Xep:DoubleCheckedLocking:OFF', // todo check if useful or comment why not
'-Xep:EmptyBlockTag:WARN',
// '-Xep:EmptyCatch:OFF', // todo check if useful or comment why not - might be handled by ECJ?
Expand All @@ -325,6 +330,7 @@ allprojects { prj ->
// '-Xep:FutureReturnValueIgnored:OFF', // todo there are problems that should be fixed
'-Xep:GetClassOnEnum:WARN',
'-Xep:HidingField:WARN',
'-Xep:ICCProfileGetInstance:WARN',
'-Xep:IdentityHashMapUsage:WARN',
// '-Xep:ImmutableAnnotationChecker:OFF', // we don't use this annotation
'-Xep:ImmutableEnumChecker:WARN',
Expand All @@ -343,6 +349,7 @@ allprojects { prj ->
// '-Xep:InlineMeInliner:OFF', // we don't use this annotation
// '-Xep:InlineMeSuggester:OFF', // We don't use this annotation
// '-Xep:InputStreamSlowMultibyteRead:OFF', // todo check if useful or comment why not
'-Xep:InlineTrivialConstant:WARN',
'-Xep:InstanceOfAndCastMatchWrongType:WARN',
'-Xep:IntLongMath:WARN',
// '-Xep:InvalidBlockTag:OFF', // this is needed for tags like lucene.internal
Expand Down Expand Up @@ -379,6 +386,7 @@ allprojects { prj ->
'-Xep:LiteEnumValueOf:WARN',
'-Xep:LiteProtoToString:WARN',
'-Xep:LockNotBeforeTry:WARN',
'-Xep:LockOnNonEnclosingClassLiteral:WARN',
'-Xep:LogicalAssignment:WARN',
'-Xep:LongDoubleConversion:WARN',
'-Xep:LongFloatConversion:WARN',
Expand All @@ -390,25 +398,32 @@ allprojects { prj ->
'-Xep:MissingFail:WARN',
'-Xep:MissingImplementsComparable:WARN',
'-Xep:MissingOverride:WARN',
// '-Xep:MissingRefasterAnnotation:OFF', // don't use Refaster
// '-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:ModifiedButNotUsed:WARN',
'-Xep:ModifyCollectionInEnhancedForLoop:WARN',
'-Xep:ModifySourceCollectionInStream:WARN',
'-Xep:MultimapKeys:WARN',
'-Xep:MultipleParallelOrSequentialCalls:WARN',
'-Xep:MultipleUnaryOperatorsInMethodCall:WARN',
// '-Xep:MutableGuiceModule:OFF', // we don't use guice
'-Xep:MutablePublicArray:WARN',
'-Xep:NamedLikeContextualKeyword:WARN',
'-Xep:NarrowCalculation:WARN',
'-Xep:NarrowingCompoundAssignment:WARN',
// '-Xep:NegativeCharLiteral:OFF', // todo check if useful or comment why not
'-Xep:NestedInstanceOfConditions:WARN',
'-Xep:NewFileSystem:WARN',
//'-Xep:NonApiType:OFF', // todo could be fixed but lots of changes
// '-Xep:NonAtomicVolatileUpdate:OFF', // todo check if useful or comment why not
'-Xep:NonCanonicalType:WARN',
'-Xep:NonOverridingEquals:WARN',
'-Xep:NotJavadoc:WARN',
'-Xep:NullOptional:WARN',
// '-Xep:NullableConstructor:OFF', // we don't use this annotation
'-Xep:NullableOptional:WARN',
// '-Xep:NullablePrimitive:OFF', // we don't use this annotation
// '-Xep:NullablePrimitiveArray:OFF', // we don't use this annotation
// '-Xep:NullableVoid:OFF', // we don't use this annotation
Expand All @@ -420,9 +435,10 @@ allprojects { prj ->
'-Xep:OptionalNotPresent:WARN',
'-Xep:OrphanedFormatString:WARN',
// '-Xep:OutlineNone:OFF', // we don't use gwt
'-Xep:OverridingMethodInconsistentArgumentNamesChecker:WARN',
'-Xep:OverrideThrowableToString:WARN',
'-Xep:Overrides:WARN',
'-Xep:OverridesGuiceInjectableMethod:WARN',
// '-Xep:OverridesGuiceInjectableMethod:OFF', // we don't use guice
'-Xep:ParameterName:WARN',
'-Xep:PreconditionsCheckNotNullRepeated:WARN',
'-Xep:PrimitiveAtomicReference:WARN',
Expand All @@ -434,6 +450,7 @@ allprojects { prj ->
'-Xep:ReachabilityFenceUsage:WARN',
'-Xep:ReferenceEquality:WARN',
'-Xep:RethrowReflectiveOperationExceptionAsLinkageError:WARN',
'-Xep:ReturnAtTheEndOfVoidFunction:WARN',
'-Xep:ReturnFromVoid:WARN',
'-Xep:RobolectricShadowDirectlyOn:WARN',
'-Xep:RxReturnValueIgnored:WARN',
Expand All @@ -446,6 +463,7 @@ allprojects { prj ->
'-Xep:StaticMockMember:WARN',
// '-Xep:StreamResourceLeak:OFF', // todo check if useful or comment why not
'-Xep:StreamToIterable:WARN',
// '-Xep:StringCaseLocaleUsage:OFF', // we have forbiddenapis for that
// '-Xep:StringSplitter:OFF', // todo check if useful or comment why not - might be able to use forbidden-apis for this?
// '-Xep:SwigMemoryLeak:OFF', // we don't use swig
// '-Xep:SynchronizeOnNonFinalField:OFF', // todo check if useful or comment why not
Expand All @@ -457,6 +475,7 @@ allprojects { prj ->
'-Xep:ToStringReturnsNull:WARN',
// '-Xep:TruthAssertExpected:OFF', // we don't use truth
// '-Xep:TruthConstantAsserts:OFF', // we don't use truth
// '-Xep:TruthContainsExactlyElementsInUsage:OFF', // we don't use truth
// '-Xep:TruthGetOrDefault:OFF', // we don't use truth
// '-Xep:TruthIncompatibleType:OFF', // we don't use truth
'-Xep:TypeEquals:WARN',
Expand All @@ -468,11 +487,14 @@ allprojects { prj ->
'-Xep:UnescapedEntity:WARN',
// '-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:UnnecessaryLambda:WARN',
'-Xep:UnnecessaryLongToIntConversion:WARN',
'-Xep:UnnecessaryMethodInvocationMatcher:WARN',
'-Xep:UnnecessaryMethodReference:WARN',
// '-Xep:UnnecessaryParentheses:OFF', // style preference that we don't want to enforce
'-Xep:UnnecessaryStringBuilder:WARN',
// '-Xep:UnnecessaryTestMethodPrefix:OFF', // style preference that we don't want to enforce
// '-Xep:UnqualifiedYield:OFF', // javac takes care
'-Xep:UnrecognisedJavadocTag:WARN',
'-Xep:UnsafeFinalization:WARN',
Expand Down
1 change: 0 additions & 1 deletion solr/core/src/java/org/apache/solr/cli/SimplePostTool.java
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,6 @@ private void doWebMode() {
} catch (MalformedURLException e) {
fatal("Wrong URL trying to append /extract to " + solrUrl);
}
return;
}

private void doStdinMode() {
Expand Down
8 changes: 4 additions & 4 deletions solr/core/src/java/org/apache/solr/core/SolrCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -3052,10 +3052,10 @@ public PluginBag<QueryResponseWriter> getResponseWriters() {
try {
m.put(
"xlsx",
(QueryResponseWriter)
Class.forName("org.apache.solr.handler.extraction.XLSXResponseWriter")
.getConstructor()
.newInstance());
Class.forName("org.apache.solr.handler.extraction.XLSXResponseWriter")
.asSubclass(QueryResponseWriter.class)
.getDeclaredConstructor()
.newInstance());
} catch (Exception e) {
// don't worry; extraction module not in class path
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1804,11 +1804,10 @@ private static Long readIntervalNs(String interval) {

public static final String LEADER_URL = "leaderUrl";

@Deprecated
/**
* @deprecated: Only used for backwards compatibility. Use {@link #LEADER_URL}
* @deprecated Only used for backwards compatibility. Use {@link #LEADER_URL}
*/
public static final String LEGACY_LEADER_URL = "masterUrl";
@Deprecated public static final String LEGACY_LEADER_URL = "masterUrl";

public static final String FETCH_FROM_LEADER = "fetchFromLeader";

Expand All @@ -1817,11 +1816,11 @@ private static Long readIntervalNs(String interval) {
// loss
public static final String SKIP_COMMIT_ON_LEADER_VERSION_ZERO = "skipCommitOnLeaderVersionZero";

@Deprecated
/**
* @deprecated: Only used for backwards compatibility. Use {@link
* @deprecated Only used for backwards compatibility. Use {@link
* #SKIP_COMMIT_ON_LEADER_VERSION_ZERO}
*/
@Deprecated
public static final String LEGACY_SKIP_COMMIT_ON_LEADER_VERSION_ZERO =
"skipCommitOnMasterVersionZero";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.lang.invoke.MethodHandles;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicReference;
import org.apache.solr.cloud.CloudDescriptor;
import org.apache.solr.cloud.ZkController.NotInClusterStateException;
import org.apache.solr.cloud.ZkShardTerms;
Expand Down Expand Up @@ -75,7 +74,6 @@ public void execute(CallInfo it) throws Exception {
collectionName = core.getCoreDescriptor().getCloudDescriptor().getCollectionName();
cloudDescriptor = core.getCoreDescriptor().getCloudDescriptor();
}
AtomicReference<String> errorMessage = new AtomicReference<>();
try {
coreContainer
.getZkController()
Expand Down Expand Up @@ -201,9 +199,8 @@ public void execute(CallInfo it) throws Exception {
return false;
});
} catch (TimeoutException | InterruptedException e) {
String error = errorMessage.get();
if (error == null) error = "Timeout waiting for collection state.";
throw new NotInClusterStateException(ErrorCode.SERVER_ERROR, error);
throw new NotInClusterStateException(
ErrorCode.SERVER_ERROR, "Timeout waiting for collection state.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,5 @@ public void accumulateMissing() throws IOException {
}
}
}
return;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,7 @@ public static String enforcePrefix(String name) {
if (name.startsWith(REGISTRY_NAME_PREFIX)) {
return name;
} else {
return new StringBuilder(REGISTRY_NAME_PREFIX).append(name).toString();
return REGISTRY_NAME_PREFIX + name;
}
}

Expand All @@ -912,8 +912,7 @@ public static String enforcePrefix(String name) {
*/
public static String getRegistryName(SolrInfoBean.Group group, String... names) {
String fullName;
String prefix =
new StringBuilder(REGISTRY_NAME_PREFIX).append(group.name()).append('.').toString();
String prefix = REGISTRY_NAME_PREFIX + group.name() + '.';
// check for existing prefix and group
if (names != null && names.length > 0 && names[0] != null && names[0].startsWith(prefix)) {
// assume the first segment already was expanded
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ public void handleConflict(

// if we aren't handling as a list, and we aren't handling as a map, then just overwrite (i.e.
// nothing else to do)
return;
}

// merges srcMap onto targetMap (i.e. changes targetMap but not srcMap)
Expand Down
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/schema/PointType.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@ public Type getUninversionType(SchemaField sf) {
return null;
}

@Override
/** Care should be taken in calling this with higher order dimensions for performance reasons. */
@Override
protected Query getSpecializedRangeQuery(
QParser parser,
SchemaField field,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3387,9 +3387,7 @@ public boolean collectInNullGroupIfBoosted(int globalDoc) {
public void purgeGroupsThatHaveBoostedDocs(
final FixedBitSet collapsedSet,
final IntProcedure removeGroupKey,
final Runnable resetNullGroupHead) {
return;
}
final Runnable resetNullGroupHead) {}
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public Object getMergedResult() {

List<SimpleOrderedMap<?>> resultBuckets = new ArrayList<>(Math.max(0, (int) (last - first)));

/**
/*
* this only works if there are no filters (like mincount) for (int i=first; i<last; i++) {
* FacetBucket bucket = sortedBuckets.get(i); resultBuckets.add( bucket.getMergedBucket() ); } *
*/
Expand Down Expand Up @@ -166,7 +166,7 @@ Map<String, Object> getRefinementSpecial(
refinement =
getRefinementSpecial(mcontext, refinement, tagsWithPartial, missingBucket, "missing");
}
/**
/*
* allBuckets does not execute sub-facets because we don't change the domain. We may need
* refinement info in the future though for stats. if (freq.allBuckets) { refinement =
* getRefinementSpecial(mcontext, refinement, tagsWithPartial, allBuckets, "allBuckets"); }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ private void collectPerSeg(SortedDocValues singleDv, SweepDISI disi, LongValues
int segMax = singleDv.getValueCount();
final SegCountPerSeg segCounter = getSegCountPerSeg(disi, segMax);

/**
/*
* alternate trial implementations // ord // FieldUtil.visitOrds(singleDv, disi,
* (doc,ord)->{counts[ord+1]++;} );
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void sortBuckets(final FacetRequest.FacetSort sort) {
} else {
final String key = sort.sortVariable;

/**
/*
* final FacetSortableMerger[] arr = new FacetSortableMerger[buckets.size()]; final int[]
* index = new int[arr.length]; int start = 0; int nullStart = index.length; int i=0; for
* (FacetBucket bucket : buckets.values()) { FacetMerger merger =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,34 +42,32 @@ public void init(Map<String, Object> pluginConfig) {
super.init(pluginConfig);
setFormatter(
event ->
new StringBuilder()
.append("type=\"")
.append(event.getEventType().name())
.append("\"")
.append(" message=\"")
.append(event.getMessage())
.append("\"")
.append(" method=\"")
.append(event.getHttpMethod())
.append("\"")
.append(" status=\"")
.append(event.getStatus())
.append("\"")
.append(" requestType=\"")
.append(event.getRequestType())
.append("\"")
.append(" username=\"")
.append(event.getUsername())
.append("\"")
.append(" resource=\"")
.append(event.getResource())
.append("\"")
.append(" queryString=\"")
.append(event.getHttpQueryString())
.append("\"")
.append(" collections=")
.append(event.getCollections())
.toString());
"type=\""
+ event.getEventType().name()
+ "\""
+ " message=\""
+ event.getMessage()
+ "\""
+ " method=\""
+ event.getHttpMethod()
+ "\""
+ " status=\""
+ event.getStatus()
+ "\""
+ " requestType=\""
+ event.getRequestType()
+ "\""
+ " username=\""
+ event.getUsername()
+ "\""
+ " resource=\""
+ event.getResource()
+ "\""
+ " queryString=\""
+ event.getHttpQueryString()
+ "\""
+ " collections="
+ event.getCollections());
if (pluginConfig.size() > 0) {
throw new SolrException(
SolrException.ErrorCode.INVALID_STATE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,6 @@ public static void setCacheControlHeader(
if (null != maxAge) {
resp.setDateHeader("Expires", timeNowForHeader() + (maxAge * 1000L));
}

return;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion solr/core/src/java/org/apache/solr/update/PeerSync.java
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ MissedUpdatesRequest handleVersionsWithRanges(List<Long> otherVersions, boolean
return handleVersionsWithRanges(otherVersions, completeList, ourUpdates, ourLowThreshold);
}

@VisibleForTesting
/** Implementation assumes the passed in lists are sorted and contain no duplicates. */
@VisibleForTesting
static MissedUpdatesRequest handleVersionsWithRanges(
List<Long> otherVersions,
boolean completeList,
Expand Down
Loading

0 comments on commit 0bdf356

Please sign in to comment.