Tell C++ it can ignore the type parameters on InvocationMarshaller

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6684 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Charlie Groves
2011-07-07 21:49:55 +00:00
parent 3ecd912ddb
commit 0c908be98b
2 changed files with 14 additions and 5 deletions
@@ -29,6 +29,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.threerings.io.Streamable;
import com.threerings.presents.dobj.DSet;
public class CPPType
@@ -89,12 +90,18 @@ public class CPPType
dependent = new CPPType(Streamable.class);
representationImport = "presents/Streamable.h";
} else if (rawType == List.class) {
if (!Streamable.class.isAssignableFrom((Class<?>)typeArguments[0])) {
Class<?> param;
if (typeArguments[0] instanceof ParameterizedType) {
param = (Class<?>)((ParameterizedType)typeArguments[0]).getRawType();
} else {
param = (Class<?>)typeArguments[0];
}
if (!Streamable.class.isAssignableFrom(param)) {
throw new IllegalArgumentException(
"Lists may only contain Streamables in C++, not '" + typeArguments[0]
+ "'");
}
dependent = new CPPType(typeArguments[0]);
dependent = new CPPType(param);
representationImport = null;
} else if (rawType.equals(DSet.class)) {
dependent = null;
@@ -21,16 +21,18 @@
package com.threerings.presents.tools.cpp;
import java.io.File;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.Collections;
import java.util.List;
import java.io.File;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import com.threerings.presents.data.InvocationMarshaller;
import com.threerings.presents.dobj.DSet;
public class CPPUtil
@@ -47,7 +49,7 @@ public class CPPUtil
return "Shared<Streamable>";
} else if (raw.equals(List.class)) {
return "Shared< std::vector< " + getCPPType(typeArguments[0]) + " > >";
} else if (raw.equals(DSet.class)) {
} else if (raw.equals(DSet.class) || raw.equals(InvocationMarshaller.class)) {
ftype = raw;
} else {
throw new IllegalArgumentException("Don't know how to handle " + raw);