solr icon indicating copy to clipboard operation
solr copied to clipboard

SOLR-16427: Evaluate and fix errorprone rules - part 2

Open risdenk opened this issue 3 years ago • 5 comments
trafficstars

https://issues.apache.org/jira/browse/SOLR-16427

Builds on https://github.com/apache/solr/pull/1037

Enables the following errorprone rules:

  • AlmostJavadoc - Fixed a few javadoc issues
  • BadInstanceof - this is most of the changes
  • DoubleBraceInitialization - Most of these moved to List.of, Map.of, or Set.of
  • InvalidInlineTag - Fixed a few javadoc issues
  • InvalidParam - Fixed a few javadoc issues
  • JavaLangClash - Package was used twice in Solr code - renamed to SolrPackage and PackagePayload. Also renamed PackageLoader to SolrPackageLoader. Renamed Error class in SolrCmdDistributor to SolrError to avoid clashing with Java.
  • JdkObsolete - There are some suppressions for this for LinkedList usages. Most went to ArrayList or ArrayDeque
  • ProtectedMembersInFinalClass - fixed the visibility of these methods
  • UnsynchronizedOverridesSynchronized found one issue in StandardDirectoryFactory where removeDirectory missed synchronized

risdenk avatar Sep 22 '22 19:09 risdenk

I've looked at about half the changes... It all seems good... I'm going to try and run the tests before I head to bed on this branch...

epugh avatar Sep 23 '22 00:09 epugh

Your most recent fix JUST fixed the test error I was getting...

./gradlew :solr:core:test --tests "org.apache.solr.handler.component.DistributedFacetPivotLargeTest" passes now for me!

epugh avatar Sep 23 '22 11:09 epugh

THis is failing...

./gradlew :solr:core:test --tests "org.apache.solr.core.TestCoreContainer"

epugh avatar Sep 23 '22 11:09 epugh

./gradlew :solr:core:test --tests "org.apache.solr.core.TestCoreContainer"

@epugh I'm not seeing that test fail. I ran it ~10 times and no failures.

risdenk avatar Sep 23 '22 13:09 risdenk

Thanks for this. It'd help reviewing if you did the work in separate commits. That way I could look at the commits and maybe review some commits of interest to me. For example inlining deprecated methods on SolrException could have been its own commit. This in particular feels different in nature from the other changes that it should be in some other PR, actually.

dsmiley avatar Sep 23 '22 21:09 dsmiley

It'd help reviewing if you did the work in separate commits. That way I could look at the commits and maybe review some commits of interest to me. For example inlining deprecated methods on SolrException could have been its own commit. This in particular feels different in nature from the other changes that it should be in some other PR, actually.

yea will admit got a bit overzealous fixing things in some of these files. I'll see if I can clean it up.

risdenk avatar Oct 11 '22 17:10 risdenk

I'm going to come back to this after https://github.com/apache/solr/pull/953 is merged. I'm expecting some conflicts based on changes I shouldn't have made in this PR that are made in https://github.com/apache/solr/pull/953

risdenk avatar Oct 18 '22 20:10 risdenk

yea I figured it would conflict after https://github.com/apache/solr/pull/953. gives me a chance to separate out the commits as @dsmiley rightly pointed out.

risdenk avatar Oct 20 '22 19:10 risdenk

@dsmiley / @epugh I force pushed this branch to reapply these changes on top of https://github.com/apache/solr/pull/953 and break up each commit into one error-prone rule. Hopefully that makes it easier to review.

risdenk avatar Oct 21 '22 18:10 risdenk

I'm not 100% sure I got all the changes from my previous branch - I'm running all the tests now and will potentially force push again to fix any minor things I missed.

risdenk avatar Oct 21 '22 18:10 risdenk

solr git:(SOLR-16427-part-2) ./gradlew check -Pvalidation.errorprone=true
...
BUILD SUCCESSFUL in 21m 31s
586 actionable tasks: 215 executed, 371 up-to-date

risdenk avatar Oct 21 '22 18:10 risdenk

I didn't make any changes to the underlying code - just updated all the commit messages. I don't plan on squashing these so its easier to revert any individual commits if necessary.

risdenk avatar Oct 24 '22 16:10 risdenk

+1 thanks Kevin

dsmiley avatar Oct 24 '22 18:10 dsmiley

part 3 continues here: https://github.com/apache/solr/pull/1116

risdenk avatar Oct 25 '22 01:10 risdenk