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

Add type parameter to a few java.xml APIs that used raw types

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 10
    • Component/s: xml
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      source
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Hide
      1. Implementation or subclass used raw type
         For implementations or subclasses that have used raw type, they will get a compile time [unchecked] warning after this change.

         The impact is limited to compilation warnings. It is also likely that unchecked warnings have already been addressed since if the underlying implementation used raw type, adding/retrieving elements to/from the relevant collection would have involved casting that would produce [unchecked] warnings.

      2. Implementation or subclass specified type argument
         There is no impact if an implementation or subclass has been implemented with the specific type parameter String, in which case, an unchecked warning would be eliminated.

      3. Implementation or subclass used wildcards
         Implementations or subclasses using wildcards will get a compile-time error after this change. We are aware of a SOAP test, and a case in WLS where a subclass used wildcards. However, it is inappropriate to do so since the APIs as listed in the specification all have a specific type that is String. Such implementations or subclasses should be fixed when they upgrade to JDK 10.
      Show
      1. Implementation or subclass used raw type    For implementations or subclasses that have used raw type, they will get a compile time [unchecked] warning after this change.    The impact is limited to compilation warnings. It is also likely that unchecked warnings have already been addressed since if the underlying implementation used raw type, adding/retrieving elements to/from the relevant collection would have involved casting that would produce [unchecked] warnings. 2. Implementation or subclass specified type argument    There is no impact if an implementation or subclass has been implemented with the specific type parameter String, in which case, an unchecked warning would be eliminated. 3. Implementation or subclass used wildcards    Implementations or subclasses using wildcards will get a compile-time error after this change. We are aware of a SOAP test, and a case in WLS where a subclass used wildcards. However, it is inappropriate to do so since the APIs as listed in the specification all have a specific type that is String. Such implementations or subclasses should be fixed when they upgrade to JDK 10.
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      Summary

      A few java.xml APIs contained raw types. This change adds the type parameter to eliminate raw types.

      Problem

      The following java.xml APIs contain method declarations with raw types:

      javax/xml/namespace/NamespaceContext.java

      Iterator getPrefixes(String namespaceURI);

      javax/xml/xpath/XPathFunction.java

      public Object evaluate(List args)

      org/xml/sax/helpers/NamespaceSupport.java

      public Enumeration getPrefixes ()
      public Enumeration getPrefixes (String uri)
      public Enumeration getDeclaredPrefixes ()

      Solution

      Add the type parameter to eliminate the raw types.

      Specification

      src/java.xml/share/classes/javax/xml/namespace/NamespaceContext.java
      - Iterator getPrefixes(String namespaceURI);
      + Iterator<String> getPrefixes(String namespaceURI);
      
      src/java.xml/share/classes/javax/xml/xpath/XPathFunction.java
      - public Object evaluate(List args)
      + public Object evaluate(List<Object> args)
      
      src/java.xml/share/classes/org/xml/sax/helpers/NamespaceSupport.java
      - public Enumeration getPrefixes ()
      + public Enumeration<String> getPrefixes ()
      
      - public Enumeration getPrefixes (String uri)
      + public Enumeration<String> getPrefixes (String uri)
      
      - public Enumeration getDeclaredPrefixes ()
      + public Enumeration<String> getDeclaredPrefixes ()

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                joehw Joe Wang
                Reporter:
                joehw Joe Wang
                Reviewed By:
                Alan Bateman, Roger Riggs
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: