Fix possible ClassCastException, because DSet.contains(E entry)
will type-erase to DSet.Entry. Ensure objects tested for containment in our Set view implement that. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6128 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -272,6 +272,9 @@ public class DSet<E extends DSet.Entry>
|
|||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
@Override public boolean contains (Object o) {
|
@Override public boolean contains (Object o) {
|
||||||
|
if (!(o instanceof DSet.Entry)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
@SuppressWarnings("unchecked") E elem = (E)o;
|
@SuppressWarnings("unchecked") E elem = (E)o;
|
||||||
return DSet.this.contains(elem);
|
return DSet.this.contains(elem);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user