Code Review Request: 8016576: Overrides warnings in jdi and jconsole
Chris Hegarty
chris.hegarty at oracle.com
Mon Jun 17 12:04:54 PDT 2013
On 06/17/2013 07:19 PM, Kurchi Hazra wrote:
>
>>> Thank you for attacking the hashCode/equals warnings, they've been
>>> screaming to get fixed for a long time.
>>>
>>> It's hard to judge SDE.hashCode but it looks like the straum and line
>>> table index values are used twice (by way of computing the line
>>> number). I agree with the multiplication to spread the bits and maybe
>>> it can be simplified to (lineNumber() * 17) ^ refType.hashCode().
>> I agree, this works just fine.
>>
>>>
>>> XObject.hashCode looks good but I wonder why the equals method is
>>> catching Throwable (it might be a left-over from debugging a long
>>> time ago but it could be masking an issue too).
>>
>> Correct me if I am wrong, if we are doing the instance check on the
>> argument before casting it into an XObject instance, can it every
>> reach the catch block? We can then just get rid of the try-catch block
>> here.
>
> - Maybe a webrev helps:
> http://cr.openjdk.java.net/~khazra/8016576/webrev.01/
> <http://cr.openjdk.java.net/%7Ekhazra/8016576/webrev.01/>
Looks fine, but trivially remove the unnecessary null check in equals
before pushing. If 'o instanceof XObject', then it cannot be null.
Similar for SDE.equals
-Chris.
More information about the serviceability-dev
mailing list