From d57521996c079d75085b64137b783d0c25e2fa70 Mon Sep 17 00:00:00 2001 From: Jamie Doornbos Date: Wed, 6 Jul 2011 22:56:04 +0000 Subject: [PATCH] The import munging rabbit hole goes a little deeper... * We can't just removeGlobals for actionscript services because that will nuke lovingly hacked things like ByteArray, so instead remove primitive stuff that got added as argument types. * Prevent a crash in ImportSet if the first import in our list has no group. This was uncovered by genservice in orth. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6681 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/presents/tools/GenServiceTask.java | 9 +++++++-- .../java/com/threerings/presents/tools/ImportSet.java | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/threerings/presents/tools/GenServiceTask.java b/src/main/java/com/threerings/presents/tools/GenServiceTask.java index 160c24968..344df91b0 100644 --- a/src/main/java/com/threerings/presents/tools/GenServiceTask.java +++ b/src/main/java/com/threerings/presents/tools/GenServiceTask.java @@ -383,8 +383,13 @@ public class GenServiceTask extends InvocationTask // change imports of Foo$Bar to Foo_Bar imports.translateInnerClasses(); - // marshallers just use the built-in actionscript classes in place of byte, short, etc - imports.removeGlobals(); + // Boolean is built in + imports.remove("boolean"); + + // int is used for these + imports.remove("byte"); + imports.remove("short"); + imports.remove("char"); // convert java bases and primitives ActionScriptUtils.convertBaseClasses(imports); diff --git a/src/main/java/com/threerings/presents/tools/ImportSet.java b/src/main/java/com/threerings/presents/tools/ImportSet.java index 04ba2aa7a..80df9fe96 100644 --- a/src/main/java/com/threerings/presents/tools/ImportSet.java +++ b/src/main/java/com/threerings/presents/tools/ImportSet.java @@ -236,6 +236,11 @@ public class ImportSet } } + public void remove (String name) + { + _imports.remove(name); + } + /** * Removes the name of a class from the imports. * @param clazz the class whose name should be removed @@ -348,7 +353,7 @@ public class ImportSet }); List> result = Lists.newArrayList(); List current = null; - int lastGroup = -1; + int lastGroup = -2; for (String imp : list) { int group = findImportGroup(imp, groups); if (group != lastGroup) {