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 ----------

        Issue Links

          Activity

          Hide
          psonal Pallavi Sonal added a comment - - edited
          The summary table has the newFactory() marked as deprecated . The detailed documentation at http://download.java.net/java/jdk9/docs/api/javax/xml/stream/XMLInputFactory.html#newFactory-- has the annotation @deprecated for the the newFactory() method.
          This needs to be updated.

          Following is the output of running the test case on JDK 9:
          JI9049791.java:5: warning: [deprecation] newFactory() in XMLInputFactory has been deprecated
                          javax.xml.stream.XMLInputFactory.newFactory();
                                                          ^
          1 warning

          Show
          psonal Pallavi Sonal added a comment - - edited The summary table has the newFactory() marked as deprecated . The detailed documentation at http://download.java.net/java/jdk9/docs/api/javax/xml/stream/XMLInputFactory.html#newFactory-- has the annotation @deprecated for the the newFactory() method. This needs to be updated. Following is the output of running the test case on JDK 9: JI9049791.java:5: warning: [deprecation] newFactory() in XMLInputFactory has been deprecated                 javax.xml.stream.XMLInputFactory.newFactory();                                                 ^ 1 warning
          Hide
          michaelm Michael McMahon added a comment -
          Seems to have been introduced in changeset

          http://hg.openjdk.java.net/jdk9/dev/jaxp/rev/3654ce193315

          Bug 8170556. Assigning to Joe to take a look.
          Show
          michaelm Michael McMahon added a comment - Seems to have been introduced in changeset http://hg.openjdk.java.net/jdk9/dev/jaxp/rev/3654ce193315 Bug 8170556. Assigning to Joe to take a look.
          Hide
          joehw Joe Wang added a comment -
          Workaround: use newInstance() method instead.
          Show
          joehw Joe Wang added a comment - Workaround: use newInstance() method instead.
          Hide
          hgupdate HG Updates added a comment -
          URL: http://hg.openjdk.java.net/jdk10/jdk10/jaxp/rev/d109d55cf642
          User: joehw
          Date: 2017-07-17 21:42:27 +0000
          Show
          hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk10/jdk10/jaxp/rev/d109d55cf642 User: joehw Date: 2017-07-17 21:42:27 +0000

            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: