Bug: org.eclipse.equinox.internal.p2.ui.sdk.scheduler.PreviousConfigurationFinder$Identifier
defines equals and uses Object.hashCode()

This class overrides equals(Object), but does notoverride hashCode(),
and inherits the implementation of hashCode() from java.lang.Object
(which returnsthe identity hash code, an arbitrary value assigned to the
objectby the VM).  Therefore, the class is very likely to violate
theinvariant that equal objects must have equal hashcodes.

If you don't think instances of this class will ever be inserted into a
HashMap/HashTable, the recommended hashCode implementation to use is:
public int hashCode() {
    assert false : "hashCode not designed";
    return 42; // any arbitrary constant will do
}


Rank: Troubling (14), confidence: High
Pattern: HE_EQUALS_USE_HASHCODE
Type: HE, Category: BAD_PRACTICE (Bad practice)


Change-Id: Ie4e1a6dc1d71882a48721cf3f79ba16be4c947f4
Signed-off-by: Carsten Hammer <carsten.hammer@t-online.de>
3 files changed