diff --git a/src/java/com/threerings/presents/tools/GenServiceTask.java b/src/java/com/threerings/presents/tools/GenServiceTask.java index 0fb44b9cd..2034b16d0 100644 --- a/src/java/com/threerings/presents/tools/GenServiceTask.java +++ b/src/java/com/threerings/presents/tools/GenServiceTask.java @@ -143,7 +143,7 @@ public class GenServiceTask extends InvocationTask @Override public boolean equals (Object other) { - return getClass().equals(other.getClass()) && + return (other != null) && getClass().equals(other.getClass()) && listener.equals(((ServiceListener)other).listener); } diff --git a/src/java/com/threerings/presents/tools/InvocationTask.java b/src/java/com/threerings/presents/tools/InvocationTask.java index 0c38c9332..ba6fc1cbc 100644 --- a/src/java/com/threerings/presents/tools/InvocationTask.java +++ b/src/java/com/threerings/presents/tools/InvocationTask.java @@ -263,11 +263,6 @@ public abstract class InvocationTask extends Task }); } - public int compareTo (ServiceMethod other) - { - return getCode().compareTo(other.getCode()); - } - public String getUnwrappedArgList (boolean listenerMode) { StringBuilder buf = new StringBuilder(); @@ -315,6 +310,24 @@ public abstract class InvocationTask extends Task hint.type().name() + ", " + hint.channel() + ")"; } + // from interface Comparator + public int compareTo (ServiceMethod other) + { + return getCode().compareTo(other.getCode()); + } + + @Override // from Object + public boolean equals (Object other) + { + return (other instanceof ServiceMethod) && compareTo((ServiceMethod)other) == 0; + } + + @Override // from Object + public int hashCode () + { + return getCode().hashCode(); + } + protected String boxArgument (Class clazz, int index) { if (_ilistener.isAssignableFrom(clazz)) {