When generating service-related code, remove imports of classes in the same package
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5050 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -51,7 +51,6 @@ import com.threerings.presents.server.InvocationProvider;
|
|||||||
* and three rings utility types (e.g. float -> Float) to make the existing serivces work. It
|
* and three rings utility types (e.g. float -> Float) to make the existing serivces work. It
|
||||||
* should be possible to create a complete list of these conversions so that future services
|
* should be possible to create a complete list of these conversions so that future services
|
||||||
* can be generated without problems.
|
* can be generated without problems.
|
||||||
* TODO: when generating imports, remove imports of classes in the same pacakge.
|
|
||||||
*/
|
*/
|
||||||
public class GenServiceTask extends InvocationTask
|
public class GenServiceTask extends InvocationTask
|
||||||
{
|
{
|
||||||
@@ -196,6 +195,9 @@ public class GenServiceTask extends InvocationTask
|
|||||||
|
|
||||||
// import the parent class of Foo$Bar
|
// import the parent class of Foo$Bar
|
||||||
imports.swapInnerClassesForParents();
|
imports.swapInnerClassesForParents();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(mpackage + ".*");
|
||||||
|
|
||||||
VelocityContext ctx = new VelocityContext();
|
VelocityContext ctx = new VelocityContext();
|
||||||
ctx.put("name", name);
|
ctx.put("name", name);
|
||||||
@@ -271,6 +273,9 @@ public class GenServiceTask extends InvocationTask
|
|||||||
// get rid of remaining arrays
|
// get rid of remaining arrays
|
||||||
imports.removeArrays();
|
imports.removeArrays();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(mpackage + ".*");
|
||||||
|
|
||||||
ctx.put("imports", imports.toList());
|
ctx.put("imports", imports.toList());
|
||||||
|
|
||||||
// now generate ActionScript versions of our marshaller
|
// now generate ActionScript versions of our marshaller
|
||||||
@@ -305,12 +310,14 @@ public class GenServiceTask extends InvocationTask
|
|||||||
imports.translateInnerClasses();
|
imports.translateInnerClasses();
|
||||||
|
|
||||||
// convert primitive java types to ooo util types
|
// convert primitive java types to ooo util types
|
||||||
// TODO: will future listener marshallers need more primitives?
|
|
||||||
imports.replace("long", "com.threerings.util.Long");
|
imports.replace("long", "com.threerings.util.Long");
|
||||||
|
|
||||||
// get rid of remaining primitives and java.lang types
|
// get rid of remaining primitives and java.lang types
|
||||||
imports.removeGlobals();
|
imports.removeGlobals();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(mpackage + ".*");
|
||||||
|
|
||||||
ctx.put("imports", imports.toList());
|
ctx.put("imports", imports.toList());
|
||||||
ctx.put("listener", listener);
|
ctx.put("listener", listener);
|
||||||
sw = new StringWriter();
|
sw = new StringWriter();
|
||||||
@@ -340,7 +347,6 @@ public class GenServiceTask extends InvocationTask
|
|||||||
imports.add(InvocationService.class);
|
imports.add(InvocationService.class);
|
||||||
|
|
||||||
// allow primitive types in service methods
|
// allow primitive types in service methods
|
||||||
// TODO: are more primitive types needed?
|
|
||||||
imports.replace("[B", "flash.utils.ByteArray");
|
imports.replace("[B", "flash.utils.ByteArray");
|
||||||
imports.replace("[I", "com.threerings.io.TypedArray");
|
imports.replace("[I", "com.threerings.io.TypedArray");
|
||||||
|
|
||||||
@@ -357,6 +363,9 @@ public class GenServiceTask extends InvocationTask
|
|||||||
// change imports of Foo$Bar to Foo_Bar
|
// change imports of Foo$Bar to Foo_Bar
|
||||||
imports.translateInnerClasses();
|
imports.translateInnerClasses();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(sdesc.spackage + ".*");
|
||||||
|
|
||||||
ctx.put("imports", imports.toList());
|
ctx.put("imports", imports.toList());
|
||||||
ctx.put("package", sdesc.spackage);
|
ctx.put("package", sdesc.spackage);
|
||||||
|
|
||||||
@@ -391,12 +400,14 @@ public class GenServiceTask extends InvocationTask
|
|||||||
imports.translateInnerClasses();
|
imports.translateInnerClasses();
|
||||||
|
|
||||||
// convert java primitive types to ooo util types
|
// convert java primitive types to ooo util types
|
||||||
// TODO: will future listeners need more primitives?
|
|
||||||
imports.replace("long", "com.threerings.util.Long");
|
imports.replace("long", "com.threerings.util.Long");
|
||||||
|
|
||||||
// get rid of remaining primitives and java.lang types
|
// get rid of remaining primitives and java.lang types
|
||||||
imports.removeGlobals();
|
imports.removeGlobals();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(sdesc.spackage + ".*");
|
||||||
|
|
||||||
ctx.put("imports", imports.toList());
|
ctx.put("imports", imports.toList());
|
||||||
ctx.put("listener", listener);
|
ctx.put("listener", listener);
|
||||||
|
|
||||||
@@ -455,6 +466,9 @@ public class GenServiceTask extends InvocationTask
|
|||||||
|
|
||||||
// import Foo instead of Foo$Bar
|
// import Foo instead of Foo$Bar
|
||||||
imports.swapInnerClassesForParents();
|
imports.swapInnerClassesForParents();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(dpackage + ".*");
|
||||||
|
|
||||||
VelocityContext ctx = new VelocityContext();
|
VelocityContext ctx = new VelocityContext();
|
||||||
ctx.put("name", name);
|
ctx.put("name", name);
|
||||||
@@ -513,6 +527,9 @@ public class GenServiceTask extends InvocationTask
|
|||||||
// import Foo instead of Foo$Bar
|
// import Foo instead of Foo$Bar
|
||||||
imports.swapInnerClassesForParents();
|
imports.swapInnerClassesForParents();
|
||||||
|
|
||||||
|
// remove imports in our own package
|
||||||
|
imports.removeAll(mpackage + ".*");
|
||||||
|
|
||||||
VelocityContext ctx = new VelocityContext();
|
VelocityContext ctx = new VelocityContext();
|
||||||
ctx.put("name", name);
|
ctx.put("name", name);
|
||||||
ctx.put("package", mpackage);
|
ctx.put("package", mpackage);
|
||||||
|
|||||||
Reference in New Issue
Block a user