Bug 153503 [Viewers] ComboViewer#setSelection does't select element w/o equals override
I use a ComboViewer to show elements of a class that does not override Object#equals and #hashCode. Therefore I specified an IElementComparer via ComboViewer#setComparer to do the job. My expectation was that the comparer would be used in setSelection to find the element to be selected. Apparently this is not the case. To me this looks like a bug, or is this behaviour desired? The attached test case reproduces this behaviour.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractListViewer.java
protected int indexForElement(Object element) {
        ViewerComparator comparator = getComparator();
        if (comparator == null) {
			return listGetItemCount();
		}
        int count = listGetItemCount();
        int min = 0, max = count - 1;
        while (min <= max) {
            int mid = (min + max) / 2;
            Object data = listMap.get(mid);
            int compare = comparator.compare(this, data, element);
            if (compare == 0) {
                
                while (compare == 0) {
                    ++mid;
                    if (mid >= count) {
                        break;
                    }
                    data = listMap.get(mid);
                    compare = comparator.compare(this, data, element);
                }
                return mid;
            }
            if (compare < 0) {
				min = mid + 1;
			} else {
				max = mid - 1;
			}
        }
        return min;