jaxp/src/com/sun/org/apache/xalan/internal/xsltc/compiler/VariableRefBase.java

Print this page

        

*** 23,32 **** --- 23,33 ---- package com.sun.org.apache.xalan.internal.xsltc.compiler; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.Type; import com.sun.org.apache.xalan.internal.xsltc.compiler.util.TypeCheckError; + import java.util.Objects; /** * @author Morten Jorgensen * @author Santiago Pericas-Geertsen */
*** 95,122 **** /** * Two variable references are deemed equal if they refer to the * same variable. */ public boolean equals(Object obj) { ! try { ! return (_variable == ((VariableRefBase) obj)._variable); ! } ! catch (ClassCastException e) { ! return false; } } /** * Returns a string representation of this variable reference on the * format 'variable-ref(<var-name>)'. * @return Variable reference description */ public String toString() { return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')'; } public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Returned cached type if available if (_type != null) return _type; --- 96,127 ---- /** * Two variable references are deemed equal if they refer to the * same variable. */ + @Override public boolean equals(Object obj) { ! return obj == this || (obj instanceof VariableRefBase) ! && (_variable == ((VariableRefBase) obj)._variable); } + + @Override + public int hashCode() { + return Objects.hashCode(this._variable); } /** * Returns a string representation of this variable reference on the * format 'variable-ref(<var-name>)'. * @return Variable reference description */ + @Override public String toString() { return "variable-ref("+_variable.getName()+'/'+_variable.getType()+')'; } + @Override public Type typeCheck(SymbolTable stable) throws TypeCheckError { // Returned cached type if available if (_type != null) return _type;