Making ComparableComparator Serializable. This doesn't stop people putting non-Serializable comparators in a Range, but it does mean the default case can be serialized. LANG-551

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@891627 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Henri Yandell 2009-12-17 11:02:53 +00:00
parent 6e4a19b9e5
commit a926c717c0
2 changed files with 7 additions and 1 deletions

View File

@ -328,7 +328,9 @@ public class Range<T> implements Serializable {
// Taken from Commons Collections - documentation removed as not a public class
private static class ComparableComparator<E extends Comparable<? super E>> implements Comparator<E> {
private static class ComparableComparator<E extends Comparable<? super E>> implements Comparator<E>, Serializable {
private static final long serialVersionUID = 1L;
@SuppressWarnings("unchecked")
public static final ComparableComparator<?> INSTANCE = new ComparableComparator();

View File

@ -269,4 +269,8 @@ public class RangeTest extends TestCase {
}
public void testSerializing() {
SerializationUtils.clone(intRange);
}
}