Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-36362

Omnibus Java code static analyzer warning fixes

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.0
    • Fix Version/s: 3.3.0
    • Component/s: Spark Core, SQL, Tests
    • Labels:
      None
    • Target Version/s:

      Description

      Inspired by a recent Java code touch-up, I wanted to fix in one pass several lingering non-trivial issues with the Java code that a static analyzer turns up. Only a few of these have material effects, but some do, and figured we could avoid taking N PRs over time to address these.

      • Some int*int multiplications that widen to long maybe could overflow
      • Unnecessarily non-static inner classes
      • Some tests "catch (AssertionError)" and do nothing
      • Manual array iteration vs very slightly faster/simpler foreach
      • Incorrect generic types that just happen to not cause a runtime error
      • Missed opportunities for try-close
      • Mutable enums which shouldn't be
      • .. and a few other minor things

        Attachments

          Activity

            People

            • Assignee:
              srowen Sean R. Owen
              Reporter:
              srowen Sean R. Owen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: