From 0c908be98b676045285057c47165b7d28d8ec089 Mon Sep 17 00:00:00 2001 From: Charlie Groves Date: Thu, 7 Jul 2011 21:49:55 +0000 Subject: [PATCH] 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 --- .../com/threerings/presents/tools/cpp/CPPType.java | 11 +++++++++-- .../com/threerings/presents/tools/cpp/CPPUtil.java | 8 +++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/threerings/presents/tools/cpp/CPPType.java b/src/main/java/com/threerings/presents/tools/cpp/CPPType.java index 432902053..2b9c4c095 100644 --- a/src/main/java/com/threerings/presents/tools/cpp/CPPType.java +++ b/src/main/java/com/threerings/presents/tools/cpp/CPPType.java @@ -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; diff --git a/src/main/java/com/threerings/presents/tools/cpp/CPPUtil.java b/src/main/java/com/threerings/presents/tools/cpp/CPPUtil.java index 41d876423..1d01e64bc 100644 --- a/src/main/java/com/threerings/presents/tools/cpp/CPPUtil.java +++ b/src/main/java/com/threerings/presents/tools/cpp/CPPUtil.java @@ -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"; } 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);