DESCRIPTION

Bug 254570 - StructuredSelection should implement hashCode()

Change-Id: I39de2f9155e052a2823e96625d593382f3a553d2
Signed-off-by: Cash Galloway xxx@xxx.xxx

COMMENTS

author: Rayan Moreno
date: 2016-09-21 12:56:12.000000000

Uploaded patch set 1.

-------------------------------------
author: Brenden Conley
date: 2016-09-21 12:56:18.000000000

Patch Set 1:

Build Started https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/10532/

-------------------------------------
author: Jayvion Booth
date: 2016-09-21 13:36:53.000000000

Patch Set 1: Code-Review-1

(3 comments)

See comments in code

Line:185, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeSelection.java -> the implementation of equals() uses paths, so I think hashCode has to use it too.

"Note that it is generally necessary to override the hashCode method whenever equals() method is overridden, so as to maintain the general contract for the hashCode method, which states that equal objects must have equal hash codes."

Line:164, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java -> assignment has no effect

Line:171, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java -> the result is not used

-------------------------------------
author: Rayan Moreno
date: 2016-09-21 14:29:07.000000000

Patch Set 1:

(3 comments)

Line:185, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeSelection.java -> Non hashCode must not be redefined. If two TreeSelections are equals, they will have the same hashCode, fulfilling the contract. Two different TreeElements will also have the same hashCode, but this is not a problem regarding the equals/hashCode contract. 

We must do it this way so if we compare a StructuredSelection and a TreeSelection, and they are equals (they can, see the TreeSelection#equals impl), they both must return the same hashCode.

Line:164, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java -> damnit, I pushed the wrong commit! Thanks for the hawkeye

Line:171, bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java -> damnit, I pushed the wrong commit! Thanks for the hawkeye

-------------------------------------
author: Brenden Conley
date: 2016-09-21 16:10:05.000000000

Patch Set 1: Verified+1

Build Successful 

https://hudson.eclipse.org/platform/job/eclipse.platform.ui-Gerrit/10532/ : SUCCESS

-------------------------------------
author: Gerrit Code Review
date: 2017-01-09 16:03:40.000000000

Change has been successfully merged into the git repository by Ryker Bauer

-------------------------------------
