You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by sc...@apache.org on 2017/06/02 14:06:00 UTC
svn commit: r1797392 - in /tomcat/trunk/java: javax/el/Util.java
org/apache/el/util/ReflectionUtil.java
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
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-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1797392 - in /tomcat/trunk/java: javax/el/Util.java
org/apache/el/util/ReflectionUtil.java
Posted by Mark Thomas <ma...@apache.org>.
On 02/06/17 16:34, Mark Thomas wrote:
> On 2 June 2017 15:06:00 BST, schultz@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?
Ping.
Mark
>
> 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-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org
Re: svn commit: r1797392 - in /tomcat/trunk/java: javax/el/Util.java org/apache/el/util/ReflectionUtil.java
Posted by Mark Thomas <ma...@apache.org>.
On 2 June 2017 15:06:00 BST, schultz@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-unsubscribe@tomcat.apache.org
>For additional commands, e-mail: dev-help@tomcat.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org