On 2 June 2017 15:06:00 BST, schu...@apache.org wrote: >Author: schultz >Date: Fri Jun 2 14:06:00 2017 >New Revision: 1797392 > >URL: http://svn.apache.org/viewvc?rev=1797392&view=rev >Log: >Add equals() and hashCode() methods to Util.MatchResult for >completeness. > >Modified: > tomcat/trunk/java/javax/el/Util.java > tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java
This is a spec class you are modifying. Those sort of changes make me nervous. Can you expand on why you think this code is necessary? Does it change behaviour? If yes, what is the spec justification for doing so? If no, why bother? Mark > >Modified: tomcat/trunk/java/javax/el/Util.java >URL: >http://svn.apache.org/viewvc/tomcat/trunk/java/javax/el/Util.java?rev=1797392&r1=1797391&r2=1797392&view=diff >============================================================================== >--- tomcat/trunk/java/javax/el/Util.java (original) >+++ tomcat/trunk/java/javax/el/Util.java Fri Jun 2 14:06:00 2017 >@@ -772,5 +772,29 @@ class Util { > } > return cmp; > } >+ >+ @Override >+ public boolean equals(Object o) >+ { >+ return o == this >+ || (null != o >+ && this.getClass().equals(o.getClass()) >+ && ((MatchResult)o).getExact() == this.getExact() >+ && ((MatchResult)o).getAssignable() == >this.getAssignable() >+ && ((MatchResult)o).getCoercible() == >this.getCoercible() >+ && ((MatchResult)o).isBridge() == this.isBridge() >+ ) >+ ; >+ } >+ >+ @Override >+ public int hashCode() >+ { >+ return (this.isBridge() ? 1 << 24 : 0) >+ ^ this.getExact() << 16 >+ ^ this.getAssignable() << 8 >+ ^ this.getCoercible() >+ ; >+ } > } > } > >Modified: tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java >URL: >http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java?rev=1797392&r1=1797391&r2=1797392&view=diff >============================================================================== >--- tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java (original) >+++ tomcat/trunk/java/org/apache/el/util/ReflectionUtil.java Fri Jun 2 >14:06:00 2017 >@@ -502,6 +502,30 @@ public class ReflectionUtil { > } > return cmp; > } >+ >+ @Override >+ public boolean equals(Object o) >+ { >+ return o == this >+ || (null != o >+ && this.getClass().equals(o.getClass()) >+ && ((MatchResult)o).getExact() == this.getExact() >+ && ((MatchResult)o).getAssignable() == >this.getAssignable() >+ && ((MatchResult)o).getCoercible() == >this.getCoercible() >+ && ((MatchResult)o).isBridge() == this.isBridge() >+ ) >+ ; >+ } >+ >+ @Override >+ public int hashCode() >+ { >+ return (this.isBridge() ? 1 << 24 : 0) >+ ^ this.getExact() << 16 >+ ^ this.getAssignable() << 8 >+ ^ this.getCoercible() >+ ; >+ } > } > > } > > > >--------------------------------------------------------------------- >To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org >For additional commands, e-mail: dev-h...@tomcat.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org