JDK-8013900 : More warnings compiling jaxp
  • Type: Bug
  • Component: xml
  • Sub-Component: jaxp
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-05-04
  • Updated: 2013-12-16
  • Resolved: 2013-05-17
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 JDK 8
7u40Fixed 8 b91Fixed
Related Reports
Relates :  
Description
With an up to date jdk8/tl we are seeing more warnings in jaxp:

## Starting jaxp
Compiling 1881 files for BUILD_JAXP
Updating jaxp/dist/lib/src.zip
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xerces/internal/util/URI.java:60: warning: [overrides] Class URI overrides equals, but neither it nor any superclass overrides hashCode method
 public class URI implements Serializable {
        ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xpath/internal/Arg.java:34: warning: [overrides] Class Arg overrides equals, but neither it nor any superclass overrides hashCode method
public class Arg
       ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/bcel/internal/generic/BasicType.java:67: warning: [overrides] Class BasicType overrides equals, but neither it nor any superclass overrides hashCode method
public final class BasicType extends Type {
             ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/bcel/internal/generic/LocalVariableGen.java:74: warning: [overrides] Class LocalVariableGen overrides equals, but neither it nor any superclass overrides hashCode method
public class LocalVariableGen
       ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/bcel/internal/generic/ReturnaddressType.java:69: warning: [overrides] Class ReturnaddressType overrides equals, but neither it nor any superclass overrides hashCode method
public class ReturnaddressType extends Type {
       ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xml/internal/utils/URI.java:62: warning: [overrides] Class URI overrides equals, but neither it nor any superclass overrides hashCode method
public class URI implements Serializable
       ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xml/internal/dtm/ref/DTMNodeProxy.java:64: warning: [overrides] Class DTMNodeProxy overrides equals, but neither it nor any superclass overrides hashCode method
public class DTMNodeProxy
       ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xml/internal/serializer/utils/URI.java:67: warning: [overrides] Class URI overrides equals, but neither it nor any superclass overrides hashCode method
final class URI
      ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java:2617: warning: [overrides] Class Notation overrides equals, but neither it nor any superclass overrides hashCode method
    protected static class Notation {
                     ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xerces/internal/xinclude/XIncludeHandler.java:2662: warning: [overrides] Class UnparsedEntity overrides equals, but neither it nor any superclass overrides hashCode method
    protected static class UnparsedEntity {
                     ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/AbstractDateTimeDV.java:915: warning: [overrides] Class DateTimeData overrides equals, but neither it nor any superclass overrides hashCode method
        static final class DateTimeData implements XSDateTime {
                     ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/PrecisionDecimalDV.java:35: warning: [overrides] Class XPrecisionDecimal overrides equals, but neither it nor any superclass overrides hashCode method
    static class XPrecisionDecimal {
           ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xerces/internal/impl/dv/xs/DecimalDV.java:66: warning: [overrides] Class XDecimal overrides equals, but neither it nor any superclass overrides hashCode method
    static class XDecimal implements XSDecimal {
           ^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRefBase.java:33: warning: [overrides] Class VariableRefBase overrides equals, but neither it nor any superclass overrides hashCode method
class VariableRefBase extends Expression {
^
/u/alanb/ws/tl/jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/FunctionCall.java:151: warning: [overrides] Class JavaType overrides equals, but neither it nor any superclass overrides hashCode method
    static class JavaType {
           ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
15 warnings
Creating jaxp/dist/lib/classes.jar
## Finished jaxp (build time 00:00:23)

Comments
Some internal implementation classes in Jaxp were redefining equals() without redefining hashCode(). This patch adds hashCode() methods that are consistent with equals - that is: if (o1.equals(o2) == true) then o1.hashCode() == o2.hashCode(). It also fixes an issue in LocalVariableGen (uncovered by the changes in hashCode) where equals/hashCode are based on mutable fields - which requires to take special precaution when mutating these fields. http://cr.openjdk.java.net/~dfuchs/JDK-8013900/webrev.01/
16-05-2013