Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 326672 - org.eclipse.swt.graphics.TextStyle.hashCode() contains "hash ^= hash;"
Summary: org.eclipse.swt.graphics.TextStyle.hashCode() contains "hash ^= hash;"
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.1   Edit
Hardware: All All
: P3 minor (vote)
Target Milestone: 3.7 M3   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-30 10:17 EDT by Radu Vlasov CLA
Modified: 2011-01-07 11:50 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Radu Vlasov CLA 2010-09-30 10:17:37 EDT
Build Identifier: M20090917-0800

TextStyle.hashCode() contains, among other lines, the following:
   if (underline) hash ^= hash;
   if (strikeout) hash ^= hash;
which would set hash = 0

This may have been done on purpose

Reproducible: Always

Steps to Reproduce:
invoke TextStyle.hashCode() for a StyleRange that has field 'underline' set
Comment 1 Felipe Heidrich CLA 2010-10-13 14:28:51 EDT
That doesn't look good.

Silenio, 
is something like this better:
if (underline) hash ^= (hash << 1);
if (strikeout) hash ^= (hash << 2);
?
Comment 2 Felipe Heidrich CLA 2010-10-13 17:05:17 EDT
Fixed in HEAD > 20101013

Thank you Radu for point this out.