diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Slice/JavaUtil.cpp | 284 | ||||
-rwxr-xr-x | cpp/src/slice2freezej/Main.cpp | 17 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 532 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.h | 11 |
4 files changed, 468 insertions, 376 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp index a1dabf6d6dc..781b020c0c8 100644 --- a/cpp/src/Slice/JavaUtil.cpp +++ b/cpp/src/Slice/JavaUtil.cpp @@ -551,33 +551,20 @@ Slice::JavaGenerator::getStaticId(const TypePtr& type, const string& package) co } bool -Slice::JavaGenerator::useOptionalMapping(const ParamDeclPtr& p) +Slice::JavaGenerator::useOptionalMapping(const OperationPtr& p) { - if(p->optional()) - { - // - // Optional in parameters can be marked with the "java:optional" metadata to force - // the mapping to use the Ice.Optional types. The tag can also be applied to an - // operation or its interface. - // - // Without the tag, in parameters use the normal (non-optional) mapping. - // - if(!p->isOutParam()) - { - static const string tag = "java:optional"; - - OperationPtr op = OperationPtr::dynamicCast(p->container()); - assert(op); - ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); - assert(cl); - - return p->hasMetaData(tag) || op->hasMetaData(tag) || cl->hasMetaData(tag); - } + // + // The "java:optional" metadata can be applied to an operation or its + // interface to force the mapping to use the Ice.Optional types. + // + // Without the tag, parameters use the normal (non-optional) mapping. + // + static const string tag = "java:optional"; - return true; - } + ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); + assert(cl); - return false; + return p->hasMetaData(tag) || cl->hasMetaData(tag); } string @@ -923,7 +910,8 @@ void Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, const string& package, const TypePtr& type, - OptionalMode optional, + OptionalMode mode, + bool optionalMapping, int tag, const string& param, bool marshal, @@ -934,7 +922,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { string stream = marshal ? "__os" : "__is"; string v; - if(holder && optional == OptionalNone) + if(holder) { v = param + ".value"; } @@ -943,6 +931,8 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, v = param; } + const bool optionalParam = mode == OptionalInParam || mode == OptionalOutParam || mode == OptionalReturnParam; + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); if(builtin) { @@ -952,7 +942,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeByte(" << tag << ", " << v << ");"; } @@ -963,7 +953,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readByte(" << tag << ", " << v << ");"; } @@ -978,7 +968,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeBool(" << tag << ", " << v << ");"; } @@ -989,7 +979,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readBool(" << tag << ", " << v << ");"; } @@ -1004,7 +994,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeShort(" << tag << ", " << v << ");"; } @@ -1015,7 +1005,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readShort(" << tag << ", " << v << ");"; } @@ -1030,7 +1020,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeInt(" << tag << ", " << v << ");"; } @@ -1041,7 +1031,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readInt(" << tag << ", " << v << ");"; } @@ -1056,7 +1046,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeLong(" << tag << ", " << v << ");"; } @@ -1067,7 +1057,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readLong(" << tag << ", " << v << ");"; } @@ -1082,7 +1072,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeFloat(" << tag << ", " << v << ");"; } @@ -1093,7 +1083,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readFloat(" << tag << ", " << v << ");"; } @@ -1108,7 +1098,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeDouble(" << tag << ", " << v << ");"; } @@ -1119,7 +1109,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readDouble(" << tag << ", " << v << ");"; } @@ -1134,7 +1124,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeString(" << tag << ", " << v << ");"; } @@ -1145,7 +1135,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readString(" << tag << ", " << v << ");"; } @@ -1160,7 +1150,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeObject(" << tag << ", " << v << ");"; } @@ -1171,11 +1161,11 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readObject(" << tag << ", " << param << ");"; } - else if(holder && optional == OptionalNone) + else if(holder && mode == OptionalNone) { out << nl << stream << ".readObject(" << param << ");"; } @@ -1197,11 +1187,11 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeProxy(" << tag << ", " << v << ");"; } - else if(optional == OptionalMember) + else if(mode == OptionalMember) { out << nl << stream << ".startSize();"; out << nl << stream << ".writeProxy(" << v << ");"; @@ -1214,11 +1204,11 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".readProxy(" << tag << ", " << v << ");"; } - else if(optional == OptionalMember) + else if(mode == OptionalMember) { out << nl << stream << ".skip(4);"; out << nl << v << " = " << stream << ".readProxy();"; @@ -1245,29 +1235,29 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, string typeS = typeToString(type, TypeModeIn, package); if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { - if(optional == OptionalInParamReq) + if(optionalMapping) { - out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" << tag + << ", " << getOptionalType(type) << "))"; out << sb; out << nl << stream << ".startSize();"; - out << nl << typeS << "Helper.__write(" << stream << ", " << v << ");"; + out << nl << typeS << "Helper.__write(" << stream << ", " << v << ".get());"; out << nl << stream << ".endSize();"; out << eb; } else { - out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" << tag - << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; out << sb; out << nl << stream << ".startSize();"; - out << nl << typeS << "Helper.__write(" << stream << ", " << v << ".get());"; + out << nl << typeS << "Helper.__write(" << stream << ", " << v << ");"; out << nl << stream << ".endSize();"; out << eb; } } - else if(optional == OptionalMember) + else if(mode == OptionalMember) { out << nl << stream << ".startSize();"; out << nl << typeS << "Helper.__write(" << stream << ", " << v << ");"; @@ -1280,14 +1270,14 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalType(type) << "))"; out << sb; out << nl << stream << ".skip(4);"; out << nl << v << ".set(" << typeS << "Helper.__read(" << stream << "));"; out << eb; - if(optional == OptionalOutParam) + if(mode == OptionalOutParam) { out << nl << "else"; out << sb; @@ -1295,7 +1285,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, out << eb; } } - else if(optional == OptionalMember) + else if(mode == OptionalMember) { out << nl << stream << ".skip(4);"; out << nl << v << " = " << typeS << "Helper.__read(" << stream << ");"; @@ -1313,7 +1303,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << stream << ".writeObject(" << tag << ", " << v << ");"; } @@ -1324,7 +1314,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(isOptionalParam(optional)) + if(optionalParam) { string typeS = typeToString(type, TypeModeIn, package); out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalType(type) << "))"; @@ -1332,7 +1322,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, out << nl << stream << ".readObject(new Ice.OptionalObject(" << v << ", " << typeS << ".class, " << getStaticId(type, package) << "));"; out << eb; - if(optional == OptionalOutParam) + if(mode == OptionalOutParam) { out << nl << "else"; out << sb; @@ -1342,7 +1332,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, } else { - if(holder && optional == OptionalNone) + if(holder && mode == OptionalNone) { out << nl << stream << ".readObject(" << param << ");"; } @@ -1367,23 +1357,23 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(optional != OptionalNone) + if(optionalParam || mode == OptionalMember) { string val; - if(isOptionalParam(optional)) + if(optionalParam) { - if(optional == OptionalInParamReq) - { - out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; - val = v; - } - else + if(optionalMapping) { out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; val = v + ".get()"; } + else + { + out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; + val = v; + } out << sb; } @@ -1404,7 +1394,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, out << nl << val << ".__write(" << stream << ");"; } - if(isOptionalParam(optional)) + if(optionalParam) { out << eb; } @@ -1418,7 +1408,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { string typeS = typeToString(type, TypeModeIn, package, metaData); - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalType(type) << "))"; out << sb; @@ -1438,7 +1428,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, out << eb; - if(optional == OptionalOutParam) + if(mode == OptionalOutParam) { out << nl << "else"; out << sb; @@ -1446,7 +1436,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, out << eb; } } - else if(optional == OptionalMember) + else if(mode == OptionalMember) { if(st->isVariableLength()) { @@ -1473,21 +1463,21 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { - if(optional == OptionalInParamReq) + if(optionalMapping) { - out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" << tag + << ", " << getOptionalType(type) << "))"; out << sb; - out << nl << v << ".__write(" << stream << ");"; + out << nl << v << ".get().__write(" << stream << ");"; out << eb; } else { - out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" << tag - << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; out << sb; - out << nl << v << ".get().__write(" << stream << ");"; + out << nl << v << ".__write(" << stream << ");"; out << eb; } } @@ -1500,13 +1490,13 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { string typeS = typeToString(type, TypeModeIn, package, metaData); - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalType(type) << "))"; out << sb; out << nl << v << ".set(" << typeS << ".__read(" << stream << "));"; out << eb; - if(optional == OptionalOutParam) + if(mode == OptionalOutParam) { out << nl << "else"; out << sb; @@ -1525,7 +1515,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, DictionaryPtr dict = DictionaryPtr::dynamicCast(type); if(dict) { - if(optional != OptionalNone) + if(optionalParam || mode == OptionalMember) { string typeS = typeToString(type, TypeModeIn, package, metaData); TypePtr keyType = dict->keyType(); @@ -1533,24 +1523,24 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { - if(optional == OptionalInParamReq) + if(optionalMapping) { - out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" + << tag << ", " << getOptionalType(type) << "))"; out << sb; } else { - out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" - << tag << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; out << sb; } } if(keyType->isVariableLength() || valueType->isVariableLength()) { - string d = isOptionalParam(optional) && optional != OptionalInParamReq ? v + ".get()" : v; + string d = optionalParam && optionalMapping ? v + ".get()" : v; out << nl << stream << ".startSize();"; writeDictionaryMarshalUnmarshalCode(out, package, dict, d, marshal, iter, true, metaData); out << nl << stream << ".endSize();"; @@ -1559,7 +1549,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { const int wireSize = keyType->minWireSize() + valueType->minWireSize(); string tmpName; - if(isOptionalParam(optional) && optional != OptionalInParamReq) + if(optionalParam && optionalMapping) { tmpName = "__optDict"; out << nl << "final " << typeS << ' ' << tmpName << " = " << v << ".get();"; @@ -1568,14 +1558,13 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { tmpName = v; } - out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName - << ".size();"; + out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();"; out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize << " + 5 : __optSize * " << wireSize << " + 1);"; writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData); } - if(isOptionalParam(optional)) + if(optionalParam) { out << eb; } @@ -1584,7 +1573,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, { string tmpName; - if(isOptionalParam(optional)) + if(optionalParam) { tmpName = "__optDict"; out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalType(type) << "))"; @@ -1607,11 +1596,11 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData); - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << v << ".set(" << tmpName << ");"; out << eb; - if(optional == OptionalOutParam) + if(mode == OptionalOutParam) { out << nl << "else"; out << sb; @@ -1631,13 +1620,13 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, SequencePtr seq = SequencePtr::dynamicCast(type); if(seq) { - if(optional != OptionalNone) + if(optionalParam || mode == OptionalMember) { string typeS = typeToString(type, TypeModeIn, package, metaData); TypePtr elemType = seq->type(); BuiltinPtr elemBuiltin = BuiltinPtr::dynamicCast(elemType); - if(isOptionalParam(optional) && elemBuiltin && elemBuiltin->kind() != Builtin::KindObject && + if(optionalParam && elemBuiltin && elemBuiltin->kind() != Builtin::KindObject && elemBuiltin->kind() != Builtin::KindObjectProxy && !hasTypeMetaData(seq, metaData)) { static const char* builtinTable[] = @@ -1692,16 +1681,16 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, if(marshal) { - if(isOptionalParam(optional)) + if(optionalParam) { - if(optional == OptionalInParamReq) + if(optionalMapping) { - out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" + << tag << ", " << getOptionalType(type) << "))"; } else { - out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOpt(" - << tag << ", " << getOptionalType(type) << "))"; + out << nl << "if(" << stream << ".writeOpt(" << tag << ", " << getOptionalType(type) << "))"; } out << sb; @@ -1709,7 +1698,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, if(elemType->isVariableLength()) { - string s = isOptionalParam(optional) && optional != OptionalInParamReq ? v + ".get()" : v; + string s = optionalParam && optionalMapping ? v + ".get()" : v; out << nl << stream << ".startSize();"; writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData); out << nl << stream << ".endSize();"; @@ -1723,7 +1712,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, // string tmpName; - if(isOptionalParam(optional) && optional != OptionalInParamReq) + if(optionalParam && optionalMapping) { tmpName = "__optSeq"; out << nl << "final " << typeS << ' ' << tmpName << " = " << v << ".get();"; @@ -1760,7 +1749,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, // // This just writes a byte sequence. // - string s = isOptionalParam(optional) && optional != OptionalInParamReq ? v + ".get()" : v; + string s = optionalParam && optionalMapping ? v + ".get()" : v; writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData); } else @@ -1770,7 +1759,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, // string tmpName; - if(isOptionalParam(optional) && optional != OptionalInParamReq) + if(optionalParam && optionalMapping) { tmpName = "__optSeq"; out << nl << "final " << typeS << ' ' << tmpName << " = " << v << ".get();"; @@ -1803,7 +1792,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData); } - if(isOptionalParam(optional)) + if(optionalParam) { out << eb; } @@ -1811,7 +1800,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, else { string tmpName; - if(isOptionalParam(optional)) + if(optionalParam) { tmpName = "__optSeq"; out << nl << "if(" << stream << ".readOpt(" << tag << ", " << getOptionalType(type) << "))"; @@ -1853,11 +1842,11 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out, writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData); - if(isOptionalParam(optional)) + if(optionalParam) { out << nl << v << ".set(" << tmpName << ");"; out << eb; - if(optional == OptionalOutParam) + if(mode == OptionalOutParam) { out << nl << "else"; out << sb; @@ -1982,7 +1971,7 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out, arg = "__e.getValue()"; type = value; } - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, arg, true, iter, false); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, true, iter, false); } out << eb; out << eb; @@ -2016,14 +2005,15 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out, { string keyTypeStr = typeToObjectString(key, TypeModeIn, package); string valueTypeStr = typeToObjectString(value, TypeModeIn, package); - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, arg, false, iter, false, StringList(), + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, false, + StringList(), "new IceInternal.DictionaryPatcher<" + keyTypeStr + ", " + valueTypeStr + ">(" + v + ", " + typeS + ".class, \"" + type->typeId() + "\", __key)"); } else { out << nl << typeS << ' ' << arg << ';'; - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, arg, false, iter, false); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, false); } } BuiltinPtr builtin = BuiltinPtr::dynamicCast(value); @@ -2190,7 +2180,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, string typeS = typeToString(type, TypeModeIn, package); out << nl << "for(" << typeS << " __elem : " << v << ')'; out << sb; - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, "__elem", true, iter, false); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", true, iter, false); out << eb; out << eb; // else } @@ -2237,13 +2227,13 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, ostringstream patchParams; patchParams << "new IceInternal.ListPatcher<" << origContentS << ">(" << v << ", " << origContentS << ".class, __type" << iter << ", __i" << iter << ')'; - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, "__elem", false, iter, false, - StringList(), patchParams.str()); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter, + false, StringList(), patchParams.str()); } else { out << nl << cont << " __elem;"; - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, "__elem", false, iter, false); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter, false); } if(!isObject) { @@ -2382,7 +2372,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, ostringstream o; o << v << "[__i" << iter << "]"; iter++; - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, o.str(), true, iter, false); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), true, iter, false); out << eb; out << eb; } @@ -2467,12 +2457,12 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { patchParams << "new IceInternal.SequencePatcher(" << v << ", " << origContentS << ".class, __type" << iter << ", __i" << iter << ')'; - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, o.str(), false, iter, false, - StringList(), patchParams.str()); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter, + false, StringList(), patchParams.str()); } else { - writeMarshalUnmarshalCode(out, package, type, OptionalNone, 0, o.str(), false, iter, false); + writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter, false); } out << eb; iter++; @@ -2485,7 +2475,7 @@ void Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, const string& package, const TypePtr& type, - OptionalMode optional, + bool optional, int tag, const string& param, bool marshal, @@ -2494,11 +2484,9 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, const StringList& metaData, const string& patchParams) { - assert(optional == OptionalNone || optional == OptionalMember); // Stream API doesn't support Ice.Optional<>. - string stream = marshal ? "__outS" : "__inS"; string v; - if(holder && optional == OptionalNone) + if(holder && !optional) { v = param + ".value"; } @@ -2616,7 +2604,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, } else { - if(holder && optional == OptionalNone) + if(holder && !optional) { out << nl << stream << ".readObject(" << param << ");"; } @@ -2638,7 +2626,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, { if(marshal) { - if(optional == OptionalMember) + if(optional) { out << nl << stream << ".startSize();"; out << nl << stream << ".writeProxy(" << v << ");"; @@ -2651,7 +2639,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, } else { - if(optional == OptionalMember) + if(optional) { out << nl << stream << ".skip(4);"; } @@ -2674,7 +2662,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, string typeS = typeToString(type, TypeModeIn, package); if(marshal) { - if(optional == OptionalMember) + if(optional) { out << nl << stream << ".startSize();"; out << nl << typeS << "Helper.write(" << stream << ", " << v << ");"; @@ -2687,7 +2675,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, } else { - if(optional == OptionalMember) + if(optional) { out << nl << stream << ".skip(4);"; } @@ -2705,7 +2693,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, } else { - if(holder && optional == OptionalNone) + if(holder && !optional) { out << nl << stream << ".readObject(" << param << ");"; } @@ -2729,7 +2717,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, { if(marshal) { - if(optional != OptionalNone) + if(optional) { if(st->isVariableLength()) { @@ -2751,7 +2739,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, else { string typeS = typeToString(type, TypeModeIn, package); - if(optional == OptionalMember) + if(optional) { if(st->isVariableLength()) { @@ -2791,7 +2779,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, DictionaryPtr dict = DictionaryPtr::dynamicCast(type); if(dict) { - if(optional != OptionalNone) + if(optional) { string typeS = typeToString(type, TypeModeIn, package, metaData); TypePtr keyType = dict->keyType(); @@ -2838,7 +2826,7 @@ Slice::JavaGenerator::writeStreamMarshalUnmarshalCode(Output& out, SequencePtr seq = SequencePtr::dynamicCast(type); if(seq) { - if(optional != OptionalNone) + if(optional) { string typeS = typeToString(type, TypeModeIn, package, metaData); TypePtr elemType = seq->type(); @@ -3066,7 +3054,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out, arg = "__e.getValue()"; type = value; } - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, arg, true, iter, false); + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, arg, true, iter, false); } out << eb; out << eb; @@ -3101,7 +3089,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out, { string keyTypeStr = typeToObjectString(key, TypeModeIn, package); string valueTypeStr = typeToObjectString(value, TypeModeIn, package); - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, arg, false, iter, false, + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, arg, false, iter, false, StringList(), "new IceInternal.DictionaryPatcher<" + keyTypeStr + ", " + valueTypeStr + ">(" + v + ", " + s + ".class, \"" + type->typeId() + "\", __key)"); @@ -3109,7 +3097,7 @@ Slice::JavaGenerator::writeStreamDictionaryMarshalUnmarshalCode(Output& out, else { out << nl << s << ' ' << arg << ';'; - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, arg, false, iter, false); + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, arg, false, iter, false); } } BuiltinPtr builtin = BuiltinPtr::dynamicCast(value); @@ -3275,7 +3263,7 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out, string typeS = typeToString(type, TypeModeIn, package); out << nl << "for(" << typeS << " __elem : " << v << ')'; out << sb; - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, "__elem", true, iter, false); + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, "__elem", true, iter, false); out << eb; out << eb; // else } @@ -3322,13 +3310,13 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out, ostringstream patchParams; patchParams << "new IceInternal.ListPatcher<" << origContentS << ">(" << v << ", " << origContentS << ".class, __type" << iter << ", __i" << iter << ')'; - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, "__elem", false, iter, false, + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, "__elem", false, iter, false, StringList(), patchParams.str()); } else { out << nl << cont << " __elem;"; - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, "__elem", false, iter, false); + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, "__elem", false, iter, false); } if(!isObject) { @@ -3467,7 +3455,7 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out, ostringstream o; o << v << "[__i" << iter << "]"; iter++; - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, o.str(), true, iter, false); + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, o.str(), true, iter, false); out << eb; out << eb; } @@ -3552,12 +3540,12 @@ Slice::JavaGenerator::writeStreamSequenceMarshalUnmarshalCode(Output& out, { patchParams << "new IceInternal.SequencePatcher(" << v << ", " << origContentS << ".class, __type" << iter << ", __i" << iter << ')'; - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, o.str(), false, iter, false, + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, o.str(), false, iter, false, StringList(), patchParams.str()); } else { - writeStreamMarshalUnmarshalCode(out, package, type, OptionalNone, 0, o.str(), false, iter, false); + writeStreamMarshalUnmarshalCode(out, package, type, false, 0, o.str(), false, iter, false); } out << eb; iter++; diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp index 4a90ca266d0..9f85a9f5536 100755 --- a/cpp/src/slice2freezej/Main.cpp +++ b/cpp/src/slice2freezej/Main.cpp @@ -903,7 +903,7 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) out << nl << "__os.startWriteEncaps();"; } iter = 0; - writeMarshalUnmarshalCode(out, "", type, OptionalNone, 0, valS, true, iter, false); + writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, valS, true, iter, false); if(type->usesClasses()) { out << nl << "__os.writePendingObjects();"; @@ -996,7 +996,7 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { - writeMarshalUnmarshalCode(out, "", type, OptionalNone, 0, "__r", false, iter, false, metaData, + writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, "__r", false, iter, false, metaData, patchParams); break; } @@ -1004,7 +1004,8 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) } else { - writeMarshalUnmarshalCode(out, "", type, OptionalNone, 0, "__r", false, iter, false, metaData, patchParams); + writeMarshalUnmarshalCode(out, "", type, OptionalNone, false, 0, "__r", false, iter, false, metaData, + patchParams); } if(type->usesClasses()) { @@ -1069,7 +1070,7 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) out << nl << "IceInternal.BasicStream __os = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator), encoding, true, false);"; int iter = 0; - writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, 0, keyS, true, iter, false); + writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, keyS, true, iter, false); assert(!indexTypes[i]->usesClasses()); out << nl << "IceInternal.Buffer buf = __os.prepareWrite();"; @@ -1153,7 +1154,7 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) case Builtin::KindObjectProxy: case Builtin::KindLocalObject: { - writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, 0, "r", false, iter, false, + writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, "r", false, iter, false, metaData, patchParams); break; } @@ -1161,8 +1162,8 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict) } else { - writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, 0, "r", false, iter, false, metaData, - patchParams); + writeMarshalUnmarshalCode(out, "", indexTypes[i], OptionalNone, false, 0, "r", false, iter, false, + metaData, patchParams); } out << nl << "return r;"; } @@ -1409,7 +1410,7 @@ FreezeGenerator::generate(UnitPtr& u, const Index& index) out << nl << "IceInternal.BasicStream __os = " << "new IceInternal.BasicStream(IceInternal.Util.getInstance(communicator()), encoding(), true, false);"; int iter = 0; - writeMarshalUnmarshalCode(out, "", dataMember->type(), OptionalNone, 0, valueS, true, iter, false); + writeMarshalUnmarshalCode(out, "", dataMember->type(), OptionalNone, false, 0, valueS, true, iter, false); if(type->usesClasses()) { out << nl << "__os.writePendingObjects();"; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 37879c13ca7..1327e24fb14 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -109,16 +109,23 @@ Slice::JavaVisitor::~JavaVisitor() } vector<string> -Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package) +Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package, bool local) { vector<string> params; + const bool optionalMapping = useOptionalMapping(op); + ParamDeclList paramList = op->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { StringList metaData = (*q)->getMetaData(); + bool optional = (*q)->optional(); + if(optional && (local || (*q)->isOutParam())) + { + optional = optionalMapping; + } string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package, - metaData, true, (*q)->optional()); + metaData, true, optional); params.push_back(typeString + ' ' + fixKwd((*q)->name())); } @@ -130,12 +137,24 @@ Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package { vector<string> params; + const bool optionalMapping = useOptionalMapping(op); + ParamDeclList paramList = op->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { + bool optional; + if((*q)->optional()) + { + optional = (*q)->isOutParam() ? true : optionalMapping; + } + else + { + optional = false; + } + StringList metaData = (*q)->getMetaData(); string typeString = typeToString((*q)->type(), (*q)->isOutParam() ? TypeModeOut : TypeModeIn, package, - metaData, true, useOptionalMapping(*q)); + metaData, true, optional); if(final) { typeString = "final " + typeString; @@ -151,15 +170,28 @@ Slice::JavaVisitor::getInOutParams(const OperationPtr& op, const string& package { vector<string> params; + const bool optionalMapping = useOptionalMapping(op); + ParamDeclList paramList = op->parameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { if((*q)->isOutParam() == (paramType == OutParam)) { - bool optional = (*q)->optional(); - if(optional && proxy) + bool optional; + if((*q)->optional()) { - optional = useOptionalMapping(*q); + if(proxy) + { + optional = paramType == InParam ? optionalMapping : true; + } + else + { + optional = true; + } + } + else + { + optional = false; } StringList metaData = (*q)->getMetaData(); string typeString = typeToString((*q)->type(), paramType == InParam ? TypeModeIn : TypeModeOut, package, @@ -186,14 +218,17 @@ Slice::JavaVisitor::getParamsAsync(const OperationPtr& op, const string& package } vector<string> -Slice::JavaVisitor::getParamsAsyncCB(const OperationPtr& op, const string& package) +Slice::JavaVisitor::getParamsAsyncCB(const OperationPtr& op, const string& package, bool amd) { vector<string> params; + const bool optionalMapping = amd ? useOptionalMapping(op) : true; + TypePtr ret = op->returnType(); if(ret) { - string retS = typeToString(ret, TypeModeIn, package, op->getMetaData(), true, op->returnIsOptional()); + string retS = typeToString(ret, TypeModeIn, package, op->getMetaData(), true, + optionalMapping && op->returnIsOptional()); params.push_back(retS + " __ret"); } @@ -203,7 +238,7 @@ Slice::JavaVisitor::getParamsAsyncCB(const OperationPtr& op, const string& packa if((*q)->isOutParam()) { string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true, - (*q)->optional()); + optionalMapping && (*q)->optional()); params.push_back(typeString + ' ' + fixKwd((*q)->name())); } } @@ -291,7 +326,8 @@ Slice::JavaVisitor::getArgsAsyncCB(const OperationPtr& op) void Slice::JavaVisitor::writeMarshalUnmarshalParams(Output& out, const string& package, const ParamDeclList& params, - const OperationPtr& op, int& iter, bool marshal, bool dispatch) + const OperationPtr& op, int& iter, bool marshal, bool optionalMapping, + bool dispatch) { ParamDeclList optionals; ParamDeclList::const_iterator pli; @@ -311,8 +347,8 @@ Slice::JavaVisitor::writeMarshalUnmarshalParams(Output& out, const string& packa { patchParams = paramName; } - writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, 0, paramName, marshal, iter, holder, - (*pli)->getMetaData(), patchParams); + writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, marshal, + iter, holder, (*pli)->getMetaData(), patchParams); } } @@ -325,13 +361,14 @@ Slice::JavaVisitor::writeMarshalUnmarshalParams(Output& out, const string& packa BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret); ClassDeclPtr cl = ClassDeclPtr::dynamicCast(ret); returnsObject = (builtin && builtin->kind() == Builtin::KindObject) || cl; + const bool optional = optionalMapping && op->returnIsOptional(); - string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional()); + string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, optional); bool holder = false; if(!marshal) { - if(op->returnIsOptional()) + if(optional) { out << nl << retS << " __ret = new " << retS << "();"; } @@ -348,7 +385,7 @@ Slice::JavaVisitor::writeMarshalUnmarshalParams(Output& out, const string& packa if(!op->returnIsOptional()) { - writeMarshalUnmarshalCode(out, package, ret, OptionalNone, 0, "__ret", marshal, iter, holder, + writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, "__ret", marshal, iter, holder, op->getMetaData()); } } @@ -375,29 +412,22 @@ Slice::JavaVisitor::writeMarshalUnmarshalParams(Output& out, const string& packa { if(checkReturnType && op->returnTag() < (*pli)->tag()) { - writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, op->returnTag(), "__ret", marshal, iter, - false, op->getMetaData()); + writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(), + "__ret", marshal, iter, false, op->getMetaData()); checkReturnType = false; } - OptionalMode mode; - if((*pli)->isOutParam()) - { - mode = OptionalOutParam; - } - else - { - mode = useOptionalMapping(*pli) ? OptionalInParamOpt : OptionalInParamReq; - } + const bool holder = dispatch && (*pli)->isOutParam() && !optionalMapping; - writeMarshalUnmarshalCode(out, package, (*pli)->type(), mode, (*pli)->tag(), fixKwd((*pli)->name()), marshal, - iter, false, (*pli)->getMetaData()); + writeMarshalUnmarshalCode(out, package, (*pli)->type(), + (*pli)->isOutParam() ? OptionalOutParam : OptionalInParam, optionalMapping, + (*pli)->tag(), fixKwd((*pli)->name()), marshal, iter, holder, (*pli)->getMetaData()); } if(checkReturnType) { - writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, op->returnTag(), "__ret", marshal, iter, - false, op->getMetaData()); + writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(), "__ret", + marshal, iter, false, op->getMetaData()); } } @@ -554,16 +584,16 @@ Slice::JavaVisitor::writeMarshalDataMember(Output& out, const string& package, c { if(!member->optional()) { - writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, 0, fixKwd(member->name()), true, iter, - false, member->getMetaData()); + writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), + true, iter, false, member->getMetaData()); } else { out << nl << "if(__has_" << member->name() << " && __os.writeOpt(" << member->tag() << ", " << getOptionalType(member->type()) << "))"; out << sb; - writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, 0, fixKwd(member->name()), true, iter, - false, member->getMetaData()); + writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), true, + iter, false, member->getMetaData()); out << eb; } } @@ -586,15 +616,15 @@ Slice::JavaVisitor::writeUnmarshalDataMember(Output& out, const string& package, if(!member->optional()) { - writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, 0, fixKwd(member->name()), false, iter, - false, member->getMetaData(), patchParams); + writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), false, + iter, false, member->getMetaData(), patchParams); } else { out << nl << "if(__has_" << member->name() << " = __is.readOpt(" << member->tag() << ", " << getOptionalType(member->type()) << "))"; out << sb; - writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, 0, fixKwd(member->name()), false, + writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), false, iter, false, member->getMetaData(), patchParams); out << eb; } @@ -880,7 +910,8 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& string deprecateReason = getDeprecateReason(op, cl, "operation"); - bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd"); + const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd"); + const bool optionalMapping = useOptionalMapping(op); vector<string> params; vector<string> args; @@ -962,7 +993,8 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& writeDocComment(out, op, deprecateReason); } out << nl << "public final " - << typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional()) + << typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, + optionalMapping && op->returnIsOptional()) << nl << opName << spar << params << epar; if(op->hasMetaData("UserException")) { @@ -1009,7 +1041,9 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& << " __obj, IceInternal.Incoming __inS, Ice.Current __current)"; out << sb; - bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd"); + const bool amd = cl->hasMetaData("amd") || op->hasMetaData("amd"); + const bool optionalMapping = useOptionalMapping(op); + if(!amd) { TypePtr ret = op->returnType(); @@ -1080,7 +1114,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& } } iter = 0; - writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true); + writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true); out << nl << "__inS.endReadParams();"; } else @@ -1094,7 +1128,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& for(pli = outParams.begin(); pli != outParams.end(); ++pli) { string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true, - (*pli)->optional()); + optionalMapping && (*pli)->optional()); out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();"; } @@ -1109,7 +1143,8 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& out << nl; if(ret) { - string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true, op->returnIsOptional()); + string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true, + optionalMapping && op->returnIsOptional()); out << retS << " __ret = "; } out << "__obj." << fixKwd(opName) << '('; @@ -1144,7 +1179,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& { out << nl << "__os.format(" << formatTypeToString(format) << ");"; } - writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, true); + writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, optionalMapping, true); out << nl << "__inS.__endWriteParams(true);"; } else @@ -1205,24 +1240,28 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& iter = 0; for(pli = inParams.begin(); pli != inParams.end(); ++pli) { - StringList metaData = (*pli)->getMetaData(); TypePtr paramType = (*pli)->type(); string paramName = fixKwd((*pli)->name()); - string typeS = typeToString(paramType, TypeModeIn, package, metaData); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) + string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(), + true, (*pli)->optional()); + if((*pli)->optional()) { - out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();"; - writeMarshalUnmarshalCode(out, package, paramType, OptionalNone, 0, paramName, false, iter, - true, metaData, string()); + out << nl << typeS << ' ' << paramName << " = new " << typeS << "();"; } else { - out << nl << typeS << ' ' << paramName << ';'; - writeMarshalUnmarshalCode(out, package, paramType, OptionalNone, 0, paramName, false, iter, - false, metaData); + BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); + if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) + { + out << nl << typeS << "Holder " << paramName << " = new " << typeS << "Holder();"; + } + else + { + out << nl << typeS << ' ' << paramName << ';'; + } } } + writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true); out << nl << "__inS.endReadParams();"; } else @@ -1243,10 +1282,13 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr& { TypePtr paramType = (*pli)->type(); out << fixKwd((*pli)->name()); - BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); - if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) + if(!(*pli)->optional()) { - out << ".value"; + BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType); + if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(paramType)) + { + out << ".value"; + } } out << ", "; } @@ -2357,7 +2399,8 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) TypePtr ret; vector<string> params; - bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")); + const bool amd = !p->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd")); + const bool optionalMapping = useOptionalMapping(op); if(amd) { @@ -2369,7 +2412,8 @@ Slice::Gen::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurrent) ret = op->returnType(); } - string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional()); + string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, + optionalMapping && op->returnIsOptional()); ExceptionList throws = op->throws(); throws.sort(); throws.unique(); @@ -2528,7 +2572,9 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) { ContainerPtr container = (*r)->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); - bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd"); + const bool hasAMD = cl->hasMetaData("amd") || (*r)->hasMetaData("amd"); + const bool optionalMapping = useOptionalMapping(*r); + #if defined(__SUNPRO_CC) && (__SUNPRO_CC==0x550) // // Work around for Sun CC 5.5 bug #4853566 @@ -2545,8 +2591,10 @@ Slice::Gen::TieVisitor::visitClassDefStart(const ClassDefPtr& p) #else string opName = hasAMD ? (*r)->name() + "_async" : fixKwd((*r)->name()); #endif + TypePtr ret = (*r)->returnType(); - string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData()); + string retS = typeToString(ret, TypeModeReturn, package, (*r)->getMetaData(), true, + optionalMapping && (*r)->returnIsOptional()); vector<string> params; vector<string> args; @@ -2780,7 +2828,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) // // For local classes and interfaces, we don't use the OperationsNC interface. - // Instead, we generated the operation signatures directly into the class + // Instead, we generate the operation signatures directly into the class // or interface. // if(p->isLocal()) @@ -2793,12 +2841,13 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) ContainerPtr container = op->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); string opname = op->name(); + const bool optionalMapping = useOptionalMapping(op); - TypePtr ret; - vector<string> params = getParams(op, package); - ret = op->returnType(); + TypePtr ret = op->returnType(); + vector<string> params = getParams(op, package, true); - string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData()); + string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, + optionalMapping && op->returnIsOptional()); ExceptionList throws = op->throws(); throws.sort(); throws.unique(); @@ -4418,6 +4467,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) vector<string> params = getParamsProxy(op, package); vector<string> args = getArgs(op); + const bool optionalMapping = useOptionalMapping(op); + ExceptionList throws = op->throws(); throws.sort(); throws.unique(); @@ -4615,7 +4666,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) pl.push_back(*pli); } } - writeMarshalUnmarshalParams(out, package, pl, 0, iter, true); + writeMarshalUnmarshalParams(out, package, pl, 0, iter, true, optionalMapping); out << nl << "__result.__endWriteParams();"; } else @@ -4688,7 +4739,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) pl.push_back(*pli); } } - writeMarshalUnmarshalParams(out, package, pl, op, iter, false); + writeMarshalUnmarshalParams(out, package, pl, op, iter, false, true); out << nl << "__result.__endReadParams();"; } else @@ -5562,6 +5613,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) string opName = fixKwd(op->name()); TypePtr ret = op->returnType(); string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true, op->returnIsOptional()); + const bool optionalMapping = useOptionalMapping(op); int iter = 0; ParamDeclList inParams; @@ -5617,7 +5669,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) { out << nl << "__os.format(" << formatTypeToString(format) << ");"; } - writeMarshalUnmarshalParams(out, package, inParams, 0, iter, true); + writeMarshalUnmarshalParams(out, package, inParams, 0, iter, true, optionalMapping); out << nl << "__og.endWriteParams();"; out << eb; out << nl << "catch(Ice.LocalException __ex)"; @@ -5660,7 +5712,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) if(ret || !outParams.empty()) { out << nl << "IceInternal.BasicStream __is = __og.startReadParams();"; - writeMarshalUnmarshalParams(out, package, outParams, op, iter, false); + writeMarshalUnmarshalParams(out, package, outParams, op, iter, false, true); out << nl << "__og.endReadParams();"; } else @@ -5742,6 +5794,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) ClassDefPtr cl = ClassDefPtr::dynamicCast(container); string opName = fixKwd(op->name()); TypePtr ret = op->returnType(); + const bool optionalMapping = useOptionalMapping(op); string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional()); ExceptionList throws = op->throws(); @@ -5763,25 +5816,6 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) vector<string> params = getParamsProxy(op, package, true); - // - // Collect the arguments that will be passed to the servant. - // - // Note that for optional in parameters, we may have to wrap a value - // in an Optional object to be compatible with the servant's signature. - // - vector<string> args; - ParamDeclList paramList = op->parameters(); - for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) - { - string param = fixKwd((*q)->name()); - if(!(*q)->isOutParam() && (*q)->optional() && !useOptionalMapping(*q)) - { - string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true, true); - param = "new " + typeString + "(" + param + ")"; - } - args.push_back(param); - } - out << sp; if(!deprecateReason.empty()) { @@ -5837,27 +5871,87 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; } + // + // Collect the arguments that will be passed to the servant. + // + vector<string> args; + ParamDeclList paramList = op->parameters(); + ParamDeclList::const_iterator q; + for(q = paramList.begin(); q != paramList.end(); ++q) + { + string param = fixKwd((*q)->name()); + // + // For optional parameters, the proxy mapping can differ from the servant + // mapping, depending on whether the optional mapping is being used. + // + if((*q)->optional() && !optionalMapping) + { + if((*q)->isOutParam()) + { + param = "__" + (*q)->name(); + string typeS = typeToString((*q)->type(), TypeModeOut, package, (*q)->getMetaData()); + out << nl << typeS << ' ' << param << " = new " << typeS << "();"; + } + else + { + string typeS = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true, true); + param = "new " + typeS + "(" + param + ")"; + } + } + args.push_back(param); + } + out << nl; if(ret) { if(op->returnIsOptional()) { - out << resultType << " __r = "; + if(optionalMapping) + { + out << resultType << " __r = "; + } + else + { + out << typeToString(ret, TypeModeIn, package, op->getMetaData()) << " __r = "; + } } else { out << "__result.value = "; } } + out << "__servant." << opName << spar << args << "__current" << epar << ';'; - if(op->returnIsOptional()) + + for(q = paramList.begin(); q != paramList.end(); ++q) { - out << nl << "if(__r != null && __r.isSet())"; - out << sb; - out << nl << "__result.set(__r.get());"; - out << eb; + // + // For optional parameters, the proxy mapping can differ from the servant + // mapping, depending on whether the optional mapping is being used. + // + if((*q)->optional() && !optionalMapping && (*q)->isOutParam()) + { + out << nl << fixKwd((*q)->name()) << ".set(__" << (*q)->name() << ".value);"; + } + } + + if(ret && op->returnIsOptional()) + { + if(optionalMapping) + { + out << nl << "if(__r != null && __r.isSet())"; + out << sb; + out << nl << "__result.set(__r.get());"; + out << eb; + } + else + { + out << nl << "__result.set(__r);"; + } } + out << nl << "return Ice.DispatchStatus.DispatchOK;"; + if(!throws.empty()) { out << eb; @@ -5991,129 +6085,144 @@ Slice::Gen::BaseImplVisitor::BaseImplVisitor(const string& dir) : void Slice::Gen::BaseImplVisitor::writeDecl(Output& out, const string& package, const string& name, const TypePtr& type, - const StringList& metaData) + const StringList& metaData, bool optional) { - out << nl << typeToString(type, TypeModeIn, package, metaData) << ' ' << name; + string typeS = typeToString(type, TypeModeIn, package, metaData, true, optional); + out << nl << typeS << ' ' << name; - BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if(builtin) + if(optional) { - switch(builtin->kind()) + out << " = new " << typeS << "();"; + } + else + { + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); + if(builtin) { - case Builtin::KindBool: - { - out << " = false"; - break; - } - case Builtin::KindByte: - { - out << " = (byte)0"; - break; - } - case Builtin::KindShort: + switch(builtin->kind()) { - out << " = (short)0"; - break; - } - case Builtin::KindInt: - case Builtin::KindLong: - { - out << " = 0"; - break; - } - case Builtin::KindFloat: - { - out << " = (float)0.0"; - break; - } - case Builtin::KindDouble: - { - out << " = 0.0"; - break; + case Builtin::KindBool: + { + out << " = false"; + break; + } + case Builtin::KindByte: + { + out << " = (byte)0"; + break; + } + case Builtin::KindShort: + { + out << " = (short)0"; + break; + } + case Builtin::KindInt: + case Builtin::KindLong: + { + out << " = 0"; + break; + } + case Builtin::KindFloat: + { + out << " = (float)0.0"; + break; + } + case Builtin::KindDouble: + { + out << " = 0.0"; + break; + } + case Builtin::KindString: + { + out << " = \"\""; + break; + } + case Builtin::KindObject: + case Builtin::KindObjectProxy: + case Builtin::KindLocalObject: + { + out << " = null"; + break; + } } - case Builtin::KindString: + } + else + { + EnumPtr en = EnumPtr::dynamicCast(type); + if(en) { - out << " = \"\""; - break; + EnumeratorList enumerators = en->getEnumerators(); + out << " = " << getAbsolute(en, package) << '.' << fixKwd(enumerators.front()->name()); } - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: + else { out << " = null"; - break; } } - } - else - { - EnumPtr en = EnumPtr::dynamicCast(type); - if(en) - { - EnumeratorList enumerators = en->getEnumerators(); - out << " = " << getAbsolute(en, package) << '.' << fixKwd(enumerators.front()->name()); - } - else - { - out << " = null"; - } - } - out << ';'; + out << ';'; + } } void -Slice::Gen::BaseImplVisitor::writeReturn(Output& out, const TypePtr& type) +Slice::Gen::BaseImplVisitor::writeReturn(Output& out, const TypePtr& type, bool optional) { - BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); - if(builtin) + if(optional) { - switch(builtin->kind()) + out << nl << "return null;"; + } + else + { + BuiltinPtr builtin = BuiltinPtr::dynamicCast(type); + if(builtin) { - case Builtin::KindBool: - { - out << nl << "return false;"; - break; - } - case Builtin::KindByte: + switch(builtin->kind()) { - out << nl << "return (byte)0;"; - break; - } - case Builtin::KindShort: - { - out << nl << "return (short)0;"; - break; - } - case Builtin::KindInt: - case Builtin::KindLong: - { - out << nl << "return 0;"; - break; - } - case Builtin::KindFloat: - { - out << nl << "return (float)0.0;"; - break; - } - case Builtin::KindDouble: - { - out << nl << "return 0.0;"; - break; - } - case Builtin::KindString: - case Builtin::KindObject: - case Builtin::KindObjectProxy: - case Builtin::KindLocalObject: - { - out << nl << "return null;"; - break; + case Builtin::KindBool: + { + out << nl << "return false;"; + break; + } + case Builtin::KindByte: + { + out << nl << "return (byte)0;"; + break; + } + case Builtin::KindShort: + { + out << nl << "return (short)0;"; + break; + } + case Builtin::KindInt: + case Builtin::KindLong: + { + out << nl << "return 0;"; + break; + } + case Builtin::KindFloat: + { + out << nl << "return (float)0.0;"; + break; + } + case Builtin::KindDouble: + { + out << nl << "return 0.0;"; + break; + } + case Builtin::KindString: + case Builtin::KindObject: + case Builtin::KindObjectProxy: + case Builtin::KindLocalObject: + { + out << nl << "return null;"; + break; + } } + return; } - return; - } - out << nl << "return null;"; + out << nl << "return null;"; + } } void @@ -6122,8 +6231,10 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package, string opName = op->name(); TypePtr ret = op->returnType(); + const bool optionalMapping = useOptionalMapping(op); StringList opMetaData = op->getMetaData(); - string retS = typeToString(ret, TypeModeReturn, package, opMetaData); + string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true, + optionalMapping && op->returnIsOptional()); vector<string> params = getParams(op, package); ContainerPtr container = op->container(); @@ -6168,13 +6279,14 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package, } if(ret) { - writeDecl(out, package, result, ret, opMetaData); + writeDecl(out, package, result, ret, opMetaData, optionalMapping && op->returnIsOptional()); } for(q = paramList.begin(); q != paramList.end(); ++q) { if((*q)->isOutParam()) { - writeDecl(out, package, fixKwd((*q)->name()), (*q)->type(), (*q)->getMetaData()); + writeDecl(out, package, fixKwd((*q)->name()), (*q)->type(), (*q)->getMetaData(), + optionalMapping && (*q)->optional()); } } @@ -6231,7 +6343,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(Output& out, const string& package, // if(ret) { - writeReturn(out, ret); + writeReturn(out, ret, optionalMapping && op->returnIsOptional()); } out << eb; @@ -6432,7 +6544,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) ExceptionList throws = p->throws(); - vector<string> params = getParamsAsyncCB(p, classPkg); + vector<string> params = getParamsAsyncCB(p, classPkg, false); vector<string> args = getInOutArgs(p, OutParam); writeDocCommentOp(out, p); @@ -6529,7 +6641,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) ExceptionList throws = p->throws(); - vector<string> params = getParamsAsyncCB(p, classPkg); + vector<string> params = getParamsAsyncCB(p, classPkg, false); vector<string> args = getInOutArgs(p, OutParam); writeDocCommentOp(out, p); @@ -6596,7 +6708,9 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) string classNameAMDI = "_AMD_" + cl->name(); string absoluteAMDI = getAbsolute(cl, "", "_AMD_", "_" + name); - vector<string> paramsAMD = getParamsAsyncCB(p, classPkg); + vector<string> paramsAMD = getParamsAsyncCB(p, classPkg, true); + + const bool optionalMapping = useOptionalMapping(p); { open(absoluteAMD, p->file()); @@ -6676,19 +6790,7 @@ Slice::Gen::AsyncVisitor::visitOperation(const OperationPtr& p) { out << nl << "__os.format(" << formatTypeToString(format) << ");"; } - for(pli = outParams.begin(); pli != outParams.end(); ++pli) - { - StringList metaData = (*pli)->getMetaData(); - string typeS = typeToString((*pli)->type(), TypeModeIn, classPkg, metaData); - writeMarshalUnmarshalCode(out, classPkg, (*pli)->type(), OptionalNone, 0, fixKwd((*pli)->name()), - true, iter, false, metaData); - } - if(ret) - { - string retS = typeToString(ret, TypeModeIn, classPkg, opMetaData); - writeMarshalUnmarshalCode(out, classPkg, ret, OptionalNone, 0, "__ret", true, iter, false, - opMetaData); - } + writeMarshalUnmarshalParams(out, classPkg, outParams, p, iter, true, optionalMapping, false); out << nl << "this.__endWriteParams(true);"; out << eb; out << nl << "catch(Ice.LocalException __ex)"; diff --git a/cpp/src/slice2java/Gen.h b/cpp/src/slice2java/Gen.h index 5cfeae3714a..94f0dc95a2d 100644 --- a/cpp/src/slice2java/Gen.h +++ b/cpp/src/slice2java/Gen.h @@ -32,11 +32,11 @@ protected: // // Compose the parameter lists for an operation. // - std::vector<std::string> getParams(const OperationPtr&, const std::string&); + std::vector<std::string> getParams(const OperationPtr&, const std::string&, bool = false); std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool = false); std::vector<std::string> getInOutParams(const OperationPtr&, const std::string&, ParamDir, bool); std::vector<std::string> getParamsAsync(const OperationPtr&, const std::string&, bool); - std::vector<std::string> getParamsAsyncCB(const OperationPtr&, const std::string&); + std::vector<std::string> getParamsAsyncCB(const OperationPtr&, const std::string&, bool); // // Compose the argument lists for an operation. @@ -47,7 +47,7 @@ protected: std::vector<std::string> getArgsAsyncCB(const OperationPtr&); void writeMarshalUnmarshalParams(::IceUtilInternal::Output&, const std::string&, const ParamDeclList&, - const OperationPtr&, int&, bool, bool = false); + const OperationPtr&, int&, bool, bool, bool = false); // // Generate a throws clause containing only non-local exceptions. @@ -290,12 +290,13 @@ private: // Generate code to emit a local variable declaration and initialize it // if necessary. // - void writeDecl(::IceUtilInternal::Output&, const std::string&, const std::string&, const TypePtr&, const StringList&); + void writeDecl(::IceUtilInternal::Output&, const std::string&, const std::string&, const TypePtr&, + const StringList&, bool); // // Generate code to return a value. // - void writeReturn(::IceUtilInternal::Output&, const TypePtr&); + void writeReturn(::IceUtilInternal::Output&, const TypePtr&, bool); // // Generate an operation. |