Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8183519

XMLInputFactory.newFactory() is marked as deprecated

    Details

    • Subcomponent:
    • Resolved In Build:
      b16
    • Verification:
      Not verified

      Description

      FULL PRODUCT VERSION :
      java version "9"
      Java(TM) SE Runtime Environment (build 9+175)
      Java HotSpot(TM) 64-Bit Server VM (build 9+175, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      macOS 10.12.5
      but this bug isn't OS-related.

      A DESCRIPTION OF THE PROBLEM :
      XMLInputFactory.newFactory() has a @Deprecated(since="1.7") annotation.

      This is wrong for two reasons:

      - newFactory() is the non-deprecated replacement for the deprecated newInstance() method of the same class.

      - newFactory() wasn't deprecated in either 1.7 or 1.8.

      REGRESSION. Last worked in version 8u152

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile a piece of code containing a call to
      XMLInputFactory.newFactory()

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No deprecation warning is generated.
      ACTUAL -
      The following warning is generated:
      warning: [deprecation] newFactory() in XMLInputFactory has been deprecated

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      warning: [deprecation] newFactory() in XMLInputFactory has been deprecated

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Foo {
          public static void main(String[] args) {
              javax.xml.stream.XMLInputFactory.newFactory();
          }
      }

      /*
      $ javac -Xlint:deprecation Foo.java
      Foo.java:3: warning: [deprecation] newFactory() in XMLInputFactory has been deprecated
              javax.xml.stream.XMLInputFactory.newFactory();
                                              ^
      1 warning
      */

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joehw Joe Wang
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                7 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: