Make sure invocation listeners are only added to the list once.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3245 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -62,6 +62,12 @@ public class GenServiceTask extends InvocationTask
|
||||
return getName().compareTo(other.getName());
|
||||
}
|
||||
|
||||
public boolean equals (Object other)
|
||||
{
|
||||
return getClass().equals(other.getClass()) &&
|
||||
listener.equals(((ServiceListener)other).listener);
|
||||
}
|
||||
|
||||
public String getName ()
|
||||
{
|
||||
String name = simpleName(listener);
|
||||
@@ -113,8 +119,8 @@ public class GenServiceTask extends InvocationTask
|
||||
for (int aa = 0; aa < args.length; aa++) {
|
||||
if (_ilistener.isAssignableFrom(args[aa]) &&
|
||||
simpleName(args[aa]).startsWith(sname + ".")) {
|
||||
listeners.add(new ServiceListener(
|
||||
service, args[aa], imports));
|
||||
checkedAdd(listeners, new ServiceListener(
|
||||
service, args[aa], imports));
|
||||
}
|
||||
}
|
||||
methods.add(new ServiceMethod(service, m, imports));
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.Matcher;
|
||||
@@ -353,7 +354,7 @@ public abstract class InvocationTask extends Task
|
||||
FileUtils.writeStringToFile(new File(path), data, "UTF-8");
|
||||
}
|
||||
|
||||
protected static void checkedAdd (SortableArrayList list, String value)
|
||||
protected static void checkedAdd (List list, Object value)
|
||||
{
|
||||
if (!list.contains(value)) {
|
||||
list.add(value);
|
||||
|
||||
Reference in New Issue
Block a user