vthacker commented on pull request #1816: URL: https://github.com/apache/lucene-solr/pull/1816#issuecomment-686222263
This is the set of warnings/errors for `solr/core` ``` ~/apache-work/lucene-solr (solr_core_errorprone) $ gradlew -p solr/core/ compileJava > Task :solr:solrj:compileJava Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :lucene:spatial-extras:compileJava Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :lucene:analysis:common:compileJava Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :lucene:suggest:compileJava Note: /Users/vthacker/apache-work/lucene-solr/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellLookup.java uses or overrides a deprecated API. Note: Recompile with -Xlint:deprecation for details. > Task :solr:core:compileJava /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java:93: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them if (obj.get(s) == null || (!(obj.get(s) instanceof Map))) { ^ (see https://errorprone.info/bugpattern/UnnecessaryParentheses) Did you mean 'if (obj.get(s) == null || !(obj.get(s) instanceof Map)) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java:112: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. LinkedList<String> hierarchy = new LinkedList<>(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/ConfigOverlay.java:130: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them if (obj.get(s) == null || (!(obj.get(s) instanceof Map))) { ^ (see https://errorprone.info/bugpattern/UnnecessaryParentheses) Did you mean 'if (obj.get(s) == null || !(obj.get(s) instanceof Map)) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/schema/FieldType.java:1265: warning: [ReferenceEquality] Comparison using reference equality instead of value equality if (analyzer.getVersion() != Version.LATEST) { ^ (see https://errorprone.info/bugpattern/ReferenceEquality) Did you mean 'if (!Objects.equals(analyzer.getVersion(), Version.LATEST)) {' or 'if (!analyzer.getVersion().equals(Version.LATEST)) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/PluginInfo.java:187: warning: [MissingOverride] toMap implements method in MapSerializable; expected @Override public Map<String, Object> toMap(Map<String, Object> map) { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override @SuppressWarnings({"unchecked", "rawtypes"})'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrConfig.java:319: warning: [ReferenceEquality] Comparison using reference equality instead of value equality if (version == Version.LATEST && !versionWarningAlreadyLogged.getAndSet(true)) { ^ (see https://errorprone.info/bugpattern/ReferenceEquality) Did you mean 'if (Objects.equals(version, Version.LATEST) && !versionWarningAlreadyLogged.getAndSet(true)) {' or 'if (version.equals(Version.LATEST) && !versionWarningAlreadyLogged.getAndSet(true)) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/handler/RequestHandlerBase.java:88: warning: [PublicConstructorForAbstractClass] Constructors of on an abstract class can be declared protected as there is never a need for them to be public public RequestHandlerBase() { ^ (see https://errorprone.info/bugpattern/PublicConstructorForAbstractClass) Did you mean 'protected RequestHandlerBase() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/security/PermissionNameProvider.java:60: warning: [ImmutableEnumChecker] enums should be immutable: 'Name' has field 'collName' of type 'java.util.Set<java.lang.String>', 'Set' is mutable final Set<String> collName; ^ (see https://errorprone.info/bugpattern/ImmutableEnumChecker) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java:340: warning: [JdkObsolete] SortedMap was replaced by NavigableMap in Java 6. SortedSet<String> allUnknownAttributes = problems.get(elementName); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java:343: warning: [JdkObsolete] SortedMap was replaced by NavigableMap in Java 6. problems.put(elementName, allUnknownAttributes); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java:345: warning: [JdkObsolete] SortedSet was replaced by NavigableSet in Java 6. allUnknownAttributes.addAll(unknownAttributes); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java:348: warning: [JdkObsolete] SortedMap was replaced by NavigableMap in Java 6. if (problems.size() > 0) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/XmlConfigFile.java:350: warning: [JdkObsolete] SortedMap was replaced by NavigableMap in Java 6. for (Map.Entry<String,SortedSet<String>> entry : problems.entrySet()) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/request/SolrQueryRequest.java:68: warning: [MissingOverride] close implements method in AutoCloseable; expected @Override void close(); ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override void close();'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/response/SolrQueryResponse.java:361: warning: [BadImport] Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer. public Iterator<Entry<String, String>> httpHeaders() { ^ (see https://errorprone.info/bugpattern/BadImport) Did you mean 'public Iterator<Map.Entry<String, String>> httpHeaders() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/DirectoryFactory.java:205: warning: [EmptyCatch] Caught exceptions should not be ignored } catch (FileNotFoundException | NoSuchFileException e) { ^ (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/snapshots/SolrSnapshotMetaDataManager.java:327: warning: [BadImport] Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer. for(Entry<String,SnapshotMetaData> ent : nameToDetailsMapping.entrySet()) { ^ (see https://errorprone.info/bugpattern/BadImport) Did you mean 'for(Map.Entry<String,SnapshotMetaData> ent : nameToDetailsMapping.entrySet()) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java:127: warning: [EmptyCatch] Caught exceptions should not be ignored } catch (java.security.AccessControlException ace) {} ^ (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java:172: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them return (new File(storageDir, storedResourceId)).exists(); ^ (see https://errorprone.info/bugpattern/UnnecessaryParentheses) Did you mean 'return new File(storageDir, storedResourceId).exists();'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/rest/ManagedResourceStorage.java:446: warning: [EmptyCatch] Caught exceptions should not be ignored } catch (Exception ignore){} ^ (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:297: warning: [MixedMutabilityReturnType] This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method. static List<UpdateRequestProcessorFactory> getReqProcessors(String processor, SolrCore core) { ^ (see https://errorprone.info/bugpattern/MixedMutabilityReturnType) Did you mean 'static ImmutableList<UpdateRequestProcessorFactory> getReqProcessors(String processor, SolrCore core) {' or 'static ImmutableList<UpdateRequestProcessorFactory> getReqProcessors(String processor, SolrCore core) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:262: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. LinkedList<UpdateRequestProcessorFactory> urps = new LinkedList<>(defaultUrp.chain); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:268: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. insertBefore(urps, post, RunUpdateProcessorFactory.class, urps.size() - 1); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:271: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. ArrayList<String> names = new ArrayList<>(urps.size()); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:283: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. for (int i = 0; i < urps.size(); i++) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:284: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. if (klas.isInstance(urps.get(i))) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) Did you mean 'if (klas.isInstance(ArrayList)) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:287: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. if (i > 0 && urps.get(i - 1) instanceof LogUpdateProcessorFactory) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/update/processor/UpdateRequestProcessorChain.java:294: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. for (int i = newFactories.size() - 1; 0 <= i; i--) urps.add(idx, newFactories.get(i)); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2878: warning: [MixedMutabilityReturnType] This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method. public <T> List<T> initPlugins(List<PluginInfo> pluginInfos, Class<T> type, String defClassName) { ^ (see https://errorprone.info/bugpattern/MixedMutabilityReturnType) Did you mean 'public <T> ImmutableList<T> initPlugins(List<PluginInfo> pluginInfos, Class<T> type, String defClassName) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2904: warning: [ProtectedMembersInFinalClass] Make members of final classes package-private: initRestManager protected RestManager initRestManager() throws SolrException { ^ (see https://errorprone.info/bugpattern/ProtectedMembersInFinalClass) Did you mean 'RestManager initRestManager() throws SolrException {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:214: warning: [JdkObsolete] Date has a bad API that leads to bugs; prefer java.time.Instant or LocalDate. private final Date startTime = new Date(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:380: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1016: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. searcherExecutor.submit(() -> { ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1157: warning: [BadInstanceof] `newUpdateHandler` is an instance of UpdateHandler which is a subtype of SolrMetricProducer, so this is equivalent to a null check. if (newUpdateHandler instanceof SolrMetricProducer) { ^ (see https://errorprone.info/bugpattern/BadInstanceof) Did you mean 'if (newUpdateHandler != null) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1856: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. private final LinkedList<RefCounted<SolrIndexSearcher>> _searchers = new LinkedList<>(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1857: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. private final LinkedList<RefCounted<SolrIndexSearcher>> _realtimeSearchers = new LinkedList<>(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1874: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1875: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. isEmpty = _searchers.isEmpty(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1876: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. isEmpty = isEmpty && _realtimeSearchers.isEmpty(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1976: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1991: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1992: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. if (!_searchers.isEmpty()) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:1993: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. RefCounted<SolrIndexSearcher> newest = _searchers.getLast(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2007: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2019: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2071: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2162: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2235: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2318: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2442: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2480: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2513: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2564: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (searcherLock) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2613: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them final long qtime = (long) (req.getRequestTimer().getTime()); ^ (see https://errorprone.info/bugpattern/UnnecessaryParentheses) Did you mean 'final long qtime = (long) req.getRequestTimer().getTime();'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:2672: warning: [UnnecessaryParentheses] These grouping parentheses are unnecessary; it is unlikely the code will be misinterpreted without them final int qtime = (int) (req.getRequestTimer().getTime()); ^ (see https://errorprone.info/bugpattern/UnnecessaryParentheses) Did you mean 'final int qtime = (int) req.getRequestTimer().getTime();'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:3130: warning: [BadInstanceof] `solrInfoBean` is an instance of SolrInfoBean which is a subtype of SolrMetricProducer, so this is equivalent to a null check. if (solrInfoBean instanceof SolrMetricProducer) { ^ (see https://errorprone.info/bugpattern/BadInstanceof) Did you mean 'if (solrInfoBean != null) {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/SolrCore.java:3249: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. coreAsyncTaskExecutor.submit(r); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/api/ApiBag.java:173: warning: [MissingOverride] call implements method in Api; expected @Override public void call(SolrQueryRequest req, SolrQueryResponse rsp) { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override @SuppressWarnings({"unchecked", "rawtypes"})'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/api/ApiBag.java:290: warning: [MutableConstantField] Constant field declarations should use the immutable type (such as ImmutableList) instead of the general collection interface type (such as List) public static final Set<String> KNOWN_TYPES = ImmutableSet.of("string", "boolean", "list", "int", "double", "object"); ^ (see https://errorprone.info/bugpattern/MutableConstantField) Did you mean 'public static final ImmutableSet<String> KNOWN_TYPES = ImmutableSet.of("string", "boolean", "list", "int", "double", "object");'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/api/ApiBag.java:354: warning: [OverrideThrowableToString] To return a custom message with a Throwable class, one should override getMessage() instead of toString(). public static class ExceptionWithErrObject extends SolrException { ^ (see https://errorprone.info/bugpattern/OverrideThrowableToString) Did you mean 'public String getMessage() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/api/ApiBag.java:368: warning: [MissingOverride] toString overrides method in SolrException; expected @Override public String toString() { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override public String toString() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/PluginBag.java:362: warning: [MissingOverride] get implements method in Supplier; expected @Override public T get() { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override public T get() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/PluginBag.java:399: warning: [MissingOverride] toString overrides method in Object; expected @Override public String toString() { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override public String toString() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/core/PluginBag.java:408: warning: [TypeParameterShadowing] Found aliased type parameters: T declared in PluginBag public class LazyPluginHolder<T> extends PluginHolder<T> { ^ (see https://errorprone.info/bugpattern/TypeParameterShadowing) Did you mean 'public class LazyPluginHolder<T2> extends PluginHolder<T2> {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:1917: warning: [BadImport] Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer. try (HttpSolrClient client = new Builder(leaderBaseUrl) ^ (see https://errorprone.info/bugpattern/BadImport) Did you mean 'try (HttpSolrClient client = new HttpSolrClient.Builder(leaderBaseUrl)'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:730: warning: [BadImport] Importing nested classes/static methods/static fields with commonly-used names can make code harder to read, because it may not be clear from the context exactly which type is being referred to. Qualifying the name with that of the containing class can make the code clearer. && rep.getType() != Type.PULL ^ (see https://errorprone.info/bugpattern/BadImport) Did you mean '&& rep.getType() != Replica.Type.PULL'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:187: warning: [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals. public boolean equals(Object obj) { ^ (see https://errorprone.info/bugpattern/EqualsGetClass) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:267: warning: [MissingOverride] call implements method in Callable; expected @Override public Object call() throws Exception { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override public Object call() throws Exception {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:412: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. executorService.submit(new RegisterCoreAsync(descriptor, true, true)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:424: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (reconnectListeners) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:431: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. executorService.submit(new OnReconnectNotifyAsync(listener)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:636: warning: [EmptyCatch] Caught exceptions should not be ignored } catch (AlreadyClosedException | SessionExpiredException | KeeperException.ConnectionLossException e) { ^ (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:655: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> collectionToTerms.values().parallelStream().forEach(ZkCollectionTerms::close)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:658: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> replicateFromLeaders.values().parallelStream().forEach(ReplicateFromLeader::stopReplication)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:667: warning: [MissingOverride] close implements method in Closeable; expected @Override public void close() { ^ (see https://errorprone.info/bugpattern/MissingOverride) Did you mean '@Override public void close() {'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:673: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> Collections.singleton(overseerElector.getContext()).parallelStream().forEach(IOUtils::closeQuietly)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:675: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> Collections.singleton(overseer).parallelStream().forEach(IOUtils::closeQuietly)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:678: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> electionContexts.values().parallelStream().forEach(IOUtils::closeQuietly)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:683: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> Collections.singleton(cloudSolrClient).parallelStream().forEach(IOUtils::closeQuietly)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:684: warning: [FutureReturnValueIgnored] Return value of methods returning Future must be checked. Ignoring returned Futures suppresses exceptions thrown from the code that completes the Future. customThreadPool.submit(() -> Collections.singleton(cloudManager).parallelStream().forEach(IOUtils::closeQuietly)); ^ (see https://errorprone.info/bugpattern/FutureReturnValueIgnored) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:726: warning: [ReferenceEquality] Comparison using reference equality instead of value equality if (shard.getReplica(cd.getCloudDescriptor().getCoreNodeName()) != shard.getLeader()) return; ^ (see https://errorprone.info/bugpattern/ReferenceEquality) Did you mean 'if (!Objects.equals(shard.getReplica(cd.getCloudDescriptor().getCoreNodeName()), shard.getLeader())) return;' or 'if (!shard.getReplica(cd.getCloudDescriptor().getCoreNodeName()).equals(shard.getLeader())) return;'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:837: warning: [JdkObsolete] Enumeration is an ancient precursor to Iterator. while (netInterfaces.hasMoreElements()) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:838: warning: [JdkObsolete] Enumeration is an ancient precursor to Iterator. NetworkInterface ni = netInterfaces.nextElement(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:840: warning: [JdkObsolete] Enumeration is an ancient precursor to Iterator. while (ips.hasMoreElements()) { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:841: warning: [JdkObsolete] Enumeration is an ancient precursor to Iterator. InetAddress ip = ips.nextElement(); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:1022: warning: [JdkObsolete] SortedSet was replaced by NavigableSet in Java 6. oldNodes.removeAll(newNodes); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:1023: warning: [JdkObsolete] SortedSet was replaced by NavigableSet in Java 6. if (oldNodes.isEmpty()) { // only added nodes ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:1143: warning: [EmptyCatch] Caught exceptions should not be ignored } catch (NoNodeException e) { ^ (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:2284: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (reconnectListeners) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:2297: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (reconnectListeners) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:2313: warning: [SynchronizeOnNonFinalField] Synchronizing on non-final fields is not safe: if the field is ever updated, different threads may end up locking on different objects. synchronized (reconnectListeners) { ^ (see https://errorprone.info/bugpattern/SynchronizeOnNonFinalField) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkController.java:2596: warning: [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals. public boolean equals(Object o) { ^ (see https://errorprone.info/bugpattern/EqualsGetClass) Did you mean 'if (!(o instanceof UnloadCoreOnDeletedWatcher)) return false;'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java:356: warning: [MixedMutabilityReturnType] This method returns both mutable and immutable collections or maps from different paths. This may be confusing for users of the method. public Map<String, Object> getStats() { ^ (see https://errorprone.info/bugpattern/MixedMutabilityReturnType) Did you mean 'return ImmutableMap.of();' or 'return ImmutableMap.of();'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java:368: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. final List<Map<String, Object>> failed = new ArrayList<>(stat.failureDetails.size()); ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java:370: warning: [JdkObsolete] It is very rare for LinkedList to out-perform ArrayList or ArrayDeque. Avoid it unless you're willing to invest a lot of time into benchmarking. Caveat: LinkedList supports null elements, but ArrayDeque does not. stat.failureDetails.forEach(failedOp -> { ^ (see https://errorprone.info/bugpattern/JdkObsolete) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ZkDistributedQueue.java:371: warning: [ModifiedButNotUsed] A collection or proto builder was created, but its values were never accessed. Map<String, Object> fo = new HashMap<>(); ^ (see https://errorprone.info/bugpattern/ModifiedButNotUsed) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java:125: warning: [EmptyCatch] Caught exceptions should not be ignored } catch (KeeperException.NoNodeException ignored) { ^ (see https://google.github.io/styleguide/javaguide.html#s6.2-caught-exceptions) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java:181: warning: [WaitNotInLoop] Because of spurious wakeups, await(long,java.util.concurrent.TimeUnit) must always be called in a loop eventReceived.await(timeoutMs, TimeUnit.MILLISECONDS); ^ (see https://errorprone.info/bugpattern/WaitNotInLoop) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/OverseerTaskQueue.java:325: warning: [EqualsGetClass] Prefer instanceof to getClass when implementing Object#equals. public boolean equals(Object obj) { ^ (see https://errorprone.info/bugpattern/EqualsGetClass) Did you mean to remove this line? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/cloud/ElectionContext.java:38: warning: [PublicConstructorForAbstractClass] Constructors of on an abstract class can be declared protected as there is never a need for them to be public public ElectionContext(final String coreNodeName, ^ (see https://errorprone.info/bugpattern/PublicConstructorForAbstractClass) Did you mean 'protected ElectionContext(final String coreNodeName,'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/handler/ClassifyStream.java:73: error: [FormatString] extra format arguments: used 1, provided 2 throw new IOException(String.format(Locale.ROOT,"Invalid expression %s - field parameter must be specified",expression, streamExpressions.size())); ^ (see https://errorprone.info/bugpattern/FormatString) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/util/circuitbreaker/CPUCircuitBreaker.java:94: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to `seenCPUUsage.get() == 0.0`. if (seenCPUUsage.get() == 0.0 || seenCPUUsage.get() == 0.0) { ^ (see https://errorprone.info/bugpattern/IdentityBinaryExpression) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java:101: error: [ArrayHashCode] hashcode method on array does not hash array contents 31 * keys.hashCode() + ^ (see https://errorprone.info/bugpattern/ArrayHashCode) Did you mean '31 * Arrays.hashCode(keys) +'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/search/HashQParserPlugin.java:112: error: [ArrayEquals] Reference equality used to compare arrays return keys.equals(other.keys) && ^ (see https://errorprone.info/bugpattern/ArrayEquals) Did you mean 'return Arrays.equals(keys, other.keys) &&'? /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/search/stats/LRUStatsCache.java:129: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to `!missingColStats.isEmpty()`. if (!missingColStats.isEmpty() || !missingColStats.isEmpty()) { ^ (see https://errorprone.info/bugpattern/IdentityBinaryExpression) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java:393: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to `Double.isNaN(a)`. if (a != a) { // a==NaN ^ (see https://errorprone.info/bugpattern/IdentityBinaryExpression) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java:394: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to `Double.isNaN(b)`. if (b != b) { ^ (see https://errorprone.info/bugpattern/IdentityBinaryExpression) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/search/facet/FacetModule.java:400: error: [IdentityBinaryExpression] A binary expression where both operands are the same is usually incorrect; the value of this expression is equivalent to `Double.isNaN(b)`. if (b != b) { // b is NaN so a is greater ^ (see https://errorprone.info/bugpattern/IdentityBinaryExpression) /Users/vthacker/apache-work/lucene-solr/solr/core/src/java/org/apache/solr/schema/RankField.java:73: error: [ThrowNull] Throwing 'null' always results in a NullPointerException being thrown. throw null; ^ (see https://errorprone.info/bugpattern/ThrowNull) Did you mean 'throw new NullPointerException();'? Note: Some input files use or override a deprecated API. Note: Recompile with -Xlint:deprecation for details. 9 errors 100 warnings ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org