Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-9621

Remove several guava, apache commons calls in favor of java 8 alternatives

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Trivial
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.4
    • Component/s: None
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:
      None

      Description

      Now that Solr is against Java 8, we can take advantage of replacing some guava and apache commons calls with JDK standards. I'd like to start by replacing the following:

      com.google.common.base.Supplier -> java.util.function.Supplier
      com.google.common.base.Predicate -> java.util.function.Predicate
      com.google.common.base.Charsets -> java.nio.charset.StandardCharsets
      org.apache.commons.codec.Charsets -> java.nio.charset.StandardCharsets
      com.google.common.collect.Ordering -> java.util.Comparator
      com.google.common.base.Joiner -> java.util.stream.Collectors::joining
      com.google.common.base.Function -> java.util.function.Function
      com.google.common.base.Preconditions::checkNotNull -> java.util.Objects::requireNonNull
      com.google.common.base.Objects::equals -> java.util.Objects::equals
      com.google.common.base.Objects::hashCode -> java.util.Objects::hashCode

      1. SOLR-9621.patch
        59 kB
        Michael Braun
      2. SOLR-9621.patch
        56 kB
        Michael Braun

        Activity

        Hide
        mbraun688 Michael Braun added a comment -

        Have these ones done, running the full test suite on my box before I post the patch, would love to hear other suggestions / things to add on to this as well.

        Show
        mbraun688 Michael Braun added a comment - Have these ones done, running the full test suite on my box before I post the patch, would love to hear other suggestions / things to add on to this as well.
        Hide
        dweiss Dawid Weiss added a comment -

        Post the patch, please?

        Show
        dweiss Dawid Weiss added a comment - Post the patch, please?
        Hide
        dsmiley David Smiley added a comment -

        +1 to the idea. It'd be great to add these to the forbidden-APIs list too. Uwe Schindler how is that done?

        Show
        dsmiley David Smiley added a comment - +1 to the idea. It'd be great to add these to the forbidden-APIs list too. Uwe Schindler how is that done?
        Hide
        thetaphi Uwe Schindler added a comment - - edited

        you can add a forbidden signature using a glob pattern to the signatures files. e.g. org.package.**

        Show
        thetaphi Uwe Schindler added a comment - - edited you can add a forbidden signature using a glob pattern to the signatures files. e.g. org.package.**
        Hide
        mbraun688 Michael Braun added a comment -

        Patch attached. Ran through tests on master - the following errored but I don't believe they're related to my change:

          [junit4] Tests with failures [seed: B37DBB43144A3628] (first 10 out of 13):
           [junit4]   - org.apache.solr.cloud.CollectionsAPIDistributedZkTest.test
           [junit4]   - org.apache.solr.cloud.CdcrBootstrapTest.testBootstrapWithSourceCluster
           [junit4]   - org.apache.solr.cloud.CdcrBootstrapTest.testBootstrapWithContinousIndexingOnSourceCluster
           [junit4]   - org.apache.solr.cloud.CdcrBootstrapTest.testConvertClusterToCdcrAndBootstrap
           [junit4]   - org.apache.solr.cloud.CdcrBootstrapTest (suite)
           [junit4]   - org.apache.solr.handler.TestConfigReload.test
           [junit4]   - org.apache.solr.update.processor.TestNamedUpdateProcessors.test
           [junit4]   - org.apache.solr.cloud.ReplaceNodeTest.test
           [junit4]   - org.apache.solr.cloud.TestCryptoKeys (suite)
           [junit4]   - org.apache.solr.cloud.TestLeaderElectionWithEmptyReplica.test
        

        Regarding the signature files... where are those?

        Show
        mbraun688 Michael Braun added a comment - Patch attached. Ran through tests on master - the following errored but I don't believe they're related to my change: [junit4] Tests with failures [seed: B37DBB43144A3628] (first 10 out of 13): [junit4] - org.apache.solr.cloud.CollectionsAPIDistributedZkTest.test [junit4] - org.apache.solr.cloud.CdcrBootstrapTest.testBootstrapWithSourceCluster [junit4] - org.apache.solr.cloud.CdcrBootstrapTest.testBootstrapWithContinousIndexingOnSourceCluster [junit4] - org.apache.solr.cloud.CdcrBootstrapTest.testConvertClusterToCdcrAndBootstrap [junit4] - org.apache.solr.cloud.CdcrBootstrapTest (suite) [junit4] - org.apache.solr.handler.TestConfigReload.test [junit4] - org.apache.solr.update.processor.TestNamedUpdateProcessors.test [junit4] - org.apache.solr.cloud.ReplaceNodeTest.test [junit4] - org.apache.solr.cloud.TestCryptoKeys (suite) [junit4] - org.apache.solr.cloud.TestLeaderElectionWithEmptyReplica.test Regarding the signature files... where are those?
        Hide
        mbraun688 Michael Braun added a comment - - edited

        Found the forbidden files. Should I attach just a patch from the previous of adding those lines, or include a new patch with the forbidden signature files affected as well?

        Show
        mbraun688 Michael Braun added a comment - - edited Found the forbidden files. Should I attach just a patch from the previous of adding those lines, or include a new patch with the forbidden signature files affected as well?
        Hide
        dsmiley David Smiley added a comment -

        A single all-inclusive patch is easier; thanks.
        Can you run "ant precommit" too please?

        Show
        dsmiley David Smiley added a comment - A single all-inclusive patch is easier; thanks. Can you run "ant precommit" too please?
        Hide
        mbraun688 Michael Braun added a comment - - edited

        New patch attached against master with modified forbidden signatures for solr. Let me know how it looks. Ran precommit and it passed.

        Show
        mbraun688 Michael Braun added a comment - - edited New patch attached against master with modified forbidden signatures for solr. Let me know how it looks. Ran precommit and it passed.
        Hide
        dsmiley David Smiley added a comment -

        Looks great to me Michael; thanks for doing this! I'll commit later this evening.

        Show
        dsmiley David Smiley added a comment - Looks great to me Michael; thanks for doing this! I'll commit later this evening.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit 2e21511cd37310044e7d167fd80b5277cb942603 in lucene-solr's branch refs/heads/master from David Smiley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2e21511 ]

        SOLR-9621: Remove several Guava & Apache Commons calls in favor of java 8 alternatives.

        Show
        jira-bot ASF subversion and git services added a comment - Commit 2e21511cd37310044e7d167fd80b5277cb942603 in lucene-solr's branch refs/heads/master from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=2e21511 ] SOLR-9621 : Remove several Guava & Apache Commons calls in favor of java 8 alternatives.
        Hide
        jira-bot ASF subversion and git services added a comment -

        Commit a3c701e2f6f0949f5ee2f08eb1d03f962bff6eca in lucene-solr's branch refs/heads/branch_6x from David Smiley
        [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=a3c701e ]

        SOLR-9621: Remove several Guava & Apache Commons calls in favor of java 8 alternatives.

        (cherry picked from commit 2e21511)

        Show
        jira-bot ASF subversion and git services added a comment - Commit a3c701e2f6f0949f5ee2f08eb1d03f962bff6eca in lucene-solr's branch refs/heads/branch_6x from David Smiley [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=a3c701e ] SOLR-9621 : Remove several Guava & Apache Commons calls in favor of java 8 alternatives. (cherry picked from commit 2e21511)

          People

          • Assignee:
            dsmiley David Smiley
            Reporter:
            mbraun688 Michael Braun
          • Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development