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

XMLOutputFactory.newFactory(String, ClassLoader) - incorrect specification

    Details

    • Subcomponent:
    • Introduced In Build:
      b119
    • Introduced In Version:
      8
    • Resolved In Build:
      b122
    • Verification:
      Verified

      Backports

        Description

        XMLOutputFactory XMLOutputFactory.newFactory(java.lang.String, java.lang.ClassLoader) method spec contains following:

            * <p>
            * Note that this is a new method that replaces the deprecated
            * {@link #newInstance(java.lang.String, java.lang.ClassLoader)
            * newInstance(String factoryId, ClassLoader classLoader)} method.
            * No changes in behavior are defined by this replacement method relative
            * to the deprecated method.
            * </p>


        In particular it claims "No changes in behavior are defined by this replacement method relative to the deprecated method."
        I believe that this assertion is actually invalid and should be corrected because mentioned deprecated newInstance method returns XMLInputFactory instead of XMLOutputFactory:

           /**
            * Create a new instance of the factory.
            *
            * @param factoryId Name of the factory to find, same as
            * a property name
            * @param classLoader classLoader to use
            * @return the factory implementation
            * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
            *
            * @deprecated This method has been deprecated because it returns an
            * instance of XMLInputFactory, which is of the wrong class.
            * Use the new method {@link #newFactory(java.lang.String,
            * java.lang.ClassLoader)} instead.
            */
            XMLInputFactory XMLOutputFactory.newInstance(String factoryId, ClassLoader classLoader)


        Thus the behavior is different.

        I believe spec should describe the difference between these two methods in a way that the behavior of both deprecated and deprecating ones would be clear and unambiguous.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  joehw Joe Wang
                  Reporter:
                  grakov Georgiy Rakov (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved: