Bug 205070 [JFace] ImageDataImageDescriptor's hashCode doesn't correspond to its equals method
3.3 ImageDataImageDescriptor.hashCode() and equals don't correspond when it's created from an original image. Note that a new ImageData object is created each time, so comparing hashCode/equals on the resulting ImageData does not allow supposedly-equivalent image descriptors to compare (or hash) properly. This can result in leaks when the image descriptor is used in a resource manager. Suggested change: public int hashCode() { if (originalImage != null) { return System.identityHashCode(originalImage); } return data.hashCode(); }
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDataImageDescriptor.java
*/
    public ImageData getImageData() {
        return data;
    }
    
    /* (non-Javadoc)
     * @see Object#hashCode
     */
    public int hashCode() {
        return data.hashCode();
    }
    /* (non-Javadoc)
     * @see Object#equals
     */
    public boolean equals(Object obj) {
        if (!(obj instanceof ImageDataImageDescriptor)) {
			return false;
		} 
        
        ImageDataImageDescriptor imgWrap = (ImageDataImageDescriptor) obj;
       
        if (originalImage != null) {
            return imgWrap.originalImage == originalImage;
        }
        
        return (imgWrap.originalImage == null && data.equals(imgWrap.data));
    }
    
}