Added instanceof checks to equals().
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2716 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -503,7 +503,7 @@ public class RuntimeAdjust
|
||||
|
||||
@Override public boolean equals (Object other)
|
||||
{
|
||||
return _name.equals(((Adjust)other)._name);
|
||||
return (other instanceof Adjust) && _name.equals(((Adjust)other)._name);
|
||||
}
|
||||
|
||||
@Override public int hashCode ()
|
||||
|
||||
@@ -585,7 +585,7 @@ public class ConfigUtil
|
||||
}
|
||||
|
||||
@Override public boolean equals (Object other) {
|
||||
return _package.equals(((PropRecord)other)._package);
|
||||
return (other instanceof PropRecord) && _package.equals(((PropRecord)other)._package);
|
||||
}
|
||||
|
||||
@Override public String toString () {
|
||||
|
||||
@@ -63,10 +63,10 @@ public class KeyValue<K extends Comparable<? super K>,V>
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked") // documentation inherited
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
return key.equals(((KeyValue<K,V>)other).key);
|
||||
return (other instanceof KeyValue<?,?>) && key.equals(((KeyValue<K,V>)other).key);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -75,7 +75,7 @@ public class KeyValue<K extends Comparable<? super K>,V>
|
||||
return key.hashCode();
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
// from interface Comparable<KeyValue<K,V>>
|
||||
public int compareTo (KeyValue<K,V> other)
|
||||
{
|
||||
return key.compareTo(other.key);
|
||||
|
||||
Reference in New Issue
Block a user