From: Steve L. <st...@us...> - 2006-02-28 15:04:07
|
Update of /cvsroot/smartfrog/core/components/anubis/src/org/smartfrog/services/anubis/locator/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31926/components/anubis/src/org/smartfrog/services/anubis/locator/util Modified Files: TimeQueue.java Log Message: This is a change to get everything to compile on Java1.5. In java1.5, Comparable -> Comparable<T>, so Long.CompareTo() now takes a Long, and if you try and pass in an object you get a compile time error. I could have cast the second arg to a Long, but there is a risk that the code, if compiled on Java1.5, would not link/run on Java1.4, because now TimerQueue is looging for CompareTo(Long) instead of CompareTo(Object). The workaround is to cast to a Comparable and retain the compareTo(Object) method. Index: TimeQueue.java =================================================================== RCS file: /cvsroot/smartfrog/core/components/anubis/src/org/smartfrog/services/anubis/locator/util/TimeQueue.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TimeQueue.java 14 Oct 2005 09:20:21 -0000 1.1 --- TimeQueue.java 28 Feb 2006 15:02:23 -0000 1.2 *************** *** 25,29 **** public class TimeQueue extends SortedSetMap { - private SetMap queue = null; /** --- 25,28 ---- *************** *** 35,42 **** super( new Comparator() { public int compare(Object obj1, Object obj2) { ! return ((Long)obj1).compareTo(obj2); } public boolean equals(Object obj1, Object obj2) { ! return ((Long)obj1).equals(obj2); } } ); --- 34,42 ---- super( new Comparator() { public int compare(Object obj1, Object obj2) { ! Comparable c=(Comparable) obj1; ! return c.compareTo(obj2); } public boolean equals(Object obj1, Object obj2) { ! return obj1.equals(obj2); } } ); |