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

XMLInputFactory.newFactory() is marked as deprecated

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 10
    • xml
    • None
    • minimal
    • No risk. It will remove the warning.
    • Java API
    • SE

      Summary

      Request to remove @Deprecated(since="7") that was mistakenly added to the method newFactory() in javax/xml/javax/XMLInputFactory.java.

      Problem

      In the patch for JDK-8170556, @Deprecated(since="7") was mistakenly added to the method newFactory() in javax/xml/javax/XMLInputFactory.java when the deprecation was only intended for the newInstace method with two arguments.

      JSR 173 MR3 indicated in the javadoc for the new method newFactory() that it replaces the deprecated newInstance() method. However, newInstance() method was never deprecated.

      Solution

      remove @Deprecated(since="7") from the method newFactory() in javax/xml/javax/XMLInputFactory.java.

      remove the note for the method newFactory() in XMLEventFactory, XMLInputFactory and XMLOutputFactory that states it replaces the deprecated newInstance() method.

      Specification

          diff --git a/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java b/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
          --- a/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
          +++ b/src/java.xml/share/classes/javax/xml/stream/XMLEventFactory.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
        * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
        *
        * This code is free software; you can redistribute it and/or modify it
      @@ -125,10 +125,6 @@
          * <p>
          *   Once an application has obtained a reference to a XMLEventFactory it
          *   can use the factory to configure and obtain stream instances.
      -       * <p>
      -       *   Note that this is a new method that replaces the deprecated newInstance() method.
      -       *     No changes in behavior are defined by this replacement method relative to
      -       *     the deprecated method.
          *
          * @throws FactoryConfigurationError in case of {@linkplain
          *   java.util.ServiceConfigurationError service configuration error} or if
      diff --git a/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java b/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
      --- a/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
      +++ b/src/java.xml/share/classes/javax/xml/stream/XMLInputFactory.java
      @@ -209,16 +209,11 @@
          * <p>
          *   Once an application has obtained a reference to a XMLInputFactory it
          *   can use the factory to configure and obtain stream instances.
      -       * <p>
      -       *   Note that this is a new method that replaces the deprecated newInstance() method.
      -       *     No changes in behavior are defined by this replacement method relative to
      -       *     the deprecated method.
          *
          * @throws FactoryConfigurationError in case of {@linkplain
          *   java.util.ServiceConfigurationError service configuration error} or if
          *   the implementation is not available or cannot be instantiated.
      */
      -  @Deprecated(since="1.7")
         public static XMLInputFactory newFactory()
           throws FactoryConfigurationError
         {
      diff --git a/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java b/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
      --- a/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
      +++ b/src/java.xml/share/classes/javax/xml/stream/XMLOutputFactory.java
      @@ -189,10 +189,6 @@
          * <p>
          * Once an application has obtained a reference to a XMLOutputFactory it
          * can use the factory to configure and obtain stream instances.
      -       * <p>
      -       * Note that this is a new method that replaces the deprecated newInstance() method.
      -       *   No changes in behavior are defined by this replacement method relative to the
      -       *   deprecated method.
      *
          * @throws FactoryConfigurationError in case of {@linkplain
          *   java.util.ServiceConfigurationError service configuration error} or if

            joehw Joe Wang
            webbuggrp Webbug Group
            Alan Bateman, Lance Andersen
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: