From 19b6edcc98e82e8cd8bdbd283e5adff5d22397c1 Mon Sep 17 00:00:00 2001 From: Jamie Doornbos Date: Mon, 19 Apr 2010 18:58:54 +0000 Subject: [PATCH] Fix service generation for classes that use java.lang.Integer. Some day I will clean this up and fix the big TODO. It probably isn't actually that hard now I know more. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6059 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../com/threerings/presents/tools/GenServiceTask.java | 3 +++ src/java/com/threerings/presents/tools/ImportSet.java | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/java/com/threerings/presents/tools/GenServiceTask.java b/src/java/com/threerings/presents/tools/GenServiceTask.java index fc5496f98..c4b30c74f 100644 --- a/src/java/com/threerings/presents/tools/GenServiceTask.java +++ b/src/java/com/threerings/presents/tools/GenServiceTask.java @@ -322,6 +322,9 @@ public class GenServiceTask extends InvocationTask ".client.", ".data."); imports.popIn(); + // convert java primitive types to ooo util types + imports.replace(Integer.class, "com.threerings.util.Integer"); + // get rid of java.lang stuff and any remaining primitives imports.removeGlobals(); diff --git a/src/java/com/threerings/presents/tools/ImportSet.java b/src/java/com/threerings/presents/tools/ImportSet.java index 5797eefc2..33147e243 100644 --- a/src/java/com/threerings/presents/tools/ImportSet.java +++ b/src/java/com/threerings/presents/tools/ImportSet.java @@ -264,6 +264,16 @@ public class ImportSet _imports.addAll(toAdd); } + /** + * Replace the import matchings a class name. + * @param pattern the class whose name to match + * @param replacement string to use instead + */ + public void replace (Class pattern, String replacement) + { + replace(pattern.getName(), replacement); + } + /** * Remove all imports matching the given pattern. * @param pattern the dumbed down regex to match (see description above)