mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
throw ClassCastException if asked to compare Enums of different types
This commit is contained in:
parent
4536f13ee4
commit
77ae259e41
@ -22,6 +22,10 @@ public abstract class Enum<E extends Enum<E>> implements Comparable<E> {
|
||||
}
|
||||
|
||||
public int compareTo(E other) {
|
||||
if (getDeclaringClass() != other.getDeclaringClass()) {
|
||||
throw new ClassCastException();
|
||||
}
|
||||
|
||||
return ordinal - other.ordinal;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user