Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-24417 Build and Run Spark on JDK11
  3. SPARK-25984

Remove deprecated .newInstance(), primitive wrapper class constructor calls

    XMLWordPrintableJSON

Details

    Description

      While working on JDK 11 support, I noticed a lot of new deprecation warnings. 80% of them seem to be from two easily-fixable sources:

      • Class.newInstance() is deprecated
      • Almost all constructors from primitive wrapper classes like Integer are deprecated

      These are easy to fix because there have long been equivalent, better alternatives:

      • Just call .getConstructor().newInstance()
      • Replace new Integer with Integer.valueOf, etc

      The latter has the advantage, for integral types, of not even allocating a new object for small values.

      We should just fix these to clean up the build output.

      Attachments

        Activity

          People

            srowen Sean R. Owen
            srowen Sean R. Owen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: