Narya.abc work - refactored GenServiceTask import mechanism in order to generate
clean action script files with no unnecessary imports * New class ImportSet to facilitate the operations being performed manually throughout the code. Also removes the need for rawimports * Threaded ImportSet through all places where imports and rawimports were used and removed magic parameters to control import generation * Added an ImportSet instance to ServiceListener, this was key to the action script fixes * Moved all the import tweaking and munging logic into the generate* methods and made specific to code being generated (removed overreaching stuff from ServiceMethod, this was part of the problem) * Removed blanket imports from tmpl files * Removed unused methods * Fixed tabs from last commit * Quick and dirty script to check for unused imports git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5041 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -27,7 +27,6 @@ import java.io.StringWriter;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -67,12 +66,12 @@ public class GenReceiverTask extends InvocationTask
|
||||
return;
|
||||
}
|
||||
|
||||
HashMap<String,Boolean> imports = new HashMap<String,Boolean>();
|
||||
ImportSet imports = new ImportSet();
|
||||
ComparableArrayList<ServiceMethod> methods =
|
||||
new ComparableArrayList<ServiceMethod>();
|
||||
|
||||
// we need to import the receiver itself
|
||||
imports.put(importify(receiver.getName()), Boolean.TRUE);
|
||||
imports.add(receiver);
|
||||
|
||||
// look through and locate our receiver methods
|
||||
Method[] methdecls = receiver.getDeclaredMethods();
|
||||
@@ -83,14 +82,14 @@ public class GenReceiverTask extends InvocationTask
|
||||
!Modifier.isAbstract(m.getModifiers())) {
|
||||
continue;
|
||||
}
|
||||
methods.add(new ServiceMethod(receiver, m, imports, null, 0, true));
|
||||
methods.add(new ServiceMethod(m, imports));
|
||||
}
|
||||
methods.sort();
|
||||
|
||||
generateSender(source, rname, rpackage, methods,
|
||||
imports.keySet().iterator());
|
||||
imports.toList().iterator());
|
||||
generateDecoder(source, rname, rpackage, methods,
|
||||
imports.keySet().iterator());
|
||||
imports.toList().iterator());
|
||||
}
|
||||
|
||||
protected void generateSender (File source, String rname, String rpackage,
|
||||
|
||||
Reference in New Issue
Block a user