2012/10/14 Mark Thomas <ma...@apache.org>:
> On 14/10/2012 00:05, Konstantin Kolinko wrote:
>> 2012/10/14 Mark Thomas <ma...@apache.org>:
>>> On 13/10/2012 22:43, ma...@apache.org wrote:
>>>> Author: markt
>>>> Date: Sat Oct 13 21:43:36 2012
>>>> New Revision: 1397953
>>>>
>>>> URL: http://svn.apache.org/viewvc?rev=1397953&view=rev
>>>> Log:
>>>> Run the UCDetector and remove unused code
>>>> Some follow-up remains.
>>>
>>> Drat. This clean-up was too aggressive. I need to revert all my changes
>>> from this one forward. Sorry for the noise.
>>>
>>
>> I think/suspect that you need to revert your toString() removal as well
>> URL: http://svn.apache.org/viewvc?rev=1397950&view=rev
>
> I don't think so.
>
>> You have already reverted it once before
>> http://svn.apache.org/viewvc?view=revision&revision=1384063
>
> That was because I incorrectly removed the stringifyValue() methods.
>
>> From buildbot logs:
>> http://ci.apache.org/builders/tomcat-trunk/builds/3465/steps/compile_1/logs/stdio
>> [[[
>>     [junit] Caused by: java.lang.StackOverflowError
>
> That is an issue with the error handling once the toString() methods
> have been removed, not directly an issue with removing the toString methods.
>

http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/bcel/classfile/Constant.java?view=markup

38      private static BCELComparator _cmp = new BCELComparator() {
39      
40      @Override
41      public boolean equals( Object o1, Object o2 ) {
42      Constant THIS = (Constant) o1;
43      Constant THAT = (Constant) o2;
44      return THIS.toString().equals(THAT.toString());
45      }
46      
47      
48      @Override
49      public int hashCode( Object o ) {
50      Constant THIS = (Constant) o;
51      return THIS.toString().hashCode();
52      }
53      };

It would not work anymore, because of changes in toString() (the
default implementation contains hashCode value, which changes.

142     /**
143     * Return value as defined by given BCELComparator strategy.
144     * By default return the hashcode of the result of toString().
145     *
146     * @see java.lang.Object#hashCode()
147     */
148     @Override
149     public int hashCode() {
150     return _cmp.hashCode(this);
151     }

Calls _cmp.hashCode(this) which calls THIS.toString() which now calls
Object.toString(), which calls Object.hashCode(), causing a loop.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to