From a7d0df77fdeba0bc7c829762d787181e93c60e47 Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 28 Jun 2018 14:04:19 +0200 Subject: [PATCH] Add support cs:namespace metadata Add support to map Slice modules to different namespaces using cs:namespace metadata Fixes #122 slice2cs generates invalid namespace qualification --- cpp/src/slice2cs/CsUtil.cpp | 220 +++-- cpp/src/slice2cs/CsUtil.h | 17 +- cpp/src/slice2cs/Gen.cpp | 820 ++++++++++-------- cpp/src/slice2cs/Gen.h | 4 + cpp/test/Ice/scope/AllTests.cpp | 584 +++++++++++-- cpp/test/Ice/scope/Server.cpp | 77 ++ cpp/test/Ice/scope/Test.ice | 26 + cpp/test/include/TestHelper.h | 2 +- csharp/msbuild/ice.net45.test.sln | 33 + csharp/msbuild/ice.netstandard2.0.test.sln | 33 + csharp/src/Ice/Instance.cs | 33 +- csharp/test/Ice/packagemd/.gitignore | 7 + csharp/test/Ice/packagemd/AllTests.cs | 176 ++++ csharp/test/Ice/packagemd/Client.cs | 38 + csharp/test/Ice/packagemd/InitialI.cs | 87 ++ csharp/test/Ice/packagemd/NoPackage.ice | 39 + csharp/test/Ice/packagemd/Package.ice | 59 ++ csharp/test/Ice/packagemd/Server.cs | 40 + csharp/test/Ice/packagemd/Test.ice | 39 + csharp/test/Ice/scope/AllTests.cs | 83 ++ csharp/test/Ice/scope/Server.cs | 65 +- csharp/test/Ice/scope/Test.ice | 26 + .../main/java/test/Ice/scope/AllTests.java | 270 ++++++ .../src/main/java/test/Ice/scope/Server.java | 51 ++ .../src/main/java/test/Ice/scope/Test.ice | 26 + .../main/java/test/Ice/scope/AllTests.java | 37 + .../src/main/java/test/Ice/scope/Server.java | 67 ++ .../src/main/java/test/Ice/scope/Test.ice | 26 + js/test/Ice/scope/Client.js | 34 + js/test/Ice/scope/Test.ice | 26 + php/test/Ice/scope/Test.ice | 26 + python/test/Ice/scope/Test.ice | 26 + ruby/test/Ice/scope/Test.ice | 26 + slice/Ice/Communicator.ice | 2 +- 34 files changed, 2639 insertions(+), 486 deletions(-) create mode 100644 csharp/test/Ice/packagemd/.gitignore create mode 100644 csharp/test/Ice/packagemd/AllTests.cs create mode 100644 csharp/test/Ice/packagemd/Client.cs create mode 100644 csharp/test/Ice/packagemd/InitialI.cs create mode 100644 csharp/test/Ice/packagemd/NoPackage.ice create mode 100644 csharp/test/Ice/packagemd/Package.ice create mode 100644 csharp/test/Ice/packagemd/Server.cs create mode 100644 csharp/test/Ice/packagemd/Test.ice diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index 22a8f7d21ed..bdf939515e8 100644 --- a/cpp/src/slice2cs/CsUtil.cpp +++ b/cpp/src/slice2cs/CsUtil.cpp @@ -100,13 +100,111 @@ splitScopedName(const string& scoped) } string -Slice::CsGenerator::getUnqualified(const string& type, const string& scope) +Slice::CsGenerator::getPackagePrefix(const ContainedPtr& cont) { - if(type.find(".") != string::npos && type.find(scope) == 0 && type.find(".", scope.size()) == string::npos) + // + // Traverse to the top-level module. + // + ModulePtr m; + ContainedPtr p = cont; + while(true) { - return type.substr(scope.size()); + if(ModulePtr::dynamicCast(p)) + { + m = ModulePtr::dynamicCast(p); + } + + ContainerPtr c = p->container(); + p = ContainedPtr::dynamicCast(c); // This cast fails for Unit. + if(!p) + { + break; + } + } + + assert(m); + + // + // The cs:namespace metadata can be defined as global metadata or applied to a top-level module. + // We check for the metadata at the top-level module first and then fall back to the global scope. + // + static const string prefix = "cs:namespace:"; + + string q; + if(!m->findMetaData(prefix, q)) + { + UnitPtr unit = cont->unit(); + string file = cont->file(); + assert(!file.empty()); + + DefinitionContextPtr dc = unit->findDefinitionContext(file); + assert(dc); + q = dc->findMetaData(prefix); + } + + if(!q.empty()) + { + q = q.substr(prefix.size()); + } + + return q; +} + +string +Slice::CsGenerator::getPackage(const ContainedPtr& cont) +{ + string scope = fixId(cont->scope()); + if(scope.rfind(".") == scope.size() - 1) + { + scope = scope.substr(0, scope.size() - 1); + } + string prefix = getPackagePrefix(cont); + if(!prefix.empty()) + { + if(!scope.empty()) + { + return prefix + "." + scope; + } + else + { + return prefix; + } + } + + return scope; +} + +string +Slice::CsGenerator::getUnqualified(const string& type, const string& scope, bool builtin) +{ + if(type.find(".") != string::npos && type.find(scope) == 0 && type.find(".", scope.size() + 1) == string::npos) + { + return type.substr(scope.size() + 1); + } + else if(builtin) + { + return type.find(".") == string::npos ? type : "global::" + type; + } + else + { + return "global::" + type; + } +} + +string +Slice::CsGenerator::getUnqualified(const ContainedPtr& p, const string& package, const string& prefix, + const string& suffix) +{ + string name = fixId(p->name()); + string contPkg = getPackage(p); + if(contPkg == package || contPkg.empty()) + { + return prefix + name + suffix; + } + else + { + return "global::" + contPkg + "." + prefix + name + suffix; } - return type; } // @@ -294,7 +392,7 @@ Slice::CsGenerator::getStaticId(const TypePtr& type) } string -Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool optional, bool local, +Slice::CsGenerator::typeToString(const TypePtr& type, const string& package, bool optional, bool local, const StringList& metaData) { if(!type) @@ -304,7 +402,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool if(optional) { - return getUnqualified("Ice.Optional", scope) + "<" + typeToString(type, scope, false, local) + ">"; + return getUnqualified("Ice.Optional", package) + "<" + typeToString(type, package, false, local) + ">"; } static const char* builtinTable[] = @@ -319,7 +417,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool "string", "Ice.Object", "Ice.ObjectPrx", - "_System.Object", + "System.Object", "Ice.Value" }; @@ -341,11 +439,11 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool { if(!local && builtin->kind() == Builtin::KindObject) { - return getUnqualified(builtinTable[Builtin::KindValue], scope); + return getUnqualified(builtinTable[Builtin::KindValue], package, true); } else { - return getUnqualified(builtinTable[builtin->kind()], scope); + return getUnqualified(builtinTable[builtin->kind()], package, true); } } @@ -354,11 +452,11 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool { if(cl->isInterface() && !local) { - return getUnqualified("Ice.Value", scope); + return getUnqualified("Ice.Value", package); } else { - return getUnqualified(fixId(cl->scoped()), scope); + return getUnqualified(cl, package); } } @@ -368,11 +466,11 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool ClassDefPtr def = proxy->_class()->definition(); if(def->isInterface() || def->allOperations().size() > 0) { - return getUnqualified(fixId(proxy->_class()->scoped() + "Prx"), scope); + return getUnqualified(proxy->_class(), package, "", "Prx"); } else { - return getUnqualified("Ice.ObjectPrx", scope); + return getUnqualified("Ice.ObjectPrx", package); } } @@ -386,11 +484,12 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool string type = meta.substr(prefix.size()); if(type == "List" || type == "LinkedList" || type == "Queue" || type == "Stack") { - return "_System.Collections.Generic." + type + "<" + typeToString(seq->type(), scope, optional, local) + ">"; + return "global::System.Collections.Generic." + type + "<" + + typeToString(seq->type(), package, optional, local) + ">"; } else { - return "global::" + type + "<" + typeToString(seq->type(), scope, optional, local) + ">"; + return "global::" + type + "<" + typeToString(seq->type(), package, optional, local) + ">"; } } @@ -401,7 +500,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool return "global::" + type; } - return typeToString(seq->type(), scope, optional, local) + "[]"; + return typeToString(seq->type(), package, optional, local) + "[]"; } DictionaryPtr d = DictionaryPtr::dynamicCast(type); @@ -418,15 +517,15 @@ Slice::CsGenerator::typeToString(const TypePtr& type, const string& scope, bool { typeName = "Dictionary"; } - return "_System.Collections.Generic." + typeName + "<" + - typeToString(d->keyType(), scope, optional, local) + ", " + - typeToString(d->valueType(), scope, optional, local) + ">"; + return "global::System.Collections.Generic." + typeName + "<" + + typeToString(d->keyType(), package, optional, local) + ", " + + typeToString(d->valueType(), package, optional, local) + ">"; } ContainedPtr contained = ContainedPtr::dynamicCast(type); if(contained) { - return getUnqualified(fixId(contained->scoped()), scope); + return getUnqualified(fixId(contained->scoped()), package); } return "???"; @@ -481,11 +580,11 @@ Slice::CsGenerator::taskResultType(const OperationPtr& op, const string& scope, string t = resultType(op, scope, dispatch); if(t.empty()) { - return "_System.Threading.Tasks.Task"; + return "global::System.Threading.Tasks.Task"; } else { - return "_System.Threading.Tasks.Task<" + t + '>'; + return "global::System.Threading.Tasks.Task<" + t + '>'; } } @@ -1301,7 +1400,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "_System.Collections.Generic.IEnumerator<" << typeS + out << nl << "global::System.Collections.Generic.IEnumerator<" << typeS << "> e = " << param << ".GetEnumerator();"; out << nl << "while(e.MoveNext())"; out << sb; @@ -1335,40 +1434,40 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, string patcherName; if(isArray) { - patcherName = "IceInternal.Patcher.arrayReadValue"; - out << "Ice.Value[" << param << "_lenx];"; + patcherName = "global::IceInternal.Patcher.arrayReadValue"; + out << "global::Ice.Value[" << param << "_lenx];"; } else if(isCustom) { - patcherName = "IceInternal.Patcher.customSeqReadValue"; - out << "global::" << genericType << "();"; + patcherName = "global::IceInternal.Patcher.customSeqReadValue"; + out << "global::" << genericType << "();"; } else { - patcherName = "IceInternal.Patcher.listReadValue"; - out << "_System.Collections.Generic." << genericType << "(" << param << "_lenx);"; + patcherName = "global::IceInternal.Patcher.listReadValue"; + out << "global::System.Collections.Generic." << genericType << "(" << param << "_lenx);"; } out << nl << "for(int ix = 0; ix < " << param << "_lenx; ++ix)"; out << sb; - out << nl << stream << ".readValue(" << patcherName << "(" << param << ", ix));"; + out << nl << stream << ".readValue(" << patcherName << "(" << param << ", ix));"; } else { if(isStack) { - out << nl << "Ice.ObjectPrx[] " << param << "_tmp = new Ice.ObjectPrx[" << param << "_lenx];"; + out << nl << "global::Ice.ObjectPrx[] " << param << "_tmp = new global::Ice.ObjectPrx[" << param << "_lenx];"; } else if(isArray) { - out << "Ice.ObjectPrx[" << param << "_lenx];"; + out << "global::Ice.ObjectPrx[" << param << "_lenx];"; } else if(isCustom) { - out << "global::" << genericType << "();"; + out << "global::" << genericType << "();"; } else { - out << "_System.Collections.Generic." << genericType << "("; + out << "global::System.Collections.Generic." << genericType << "("; if(!isLinkedList) { out << param << "_lenx"; @@ -1385,7 +1484,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "Ice.ObjectPrx val = new Ice.ObjectPrxHelperBase();"; + out << nl << "global::Ice.ObjectPrx val = new global::Ice.ObjectPrxHelperBase();"; out << nl << "val = " << stream << ".readProxy();"; out << nl << param << "." << addMethod << "(val);"; } @@ -1394,8 +1493,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, if(isStack) { - out << nl << "_System.Array.Reverse(" << param << "_tmp);"; - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(" + out << nl << "global::System.Array.Reverse(" << param << "_tmp);"; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">(" << param << "_tmp);"; } } @@ -1486,7 +1585,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, // Stacks cannot contain class instances, so there is no need to marshal a // stack bottom-up here. // - out << nl << "_System.Collections.Generic.IEnumerator<" << typeS + out << nl << "global::System.Collections.Generic.IEnumerator<" << typeS << "> e = " << param << ".GetEnumerator();"; out << nl << "while(e.MoveNext())"; out << sb; @@ -1511,18 +1610,18 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, string patcherName; if(isArray) { - patcherName = "IceInternal.Patcher.arrayReadValue"; + patcherName = "global::IceInternal.Patcher.arrayReadValue"; out << toArrayAlloc(typeS + "[]", "szx") << ";"; } else if(isCustom) { - patcherName = "IceInternal.Patcher.customSeqReadValue"; + patcherName = "global::IceInternal.Patcher.customSeqReadValue"; out << "global::" << genericType << "<" << typeS << ">();"; } else { - patcherName = "IceInternal.Patcher.listReadValue"; - out << "_System.Collections.Generic." << genericType << "<" << typeS << ">(szx);"; + patcherName = "global::IceInternal.Patcher.listReadValue"; + out << "global::System.Collections.Generic." << genericType << "<" << typeS << ">(szx);"; } out << nl << "for(int ix = 0; ix < szx; ++ix)"; out << sb; @@ -1558,7 +1657,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "_System.Collections.Generic.IEnumerator<" << typeS + out << nl << "global::System.Collections.Generic.IEnumerator<" << typeS << "> e = " << param << ".GetEnumerator();"; out << nl << "while(e.MoveNext())"; } @@ -1637,7 +1736,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">("; if(!isLinkedList) { out << "szx"; @@ -1664,8 +1763,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << eb; if(isStack) { - out << nl << "_System.Array.Reverse(" << param << "_tmp);"; - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(" + out << nl << "global::System.Array.Reverse(" << param << "_tmp);"; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">(" << param << "_tmp);"; } out << eb; @@ -1700,7 +1799,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "_System.Collections.Generic.IEnumerator<" << typeS + out << nl << "global::System.Collections.Generic.IEnumerator<" << typeS << "> e = " << param << ".GetEnumerator();"; out << nl << "while(e.MoveNext())"; out << sb; @@ -1736,7 +1835,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">("; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">("; if(!isLinkedList) { out << "szx"; @@ -1758,8 +1857,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << eb; if(isStack) { - out << nl << "_System.Array.Reverse(" << param << "_tmp);"; - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(" + out << nl << "global::System.Array.Reverse(" << param << "_tmp);"; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">(" << param << "_tmp);"; } out << eb; @@ -1803,7 +1902,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << "_System.Collections.Generic.IEnumerator<" << typeS + out << nl << "global::System.Collections.Generic.IEnumerator<" << typeS << "> e = " << param << ".GetEnumerator();"; out << nl << "while(e.MoveNext())"; out << sb; @@ -1840,7 +1939,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } else { - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">();"; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">();"; } out << nl << "for(int ix = 0; ix < szx; ++ix)"; out << sb; @@ -1856,8 +1955,8 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << eb; if(isStack) { - out << nl << "_System.Array.Reverse(" << param << "_tmp);"; - out << nl << param << " = new _System.Collections.Generic." << genericType << "<" << typeS << ">(" + out << nl << "global::System.Array.Reverse(" << param << "_tmp);"; + out << nl << param << " = new global::System.Collections.Generic." << genericType << "<" << typeS << ">(" << param << "_tmp);"; } out << eb; @@ -2387,7 +2486,9 @@ Slice::CsGenerator::MetaDataVisitor::visitUnitStart(const UnitPtr& p) if(s.find(csPrefix) == 0) { static const string csAttributePrefix = csPrefix + "attribute:"; - if(s.find(csAttributePrefix) != 0 || s.size() == csAttributePrefix.size()) + static const string csNamespacePrefix = csPrefix + "namespace:"; + if(!(s.find(csNamespacePrefix) == 0 && s.size() > csNamespacePrefix.size()) && + !(s.find(csAttributePrefix) == 0 && s.size() > csAttributePrefix.size())) { dc->warning(InvalidMetaData, file, -1, "ignoring invalid global metadata `" + oldS + "'"); continue; @@ -2630,6 +2731,15 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont) continue; } } + else if(ModulePtr::dynamicCast(cont)) + { + static const string csNamespacePrefix = csPrefix + "namespace:"; + if(s.find(csNamespacePrefix) == 0 && s.size() > csNamespacePrefix.size()) + { + newLocalMetaData.push_back(s); + continue; + } + } static const string csAttributePrefix = csPrefix + "attribute:"; static const string csTie = csPrefix + "tie"; diff --git a/cpp/src/slice2cs/CsUtil.h b/cpp/src/slice2cs/CsUtil.h index b1cd9a80fe1..3c842d73f43 100644 --- a/cpp/src/slice2cs/CsUtil.h +++ b/cpp/src/slice2cs/CsUtil.h @@ -32,9 +32,24 @@ class CsGenerator : private ::IceUtil::noncopyable // static void validateMetaData(const UnitPtr&); + // + // Returns the namespace of a Contained entity. + // + static std::string getPackage(const ContainedPtr&); + + static std::string getUnqualified(const std::string&, const std::string&, bool builtin = false); + static std::string getUnqualified(const ContainedPtr&, + const std::string& package = "", + const std::string& prefix = "", + const std::string& suffix = ""); + protected: - static std::string getUnqualified(const std::string&, const std::string&); + // + // Returns the namespace prefix of a Contained entity. + // + static std::string getPackagePrefix(const ContainedPtr&); + static std::string resultStructName(const std::string&, const std::string&, bool = false); static std::string resultType(const OperationPtr&, const std::string&, bool = false); static std::string taskResultType(const OperationPtr&, const std::string&, bool = false); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index b5dd7b25c61..e3fdca9b129 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -37,24 +37,24 @@ namespace { string -sliceModeToIceMode(Operation::Mode opMode) +sliceModeToIceMode(Operation::Mode opMode, string package) { string mode; switch(opMode) { case Operation::Normal: { - mode = "Ice.OperationMode.Normal"; + mode = CsGenerator::getUnqualified("Ice.OperationMode.Normal", package); break; } case Operation::Nonmutating: { - mode = "Ice.OperationMode.Nonmutating"; + mode = CsGenerator::getUnqualified("Ice.OperationMode.Nonmutating", package); break; } case Operation::Idempotent: { - mode = "Ice.OperationMode.Idempotent"; + mode = CsGenerator::getUnqualified("Ice.OperationMode.Idempotent", package); break; } default: @@ -67,18 +67,26 @@ sliceModeToIceMode(Operation::Mode opMode) } string -opFormatTypeToString(const OperationPtr& op) +opFormatTypeToString(const OperationPtr& op, string package) { - switch(op->format()) + switch (op->format()) { - case DefaultFormat: - return "Ice.FormatType.DefaultFormat"; - case CompactFormat: - return "Ice.FormatType.CompactFormat"; - case SlicedFormat: - return "Ice.FormatType.SlicedFormat"; - default: - assert(false); + case DefaultFormat: + { + return CsGenerator::getUnqualified("Ice.FormatType.DefaultFormat", package); + } + case CompactFormat: + { + return CsGenerator::getUnqualified("Ice.FormatType.CompactFormat", package); + } + case SlicedFormat: + { + return CsGenerator::getUnqualified("Ice.FormatType.SlicedFormat", package); + } + default: + { + assert(false); + } } return "???"; @@ -107,7 +115,7 @@ emitDeprecate(const ContainedPtr& p1, const ContainedPtr& p2, Output& out, const string reason = getDeprecateReason(p1, p2, type); if(!reason.empty()) { - out << nl << "[_System.Obsolete(\"" << reason << "\")]"; + out << nl << "[global::System.Obsolete(\"" << reason << "\")]"; } } @@ -165,7 +173,7 @@ Slice::CsVisitor::~CsVisitor() void Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const OperationPtr& op, bool marshal, - const string& scope, bool resultStruct, bool publicNames, + const string& package, bool resultStruct, bool publicNames, const string& customStream) { ParamDeclList optionals; @@ -189,7 +197,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const if(!marshal && isClassType(type)) { ostringstream os; - os << '(' << typeToString(type, scope) << " v) => {" << paramPrefix << param << " = v; }"; + os << '(' << typeToString(type, package) << " v) => {" << paramPrefix << param << " = v; }"; param = os.str(); } else @@ -203,7 +211,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const } else { - writeMarshalUnmarshalCode(_out, type, scope, param, marshal, customStream); + writeMarshalUnmarshalCode(_out, type, package, param, marshal, customStream); } } @@ -216,7 +224,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const if(!marshal && isClassType(ret)) { ostringstream os; - os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }"; + os << '(' << typeToString(ret, package) << " v) => {" << paramPrefix << returnValueS << " = v; }"; param = os.str(); } else @@ -226,7 +234,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const if(!op->returnIsOptional()) { - writeMarshalUnmarshalCode(_out, ret, scope, param, marshal, customStream); + writeMarshalUnmarshalCode(_out, ret, package, param, marshal, customStream); } } @@ -255,14 +263,14 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const if(!marshal && isClassType(ret)) { ostringstream os; - os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }"; + os << '(' << typeToString(ret, package) << " v) => {" << paramPrefix << returnValueS << " = v; }"; param = os.str(); } else { param = paramPrefix + returnValueS; } - writeOptionalMarshalUnmarshalCode(_out, ret, scope, param, op->returnTag(), marshal, customStream); + writeOptionalMarshalUnmarshalCode(_out, ret, package, param, op->returnTag(), marshal, customStream); checkReturnType = false; } @@ -271,7 +279,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const if(!marshal && isClassType(type)) { ostringstream os; - os << '(' << typeToString(type, scope) << " v) => {" << paramPrefix << param << " = v; }"; + os << '(' << typeToString(type, package) << " v) => {" << paramPrefix << param << " = v; }"; param = os.str(); } else @@ -279,7 +287,7 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const param = paramPrefix + param; } - writeOptionalMarshalUnmarshalCode(_out, type, scope, param, (*pli)->tag(), marshal, customStream); + writeOptionalMarshalUnmarshalCode(_out, type, package, param, (*pli)->tag(), marshal, customStream); } if(checkReturnType) @@ -288,24 +296,25 @@ Slice::CsVisitor::writeMarshalUnmarshalParams(const ParamDeclList& params, const if(!marshal && isClassType(ret)) { ostringstream os; - os << '(' << typeToString(ret, scope) << " v) => {" << paramPrefix << returnValueS << " = v; }"; + os << '(' << typeToString(ret, package) << " v) => {" << paramPrefix << returnValueS << " = v; }"; param = os.str(); } else { param = paramPrefix + returnValueS; } - writeOptionalMarshalUnmarshalCode(_out, ret, scope, param, op->returnTag(), marshal, customStream); + writeOptionalMarshalUnmarshalCode(_out, ret, package, param, op->returnTag(), marshal, customStream); } } void -Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, const string& scope, bool forStruct) +Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const string& name, const string& package, + bool forStruct) { if(member->optional()) { assert(!forStruct); - writeOptionalMarshalUnmarshalCode(_out, member->type(), scope, name, member->tag(), true, "ostr_"); + writeOptionalMarshalUnmarshalCode(_out, member->type(), package, name, member->tag(), true, "ostr_"); } else { @@ -316,18 +325,19 @@ Slice::CsVisitor::writeMarshalDataMember(const DataMemberPtr& member, const stri memberName = "this." + memberName; } - writeMarshalUnmarshalCode(_out, member->type(), scope, memberName, true, stream); + writeMarshalUnmarshalCode(_out, member->type(), package, memberName, true, stream); } } void -Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, const string& scope, bool forStruct) +Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const string& name, const string& package, + bool forStruct) { string param = name; if(isClassType(member->type())) { ostringstream os; - os << '(' << typeToString(member->type(), scope) << " v) => { this." << name << " = v; }"; + os << '(' << typeToString(member->type(), package) << " v) => { this." << name << " = v; }"; param = os.str(); } else if(forStruct) @@ -338,18 +348,17 @@ Slice::CsVisitor::writeUnmarshalDataMember(const DataMemberPtr& member, const st if(member->optional()) { assert(!forStruct); - writeOptionalMarshalUnmarshalCode(_out, member->type(), scope, param, member->tag(), false, "istr_"); + writeOptionalMarshalUnmarshalCode(_out, member->type(), package, param, member->tag(), false, "istr_"); } else { - writeMarshalUnmarshalCode(_out, member->type(), scope, param, false, forStruct ? "" : "istr_"); + writeMarshalUnmarshalCode(_out, member->type(), package, param, false, forStruct ? "" : "istr_"); } } void Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p) { - const string scope = fixId(p->scope()); ClassList bases = p->bases(); if(!bases.empty() && !bases.front()->isInterface()) { @@ -371,7 +380,8 @@ Slice::CsVisitor::writeInheritedOperations(const ClassDefPtr& p) { string retS; vector params, args; - string name = getDispatchParams(*i, retS, params, args, scope); + string package = getPackage(p); + string name = getDispatchParams(*i, retS, params, args, package); _out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';'; } @@ -384,7 +394,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) { string name = fixId(p->name()); string scoped = p->scoped(); - string scope = fixId(p->scope()); + string package = getPackage(p); ClassList allBases = p->allBases(); StringList ids; ClassList bases = p->bases(); @@ -430,9 +440,9 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override bool ice_isA(string s, " << getUnqualified("Ice.Current", scope) << " current = null)"; + _out << nl << "public override bool ice_isA(string s, " << getUnqualified("Ice.Current", package) << " current = null)"; _out << sb; - _out << nl << "return _System.Array.BinarySearch(_ids, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;"; + _out << nl << "return global::System.Array.BinarySearch(_ids, s, IceUtilInternal.StringUtil.OrdinalStringComparer) >= 0;"; _out << eb; _out << sp; @@ -440,7 +450,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override string[] ice_ids(" << getUnqualified("Ice.Current", scope) << " current = null)"; + _out << nl << "public override string[] ice_ids(" << getUnqualified("Ice.Current", package) << " current = null)"; _out << sb; _out << nl << "return _ids;"; _out << eb; @@ -450,7 +460,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override string ice_id(" << getUnqualified("Ice.Current", scope) << " current = null)"; + _out << nl << "public override string ice_id(" << getUnqualified("Ice.Current", package) << " current = null)"; _out << sb; _out << nl << "return _ids[" << scopedPos << "];"; _out << eb; @@ -483,21 +493,21 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) string opName = op->name(); _out << sp; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1011\")]"; if(!p->isInterface()) { emitGeneratedCodeAttribute(); } - _out << nl << "public static _System.Threading.Tasks.Task<" << getUnqualified("Ice.OutputStream", scope) << ">"; + _out << nl << "public static global::System.Threading.Tasks.Task<" << getUnqualified("Ice.OutputStream", package) << ">"; _out << nl << "iceD_" << opName << "(" << name << (p->isInterface() ? "" : "Disp_") << " obj, " - << "IceInternal.Incoming inS, " << getUnqualified("Ice.Current", scope) << " current)"; + << "global::IceInternal.Incoming inS, " << getUnqualified("Ice.Current", package) << " current)"; _out << sb; TypePtr ret = op->returnType(); ParamDeclList inParams = op->inParameters(); ParamDeclList outParams = op->outParameters(); - _out << nl << getUnqualified("Ice.ObjectImpl", scope) << ".iceCheckMode(" << sliceModeToIceMode(op->mode()) + _out << nl << getUnqualified("Ice.ObjectImpl", package) << ".iceCheckMode(" << sliceModeToIceMode(op->mode(), package) << ", current.mode);"; if(!inParams.empty()) { @@ -508,7 +518,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli) { string param = "iceP_" + (*pli)->name(); - string typeS = typeToString((*pli)->type(), scope, (*pli)->optional()); + string typeS = typeToString((*pli)->type(), package, (*pli)->optional()); const bool isClass = isClassType((*pli)->type()); if((*pli)->optional()) @@ -516,7 +526,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) _out << nl << typeS << ' ' << param; if(isClass) { - _out << " = " << getUnqualified("Ice.Util", scope) << ".None"; + _out << " = " << getUnqualified("Ice.Util", package) << ".None"; } _out << ';'; } @@ -534,7 +544,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) } } } - writeMarshalUnmarshalParams(inParams, 0, false, scope); + writeMarshalUnmarshalParams(inParams, 0, false, package); if(op->sendsClasses(false)) { _out << nl << "istr.readPendingValues();"; @@ -548,7 +558,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) if(op->format() != DefaultFormat) { - _out << nl << "inS.setFormat(" << opFormatTypeToString(op) << ");"; + _out << nl << "inS.setFormat(" << opFormatTypeToString(op, package) << ");"; } vector inArgs; @@ -566,7 +576,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) } else if(amd) { - string retS = resultType(op, scope); + string retS = resultType(op, package); _out << nl << "return inS.setResultTask" << (retS.empty() ? "" : ('<' + retS + '>')); _out << "(obj." << opName << "Async" << spar << inArgs << "current" << epar; if(!retS.empty()) @@ -582,7 +592,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) _out << nl << "(ostr, ret) =>"; } _out << sb; - writeMarshalUnmarshalParams(outParams, op, true, scope, true); + writeMarshalUnmarshalParams(outParams, op, true, package, true); if(op->returnsClasses(false)) { _out << nl << "ostr.writePendingValues();"; @@ -597,7 +607,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) { for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli) { - string typeS = typeToString((*pli)->type(), scope, (*pli)->optional()); + string typeS = typeToString((*pli)->type(), package, (*pli)->optional()); _out << nl << typeS << ' ' << "iceP_" + (*pli)->name() << ";"; } @@ -622,7 +632,7 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) if(!outParams.empty() || ret) { _out << nl << "var ostr = inS.startWriteParams();"; - writeMarshalUnmarshalParams(outParams, op, true, scope); + writeMarshalUnmarshalParams(outParams, op, true, package); if(op->returnsClasses(false)) { _out << nl << "ostr.writePendingValues();"; @@ -667,14 +677,16 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override _System.Threading.Tasks.Task"; - _out << nl << "iceDispatch(IceInternal.Incoming inS, " << getUnqualified("Ice.Current", scope) << " current)"; + _out << nl << "public override global::System.Threading.Tasks.Task<" + << getUnqualified("Ice.OutputStream", package) << ">"; + _out << nl << "iceDispatch(global::IceInternal.Incoming inS, " + << getUnqualified("Ice.Current", package) << " current)"; _out << sb; - _out << nl << "int pos = _System.Array.BinarySearch(_all, current.operation, " - << "IceUtilInternal.StringUtil.OrdinalStringComparer);"; + _out << nl << "int pos = global::System.Array.BinarySearch(_all, current.operation, " + << "global::IceUtilInternal.StringUtil.OrdinalStringComparer);"; _out << nl << "if(pos < 0)"; _out << sb; - _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", scope) + _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", package) << "(current.id, current.facet, current.operation);"; _out << eb; _out << sp << nl << "switch(pos)"; @@ -688,19 +700,23 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) _out << sb; if(opName == "ice_id") { - _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_id(this, inS, current);"; + _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package) + << ".iceD_ice_id(this, inS, current);"; } else if(opName == "ice_ids") { - _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_ids(this, inS, current);"; + _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package) + << ".iceD_ice_ids(this, inS, current);"; } else if(opName == "ice_isA") { - _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_isA(this, inS, current);"; + _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package) + << ".iceD_ice_isA(this, inS, current);"; } else if(opName == "ice_ping") { - _out << nl << "return " << getUnqualified("Ice.ObjectImpl", scope) << ".iceD_ice_ping(this, inS, current);"; + _out << nl << "return " << getUnqualified("Ice.ObjectImpl", package) + << ".iceD_ice_ping(this, inS, current);"; } else { @@ -720,8 +736,8 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) } else { - _out << nl << "return " << getUnqualified(fixId(cl->scoped() + "Disp_"), scope) << ".iceD_" - << opName << "(this, inS, current);"; + _out << nl << "return " << getUnqualified(fixId(cl->scoped() + "Disp_"), package) + << ".iceD_" << opName << "(this, inS, current);"; } break; } @@ -730,8 +746,8 @@ Slice::CsVisitor::writeDispatch(const ClassDefPtr& p) _out << eb; } _out << eb; - _out << sp << nl << "_System.Diagnostics.Debug.Assert(false);"; - _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", scope) + _out << sp << nl << "global::System.Diagnostics.Debug.Assert(false);"; + _out << nl << "throw new " << getUnqualified("Ice.OperationNotExistException", package) << "(current.id, current.facet, current.operation);"; _out << eb; } @@ -747,7 +763,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) { string name = fixId(p->name()); string scoped = p->scoped(); - string scope = fixId(p->scope()); + string package = getPackage(p); ClassList allBases = p->allBases(); StringList ids; ClassList bases = p->bases(); @@ -787,7 +803,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override " << getUnqualified("Ice.SlicedData", scope) << " ice_getSlicedData()"; + _out << nl << "public override " << getUnqualified("Ice.SlicedData", package) << " ice_getSlicedData()"; _out << sb; _out << nl << "return iceSlicedData_;"; _out << eb; @@ -797,7 +813,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)"; + _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", package) << " ostr_)"; _out << sb; _out << nl << "ostr_.startValue(iceSlicedData_);"; _out << nl << "iceWriteImpl(ostr_);"; @@ -809,7 +825,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", scope) << " istr_)"; + _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", package) << " istr_)"; _out << sb; _out << nl << "istr_.startValue();"; _out << nl << "iceReadImpl(istr_);"; @@ -822,19 +838,19 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)"; + _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", package) << " ostr_)"; _out << sb; _out << nl << "ostr_.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");"; for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d) { if(!(*d)->optional()) { - writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope); + writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package); } } for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d) { - writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope); + writeMarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package); } _out << nl << "ostr_.endSlice();"; if(base) @@ -848,19 +864,19 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) { emitGeneratedCodeAttribute(); } - _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", scope) << " istr_)"; + _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", package) << " istr_)"; _out << sb; _out << nl << "istr_.startSlice();"; for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d) { if(!(*d)->optional()) { - writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope); + writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package); } } for(DataMemberList::const_iterator d = optionalMembers.begin(); d != optionalMembers.end(); ++d) { - writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), scope); + writeUnmarshalDataMember(*d, fixId(*d, DotNet::ICloneable, true), package); } _out << nl << "istr_.endSlice();"; if(base) @@ -871,7 +887,7 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) if(preserved && !basePreserved) { - _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", scope) << " iceSlicedData_;"; + _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", package) << " iceSlicedData_;"; } _out << sp << nl << "#endregion"; // Marshalling support @@ -894,7 +910,7 @@ Slice::CsVisitor::getParamAttributes(const ParamDeclPtr& p) } vector -Slice::CsVisitor::getParams(const OperationPtr& op, const string& scope) +Slice::CsVisitor::getParams(const OperationPtr& op, const string& package) { vector params; ParamDeclList paramList = op->parameters(); @@ -906,14 +922,14 @@ Slice::CsVisitor::getParams(const OperationPtr& op, const string& scope) { param += "out "; } - param += typeToString((*q)->type(), scope, (*q)->optional(), cl->isLocal()) + " " + fixId((*q)->name()); + param += typeToString((*q)->type(), package, (*q)->optional(), cl->isLocal()) + " " + fixId((*q)->name()); params.push_back(param); } return params; } vector -Slice::CsVisitor::getInParams(const OperationPtr& op, const string& scope, bool internal) +Slice::CsVisitor::getInParams(const OperationPtr& op, const string& package, bool internal) { vector params; @@ -922,14 +938,14 @@ Slice::CsVisitor::getInParams(const OperationPtr& op, const string& scope, bool ParamDeclList paramList = op->inParameters(); for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q) { - params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), scope, (*q)->optional(), cl->isLocal()) + params.push_back(getParamAttributes(*q) + typeToString((*q)->type(), package, (*q)->optional(), cl->isLocal()) + " " + (internal ? "iceP_" + (*q)->name() : fixId((*q)->name()))); } return params; } vector -Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool returnParam, bool outKeyword) +Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& package, bool returnParam, bool outKeyword) { vector params; if(returnParam) @@ -937,7 +953,7 @@ Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool TypePtr ret = op->returnType(); if(ret) { - params.push_back(typeToString(ret, scope, op->returnIsOptional()) + " ret"); + params.push_back(typeToString(ret, package, op->returnIsOptional()) + " ret"); } } @@ -949,7 +965,7 @@ Slice::CsVisitor::getOutParams(const OperationPtr& op, const string& scope, bool { s += "out "; } - s += typeToString((*q)->type(), scope, (*q)->optional()) + ' ' + fixId((*q)->name()); + s += typeToString((*q)->type(), package, (*q)->optional()) + ' ' + fixId((*q)->name()); params.push_back(s); } @@ -990,7 +1006,7 @@ Slice::CsVisitor::getInArgs(const OperationPtr& op, bool internal) string Slice::CsVisitor::getDispatchParams(const OperationPtr& op, string& retS, vector& params, vector& args, - const string& scope) + const string& package) { string name; ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); // Get the class containing the op. @@ -999,30 +1015,30 @@ Slice::CsVisitor::getDispatchParams(const OperationPtr& op, string& retS, vector if(cl->hasMetaData("amd") || op->hasMetaData("amd")) { name = op->name() + "Async"; - params = getInParams(op, scope); + params = getInParams(op, package); args = getInArgs(op); paramDecls = op->inParameters(); - retS = taskResultType(op, scope, true); + retS = taskResultType(op, package, true); } else if(op->hasMarshaledResult()) { name = fixId(op->name(), DotNet::ICloneable, true); - params = getInParams(op, scope); + params = getInParams(op, package); args = getInArgs(op); paramDecls = op->inParameters(); - retS = resultType(op, scope, true); + retS = resultType(op, package, true); } else { name = fixId(op->name(), DotNet::ICloneable, true); - params = getParams(op, scope); + params = getParams(op, package); args = getArgs(op); paramDecls = op->parameters(); - retS = typeToString(op->returnType(), scope, op->returnIsOptional()); + retS = typeToString(op->returnType(), package, op->returnIsOptional()); } string currentParamName = getEscapedParamName(op, "current"); - params.push_back(getUnqualified("Ice.Current", scope) + " " + currentParamName + " = null"); + params.push_back(getUnqualified("Ice.Current", package) + " " + currentParamName + " = null"); args.push_back(currentParamName); return name; } @@ -1044,13 +1060,13 @@ Slice::CsVisitor::emitAttributes(const ContainedPtr& p) void Slice::CsVisitor::emitComVisibleAttribute() { - _out << nl << "[_System.Runtime.InteropServices.ComVisible(false)]"; + _out << nl << "[global::System.Runtime.InteropServices.ComVisible(false)]"; } void Slice::CsVisitor::emitGeneratedCodeAttribute() { - _out << nl << "[_System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION << "\")]"; + _out << nl << "[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION << "\")]"; } void @@ -1061,20 +1077,20 @@ Slice::CsVisitor::emitPartialTypeAttributes() // FxCop may complain about naming convention violations. These attributes suppress those // warnings, but only when the generated code is compiled with /define:CODE_ANALYSIS. // - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1707\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1709\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1710\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1711\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1715\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1720\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1722\")]"; - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1724\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1704\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1707\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1709\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1710\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1711\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1715\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1716\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1720\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1722\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Naming\", \"CA1724\")]"; } string -Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope) +Slice::CsVisitor::writeValue(const TypePtr& type, const string& package) { assert(type); @@ -1117,7 +1133,7 @@ Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope) EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - return typeToString(type, scope) + "." + fixId((*en->enumerators().begin())->name()); + return typeToString(type, package) + "." + fixId((*en->enumerators().begin())->name()); } StructPtr st = StructPtr::dynamicCast(type); @@ -1129,7 +1145,7 @@ Slice::CsVisitor::writeValue(const TypePtr& type, const string& scope) } else { - return "new " + typeToString(type, scope) + "()"; + return "new " + typeToString(type, package) + "()"; } } @@ -1194,7 +1210,7 @@ Slice::CsVisitor::requiresDataMemberInitializers(const DataMemberList& members) } void -Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, const string& scope, int baseTypes, +Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, const string& package, int baseTypes, bool propertyMapping) { for(DataMemberList::const_iterator p = members.begin(); p != members.end(); ++p) @@ -1217,7 +1233,7 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, con else if((*p)->optional()) { _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " - << typeToString((*p)->type(), scope, true) << "();"; + << typeToString((*p)->type(), package, true) << "();"; } else { @@ -1230,7 +1246,7 @@ Slice::CsVisitor::writeDataMemberInitializers(const DataMemberList& members, con StructPtr st = StructPtr::dynamicCast((*p)->type()); if(st) { - _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString(st, scope, false) + _out << nl << "this." << fixId((*p)->name(), baseTypes) << " = new " << typeToString(st, package, false) << "();"; } } @@ -1892,6 +1908,47 @@ Slice::CsVisitor::writeDocCommentParam(const OperationPtr& p, ParamDir paramType } } +bool +Slice::CsVisitor::visitModuleStart(const ModulePtr& p) +{ + if(!ContainedPtr::dynamicCast(p->container())) + { + string package = getPackage(p); + string name = fixId(p->name()); + if(package != name) + { + vector tokens; + IceUtilInternal::splitString(package, ".", tokens); + for(vector::const_iterator p = tokens.begin(); p != tokens.end(); ++p) + { + _out << sp; + _out << nl << "namespace " << *p; + _out << sb; + } + } + } + return true; +} + +void +Slice::CsVisitor::visitModuleEnd(const ModulePtr& p) +{ + if(!ContainedPtr::dynamicCast(p->container())) + { + string package = getPackage(p); + string name = fixId(p->name()); + if(package != name) + { + vector tokens; + IceUtilInternal::splitString(package, ".", tokens); + for(vector::const_iterator p = tokens.begin(); p != tokens.end(); ++p) + { + _out << eb; + } + } + } +} + Slice::Gen::Gen(const string& base, const vector& includePaths, const string& dir, bool tie, bool impl, bool implTie) : _includePaths(includePaths), @@ -2034,11 +2091,11 @@ Slice::Gen::generateChecksums(const UnitPtr& u) _out << sb; _out << nl << "namespace SliceChecksums"; _out << sb; - _out << nl << "[_System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION + _out << nl << "[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"slice2cs\", \"" << ICE_STRING_VERSION << "\")]"; _out << nl << "public sealed class " << className; _out << sb; - _out << nl << "public static _System.Collections.Hashtable map = new _System.Collections.Hashtable();"; + _out << nl << "public static global::System.Collections.Hashtable map = new global::System.Collections.Hashtable();"; _out << sp << nl << "static " << className << "()"; _out << sb; for(ChecksumMap::const_iterator p = map.begin(); p != map.end(); ++p) @@ -2173,6 +2230,7 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) return false; } + CsVisitor::visitModuleStart(p); string name = fixId(p->name()); _out << sp; emitAttributes(p); @@ -2184,8 +2242,9 @@ Slice::Gen::TypesVisitor::visitModuleStart(const ModulePtr& p) } void -Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::TypesVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -2194,7 +2253,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { string name = p->name(); string scoped = fixId(p->scoped()); - string scope = fixId(p->scope()); + string package = getPackage(p); ClassList bases = p->bases(); bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); @@ -2207,8 +2266,8 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { emitComVisibleAttribute(); OperationPtr o = p->allOperations().front(); - _out << nl << "public delegate " << typeToString(o->returnType(), scope, o->returnIsOptional()) << " "; - _out << fixId(name) << spar << getParams(o, scope) << epar << ";"; + _out << nl << "public delegate " << typeToString(o->returnType(), package, o->returnIsOptional()) << " "; + _out << fixId(name) << spar << getParams(o, package) << epar << ";"; return false; } @@ -2219,22 +2278,22 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "public partial interface " << fixId(name); if(!p->isLocal()) { - baseNames.push_back(getUnqualified("Ice.Object", scope)); + baseNames.push_back(getUnqualified("Ice.Object", package)); baseNames.push_back(name + "Operations_"); } for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q) { - baseNames.push_back(getUnqualified(fixId((*q)->scoped()), scope)); + baseNames.push_back(getUnqualified(*q, package)); } } else { emitComVisibleAttribute(); emitPartialTypeAttributes(); - _out << nl << "[_System.Serializable]"; + _out << nl << "[global::System.Serializable]"; if(p->allOperations().size() > 0) // See bug 4747 { - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1012\")]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1012\")]"; } _out << nl << "public "; if(p->isLocal() && p->allOperations().size() > 0) // Don't use isAbstract() here - see bug 3739 @@ -2247,12 +2306,12 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { if(!p->isLocal()) { - baseNames.push_back("Ice.Value"); + baseNames.push_back(getUnqualified("Ice.Value", package)); } } else { - baseNames.push_back(fixId(bases.front()->scoped())); + baseNames.push_back(getUnqualified(bases.front(), package)); bases.pop_front(); } @@ -2262,7 +2321,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { if((*q)->isAbstract()) { - baseNames.push_back(fixId((*q)->scoped())); + baseNames.push_back(getUnqualified(*q, package)); } } } @@ -2290,7 +2349,7 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { _out << ", "; } - _out << getUnqualified(*q, scope); + _out << *q; } } @@ -2326,7 +2385,7 @@ void Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) { string name = fixId(p->name()); - string scope = fixId(p->scope()); + string package = getPackage(p); DataMemberList classMembers = p->classDataMembers(); DataMemberList allClassMembers = p->allClassDataMembers(); DataMemberList dataMembers = p->dataMembers(); @@ -2368,7 +2427,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) _out << " : base()"; } _out << sb; - writeDataMemberInitializers(dataMembers, scope, DotNet::ICloneable, propertyMapping); + writeDataMemberInitializers(dataMembers, package, DotNet::ICloneable, propertyMapping); _out << nl << "ice_initialize();"; _out << eb; @@ -2379,7 +2438,7 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p) for(DataMemberList::const_iterator d = allDataMembers.begin(); d != allDataMembers.end(); ++d) { string memberName = fixId((*d)->name(), DotNet::ICloneable); - string memberType = typeToString((*d)->type(), scope, (*d)->optional(), p->isLocal(), (*d)->getMetaData()); + string memberType = typeToString((*d)->type(), package, (*d)->optional(), p->isLocal(), (*d)->getMetaData()); paramDecl.push_back(memberType + " " + memberName); } _out << paramDecl << epar; @@ -2457,13 +2516,13 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); bool isLocal = cl->isLocal(); bool isInterface = cl->isInterface(); - string scope = fixId(cl->scope()); + string package = getPackage(cl); if(isLocal) { string name = fixId(p->name(), DotNet::ICloneable, true); TypePtr ret = p->returnType(); - string retS = typeToString(ret, scope, p->returnIsOptional(), true); + string retS = typeToString(ret, package, p->returnIsOptional(), true); _out << sp; if(isInterface) @@ -2481,11 +2540,11 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) { _out << "public abstract "; } - _out << retS << " " << name << spar << getParams(p, scope) << epar << ";"; + _out << retS << " " << name << spar << getParams(p, package) << epar << ";"; if(cl->hasMetaData("async-oneway") || p->hasMetaData("async-oneway")) { - vector inParams = getInParams(p, scope); + vector inParams = getInParams(p, package); ParamDeclList inParamDecls = p->inParameters(); // @@ -2499,14 +2558,14 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) { _out << "public abstract "; } - _out << taskResultType(p, scope); + _out << taskResultType(p, package); string progress = getEscapedParamName(p, "progress"); string cancel = getEscapedParamName(p, "cancel"); _out << " " << name << "Async" << spar << inParams - << ("_System.IProgress " + progress + " = null") - << ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()") + << ("global::System.IProgress " + progress + " = null") + << ("global::System.Threading.CancellationToken " + cancel + " = new global::System.Threading.CancellationToken()") << epar << ";"; // @@ -2520,8 +2579,8 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) { _out << "public abstract "; } - _out << getUnqualified("Ice.AsyncResult", scope) << " begin_" << name << spar << inParams - << getUnqualified("Ice.AsyncCallback", scope) + " " + getEscapedParamName(p, "callback") + " = null" + _out << getUnqualified("Ice.AsyncResult", package) << " begin_" << name << spar << inParams + << getUnqualified("Ice.AsyncCallback", package) + " " + getEscapedParamName(p, "callback") + " = null" << "object " + getEscapedParamName(p, "cookie") + " = null" << epar << ';'; _out << sp; @@ -2532,8 +2591,8 @@ Slice::Gen::TypesVisitor::visitOperation(const OperationPtr& p) { _out << "public abstract "; } - _out << retS << " end_" << name << spar << getOutParams(p, scope, false, true) - << (getUnqualified("Ice.AsyncResult", scope) + " " + getEscapedParamName(p, "asyncResult")) << epar << ';'; + _out << retS << " end_" << name << spar << getOutParams(p, package, false, true) + << (getUnqualified("Ice.AsyncResult", package) + " " + getEscapedParamName(p, "asyncResult")) << epar << ';'; } } } @@ -2550,7 +2609,7 @@ bool Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) { string name = fixId(p->name()); - string scope = fixId(p->scope()); + string package = getPackage(p); ExceptionPtr base = p->base(); _out << sp; @@ -2561,18 +2620,18 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) // // Suppress FxCop diagnostic about a missing constructor MyException(String). // - _out << nl << "[_System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1032\")]"; - _out << nl << "[_System.Serializable]"; + _out << nl << "[global::System.Diagnostics.CodeAnalysis.SuppressMessage(\"Microsoft.Design\", \"CA1032\")]"; + _out << nl << "[global::System.Serializable]"; emitPartialTypeAttributes(); _out << nl << "public partial class " << name << " : "; if(base) { - _out << getUnqualified(fixId(base->scoped()), scope); + _out << getUnqualified(base, package); } else { - _out << getUnqualified(p->isLocal() ? "Ice.LocalException" : "Ice.UserException", scope); + _out << getUnqualified(p->isLocal() ? "Ice.LocalException" : "Ice.UserException", package); } _out << sb; @@ -2588,7 +2647,7 @@ void Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { string name = fixId(p->name()); - string scope = fixId(p->scope()); + string package = getPackage(p); DataMemberList allDataMembers = p->allDataMembers(); DataMemberList dataMembers = p->dataMembers(); DataMemberList allClassMembers = p->allClassDataMembers(); @@ -2599,7 +2658,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) for(DataMemberList::const_iterator q = allDataMembers.begin(); q != allDataMembers.end(); ++q) { string memberName = fixId((*q)->name()); - string memberType = typeToString((*q)->type(), scope, (*q)->optional()); + string memberType = typeToString((*q)->type(), package, (*q)->optional()); allParamDecl.push_back(memberType + " " + memberName); } @@ -2613,7 +2672,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { string memberName = fixId((*q)->name()); - string memberType = typeToString((*q)->type(), scope, (*q)->optional()); + string memberType = typeToString((*q)->type(), package, (*q)->optional()); paramDecl.push_back(memberType + " " + memberName); } @@ -2643,7 +2702,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) emitGeneratedCodeAttribute(); _out << nl << "private void _initDM()"; _out << sb; - writeDataMemberInitializers(dataMembers, scope, DotNet::Exception); + writeDataMemberInitializers(dataMembers, package, DotNet::Exception); _out << eb; } @@ -2659,7 +2718,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public " << name << "(_System.Exception ex) : base(ex)"; + _out << nl << "public " << name << "(global::System.Exception ex) : base(ex)"; _out << sb; if(hasDataMemberInitializers) { @@ -2668,13 +2727,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << eb; _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public " << name << "(_System.Runtime.Serialization.SerializationInfo info, " - << "_System.Runtime.Serialization.StreamingContext context) : base(info, context)"; + _out << nl << "public " << name << "(global::System.Runtime.Serialization.SerializationInfo info, " + << "global::System.Runtime.Serialization.StreamingContext context) : base(info, context)"; _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { string name = fixId((*q)->name(), DotNet::Exception, false); - writeSerializeDeserializeCode(_out, (*q)->type(), scope, name, (*q)->optional(), (*q)->tag(), false); + writeSerializeDeserializeCode(_out, (*q)->type(), package, name, (*q)->optional(), (*q)->tag(), false); } _out << eb; @@ -2712,7 +2771,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) vector exceptionParam; exceptionParam.push_back(exParam); vector exceptionDecl; - exceptionDecl.push_back("_System.Exception " + exParam); + exceptionDecl.push_back("global::System.Exception " + exParam); _out << sp; emitGeneratedCodeAttribute(); _out << nl << "public " << name << spar << allParamDecl << exceptionDecl << epar << " : base" << spar; @@ -2752,7 +2811,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { _out << nl << "int h_ = 5381;"; } - _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");"; + _out << nl << "global::IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");"; writeMemberHashCode(dataMembers, DotNet::Exception); _out << nl << "return h_;"; _out << eb; @@ -2789,13 +2848,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public override void GetObjectData(_System.Runtime.Serialization.SerializationInfo info, " - << "_System.Runtime.Serialization.StreamingContext context)"; + _out << nl << "public override void GetObjectData(global::System.Runtime.Serialization.SerializationInfo info, " + << "global::System.Runtime.Serialization.StreamingContext context)"; _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { string name = fixId((*q)->name(), DotNet::Exception, false); - writeSerializeDeserializeCode(_out, (*q)->type(), scope, name, (*q)->optional(), (*q)->tag(), true); + writeSerializeDeserializeCode(_out, (*q)->type(), package, name, (*q)->optional(), (*q)->tag(), true); } _out << sp << nl << "base.GetObjectData(info, context);"; _out << eb; @@ -2835,14 +2894,14 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) { _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public override " << getUnqualified("Ice.SlicedData", scope) << " ice_getSlicedData()"; + _out << nl << "public override " << getUnqualified("Ice.SlicedData", package) << " ice_getSlicedData()"; _out << sb; _out << nl << "return slicedData_;"; _out << eb; _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)"; + _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", package) << " ostr_)"; _out << sb; _out << nl << "ostr_.startException(slicedData_);"; _out << nl << "iceWriteImpl(ostr_);"; @@ -2851,7 +2910,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", scope) << " istr_)"; + _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", package) << " istr_)"; _out << sb; _out << nl << "istr_.startException();"; _out << nl << "iceReadImpl(istr_);"; @@ -2861,12 +2920,12 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", scope) << " ostr_)"; + _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", package) << " ostr_)"; _out << sb; _out << nl << "ostr_.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");"; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), scope); + writeMarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), package); } _out << nl << "ostr_.endSlice();"; if(base) @@ -2877,13 +2936,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", scope) << " istr_)"; + _out << nl << "protected override void iceReadImpl(" << getUnqualified("Ice.InputStream", package) << " istr_)"; _out << sb; _out << nl << "istr_.startSlice();"; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), scope); + writeUnmarshalDataMember(*q, fixId((*q)->name(), DotNet::Exception), package); } _out << nl << "istr_.endSlice();"; if(base) @@ -2904,7 +2963,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) if(preserved && !basePreserved) { - _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", scope) << " slicedData_;"; + _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", package) << " slicedData_;"; } _out << sp << nl << "#endregion"; // Marshalling support @@ -2917,20 +2976,20 @@ bool Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) { string name = fixId(p->name()); - string scope = fixId(p->scope()); + string package = getPackage(p); _out << sp; emitDeprecate(p, 0, _out, "type"); emitAttributes(p); emitPartialTypeAttributes(); - _out << nl << "[_System.Serializable]"; + _out << nl << "[global::System.Serializable]"; _out << nl << "public partial " << (isValueType(p) ? "struct" : "class") << ' ' << name; StringList baseNames; if(!isValueType(p)) { - baseNames.push_back("_System.ICloneable"); + baseNames.push_back("System.ICloneable"); } // @@ -2955,7 +3014,7 @@ Slice::Gen::TypesVisitor::visitStructStart(const StructPtr& p) { _out << ", "; } - _out << getUnqualified(*q, scope); + _out << getUnqualified(*q, package); } } @@ -2971,6 +3030,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) { string name = fixId(p->name()); string scope = fixId(p->scope()); + string package = getPackage(p); DataMemberList classMembers = p->classDataMembers(); DataMemberList dataMembers = p->dataMembers(); @@ -2994,7 +3054,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) emitGeneratedCodeAttribute(); _out << nl << "public " << name << "()"; _out << sb; - writeDataMemberInitializers(dataMembers, scope, DotNet::ICloneable, propertyMapping); + writeDataMemberInitializers(dataMembers, package, DotNet::ICloneable, propertyMapping); _out << nl << "ice_initialize();"; _out << eb; } @@ -3006,7 +3066,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { string memberName = fixId((*q)->name(), isClass ? DotNet::ICloneable : 0); - string memberType = typeToString((*q)->type(), scope, false, p->isLocal()); + string memberType = typeToString((*q)->type(), package, false, p->isLocal()); paramDecl.push_back(memberType + " " + memberName); } _out << paramDecl << epar; @@ -3051,7 +3111,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << nl << "public override int GetHashCode()"; _out << sb; _out << nl << "int h_ = 5381;"; - _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");"; + _out << nl << "global::IceInternal.HashUtil.hashAdd(ref h_, \"" << p->scoped() << "\");"; writeMemberHashCode(dataMembers, isClass ? DotNet::ICloneable : 0); _out << nl << "return h_;"; _out << eb; @@ -3116,27 +3176,27 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public void ice_writeMembers(" << getUnqualified("Ice.OutputStream", scope) << " ostr)"; + _out << nl << "public void ice_writeMembers(" << getUnqualified("Ice.OutputStream", package) << " ostr)"; _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), scope, true); + writeMarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), package, true); } _out << eb; _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public void ice_readMembers(" << getUnqualified("Ice.InputStream", scope) << " istr)"; + _out << nl << "public void ice_readMembers(" << getUnqualified("Ice.InputStream", package) << " istr)"; _out << sb; for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), scope, true); + writeUnmarshalDataMember(*q, fixId(*q, isClass ? DotNet::ICloneable : 0), package, true); } _out << eb; _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public static void ice_write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << name + _out << nl << "public static void ice_write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << name << " v)"; _out << sb; if(isClass) @@ -3158,7 +3218,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public static " << name << " ice_read(" << getUnqualified("Ice.InputStream", scope) << " istr)"; + _out << nl << "public static " << name << " ice_read(" << getUnqualified("Ice.InputStream", package) << " istr)"; _out << sb; _out << nl << "var v = new " << name << "();"; _out << nl << "v.ice_readMembers(istr);"; @@ -3184,7 +3244,7 @@ void Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) { string name = fixId(p->name()); - string scope = fixId(p->scope()); + string package = getPackage(p); string scoped = fixId(p->scoped()); EnumeratorList enumerators = p->enumerators(); const bool explicitValue = p->explicitValue(); @@ -3216,17 +3276,18 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p) _out << nl << "public sealed class " << p->name() << "Helper"; _out << sb; _out << sp; - _out << nl << "public static void write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << name << " v)"; + _out << nl << "public static void write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << name + << " v)"; _out << sb; - writeMarshalUnmarshalCode(_out, p, scope, "v", true); + writeMarshalUnmarshalCode(_out, p, package, "v", true); _out << eb; _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", scope) << " istr)"; + _out << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", package) << " istr)"; _out << sb; _out << nl << name << " v;"; - writeMarshalUnmarshalCode(_out, p, scope, "v", false); + writeMarshalUnmarshalCode(_out, p, package, "v", false); _out << nl << "return v;"; _out << eb; @@ -3265,7 +3326,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) StructPtr st = StructPtr::dynamicCast(cont); ExceptionPtr ex = ExceptionPtr::dynamicCast(cont); ClassDefPtr cl = ClassDefPtr::dynamicCast(cont); - string scope = fixId(cont->scope()); + string package = getPackage(cont); if(st) { isLocal = st->isLocal(); @@ -3301,7 +3362,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p) emitDeprecate(p, cont, _out, "member"); - string type = typeToString(p->type(), scope, isOptional, isLocal, p->getMetaData()); + string type = typeToString(p->type(), package, isOptional, isLocal, p->getMetaData()); string propertyName = fixId(p->name(), baseTypes, isClass); string dataMemberName; if(isProperty) @@ -3367,7 +3428,7 @@ Slice::Gen::TypesVisitor::writeMemberHashCode(const DataMemberList& dataMembers, { for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { - _out << nl << "IceInternal.HashUtil.hashAdd(ref h_, " << fixId((*q)->name(), baseTypes); + _out << nl << "global::IceInternal.HashUtil.hashAdd(ref h_, " << fixId((*q)->name(), baseTypes); if((*q)->optional()) { _out << ".Value"; @@ -3413,7 +3474,7 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i // // Equals() for generic types does not have value semantics. // - _out << nl << "if(!IceUtilInternal.Collections.SequenceEquals(this." << memberName << ", o." + _out << nl << "if(!global::IceUtilInternal.Collections.SequenceEquals(this." << memberName << ", o." << memberName << "))"; } } @@ -3425,7 +3486,7 @@ Slice::Gen::TypesVisitor::writeMemberEquals(const DataMemberList& dataMembers, i // // Equals() for generic types does not have value semantics. // - _out << nl << "if(!IceUtilInternal.Collections.DictionaryEquals(this." << memberName << ", o." + _out << nl << "if(!global::IceUtilInternal.Collections.DictionaryEquals(this." << memberName << ", o." << memberName << "))"; } else @@ -3498,6 +3559,7 @@ Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p) { if(hasResultType(p)) { + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; return true; @@ -3506,8 +3568,9 @@ Slice::Gen::ResultVisitor::visitModuleStart(const ModulePtr& p) } void -Slice::Gen::ResultVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::ResultVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -3526,7 +3589,7 @@ void Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p) { ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); - string scope = fixId(cl->scope()); + string package = getPackage(cl); if(cl->isLocal()) { return; @@ -3542,7 +3605,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p) string retSName; if(ret) { - retS = typeToString(ret, scope, p->returnIsOptional()); + retS = typeToString(ret, package, p->returnIsOptional()); retSName = resultStructReturnValueName(outParams); } @@ -3560,7 +3623,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p) } for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i) { - _out << (typeToString((*i)->type(), scope, (*i)->optional()) + " " + fixId((*i)->name())); + _out << (typeToString((*i)->type(), package, (*i)->optional()) + " " + fixId((*i)->name())); } _out << epar; @@ -3589,7 +3652,7 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p) for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i) { - _out << nl << "public " << typeToString((*i)->type(), scope, (*i)->optional()) << " " << fixId((*i)->name()) + _out << nl << "public " << typeToString((*i)->type(), package, (*i)->optional()) << " " << fixId((*i)->name()) << ";"; } _out << eb; @@ -3601,18 +3664,18 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p) _out << sp; emitGeneratedCodeAttribute(); - _out << nl << "public struct " << name << " : " << getUnqualified("Ice.MarshaledResult", scope); + _out << nl << "public struct " << name << " : " << getUnqualified("Ice.MarshaledResult", package); _out << sb; // // One shot constructor // - _out << nl << "public " << name << spar << getOutParams(p, scope, true, false) - << getUnqualified("Ice.Current", scope) + " current" << epar; + _out << nl << "public " << name << spar << getOutParams(p, package, true, false) + << getUnqualified("Ice.Current", package) + " current" << epar; _out << sb; - _out << nl << "_ostr = IceInternal.Incoming.createResponseOutputStream(current);"; - _out << nl << "_ostr.startEncapsulation(current.encoding, " << opFormatTypeToString(p) << ");"; - writeMarshalUnmarshalParams(outParams, p, true, scope, false, true, "_ostr"); + _out << nl << "_ostr = global::IceInternal.Incoming.createResponseOutputStream(current);"; + _out << nl << "_ostr.startEncapsulation(current.encoding, " << opFormatTypeToString(p, package) << ");"; + writeMarshalUnmarshalParams(outParams, p, true, package, false, true, "_ostr"); if(p->returnsClasses(false)) { _out << nl << "_ostr.writePendingValues();"; @@ -3620,26 +3683,26 @@ Slice::Gen::ResultVisitor::visitOperation(const OperationPtr& p) _out << nl << "_ostr.endEncapsulation();"; _out << eb; _out << sp; - _out << nl << "public " << getUnqualified("Ice.OutputStream", scope) << " getOutputStream(" - << getUnqualified("Ice.Current", scope) << " current)"; + _out << nl << "public " << getUnqualified("Ice.OutputStream", package) << " getOutputStream(" + << getUnqualified("Ice.Current", package) << " current)"; _out << sb; _out << nl << "if(_ostr == null)"; _out << sb; _out << nl << "return new " << name << spar; if(ret) { - _out << writeValue(ret, scope); + _out << writeValue(ret, package); } for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i) { - _out << writeValue((*i)->type(), scope); + _out << writeValue((*i)->type(), package); } _out << "current" << epar << ".getOutputStream(current);"; _out << eb; _out << nl << "return _ostr;"; _out << eb; _out << sp; - _out << nl << "private " << getUnqualified("Ice.OutputStream", scope) << " _ostr;"; + _out << nl << "private " << getUnqualified("Ice.OutputStream", package) << " _ostr;"; _out << eb; } } @@ -3657,14 +3720,16 @@ Slice::Gen::ProxyVisitor::visitModuleStart(const ModulePtr& p) return false; } + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; return true; } void -Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::ProxyVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -3677,7 +3742,7 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) } string name = p->name(); - string scope = fixId(p->scope()); + string package = getPackage(p); ClassList bases = p->bases(); _out << sp; @@ -3691,13 +3756,13 @@ Slice::Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) ClassDefPtr def = *q; if(def->isInterface() || def->allOperations().size() > 0) { - baseInterfaces.push_back(getUnqualified(fixId((*q)->scoped() + "Prx"), scope)); + baseInterfaces.push_back(getUnqualified(fixId((*q)->scoped() + "Prx"), package)); } } if(baseInterfaces.empty()) { - baseInterfaces.push_back(getUnqualified("Ice.ObjectPrx", scope)); + baseInterfaces.push_back(getUnqualified("Ice.ObjectPrx", package)); } for(vector::const_iterator q = baseInterfaces.begin(); q != baseInterfaces.end();) @@ -3723,11 +3788,11 @@ void Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) { ClassDefPtr cl = ClassDefPtr::dynamicCast(p->container()); - string scope = fixId(cl->scope()); + string package = getPackage(cl); string name = fixId(p->name(), DotNet::ICloneable, true); - vector inParams = getInParams(p, scope); + vector inParams = getInParams(p, package); ParamDeclList inParamDecls = p->inParameters(); - string retS = typeToString(p->returnType(), scope, p->returnIsOptional()); + string retS = typeToString(p->returnType(), package, p->returnIsOptional()); string deprecateReason = getDeprecateReason(p, cl, "operation"); { @@ -3740,11 +3805,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) "The Context map to send with the invocation."); if(!deprecateReason.empty()) { - _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]"; + _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; } - _out << nl << retS << " " << name << spar << getParams(p, scope) - << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " + - getUnqualified("Ice.OptionalContext", scope) + "()") << epar << ';'; + _out << nl << retS << " " << name << spar << getParams(p, package) + << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " + + getUnqualified("Ice.OptionalContext", package) + "()") << epar << ';'; } { @@ -3762,14 +3827,14 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) "A cancellation token that receives the cancellation requests."); if(!deprecateReason.empty()) { - _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]"; + _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; } - _out << nl << taskResultType(p, scope); + _out << nl << taskResultType(p, package); _out << " " << p->name() << "Async" << spar << inParams - << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " + - getUnqualified("Ice.OptionalContext", scope) + "()") - << ("_System.IProgress " + progress + " = null") - << ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()") + << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " + + getUnqualified("Ice.OptionalContext", package) + "()") + << ("global::System.IProgress " + progress + " = null") + << ("global::System.Threading.CancellationToken " + cancel + " = new global::System.Threading.CancellationToken()") << epar << ";"; } @@ -3789,12 +3854,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) "The Context map to send with the invocation."); if(!deprecateReason.empty()) { - _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]"; + _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; } - _out << nl << getUnqualified("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << p->name() << spar + _out << nl << getUnqualified("Ice.AsyncResult", package) << "<" << delType << "> begin_" << p->name() << spar << inParams - << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " + - getUnqualified("Ice.OptionalContext", scope) + "()") << epar << ';'; + << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " + + getUnqualified("Ice.OptionalContext", package) + "()") << epar << ';'; // // Type-unsafe begin_ methods. @@ -3805,10 +3870,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) "Application data to store in the asynchronous result object."); if(!deprecateReason.empty()) { - _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]"; + _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; } - _out << nl << getUnqualified("Ice.AsyncResult", scope) << " begin_" << p->name() << spar << inParams - << getUnqualified("Ice.AsyncCallback", scope) + " " + callback << "object " + cookie << epar << ';'; + _out << nl << getUnqualified("Ice.AsyncResult", package) << " begin_" << p->name() << spar << inParams + << getUnqualified("Ice.AsyncCallback", package) + " " + callback << "object " + cookie << epar << ';'; _out << sp; writeDocCommentAMI(p, InParam, deprecateReason, @@ -3817,11 +3882,11 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) "Application data to store in the asynchronous result object."); if(!deprecateReason.empty()) { - _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]"; + _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; } - _out << nl << getUnqualified("Ice.AsyncResult", scope) << " begin_" << p->name() << spar << inParams - << getUnqualified("Ice.OptionalContext", scope) + " " + context - << getUnqualified("Ice.AsyncCallback", scope) + " " + callback + _out << nl << getUnqualified("Ice.AsyncResult", package) << " begin_" << p->name() << spar << inParams + << getUnqualified("Ice.OptionalContext", package) + " " + context + << getUnqualified("Ice.AsyncCallback", package) + " " + callback << "object " + cookie << epar << ';'; // @@ -3832,10 +3897,10 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) "The asynchronous result object for the invocation."); if(!deprecateReason.empty()) { - _out << nl << "[_System.Obsolete(\"" << deprecateReason << "\")]"; + _out << nl << "[global::System.Obsolete(\"" << deprecateReason << "\")]"; } - _out << nl << retS << " end_" << p->name() << spar << getOutParams(p, scope, false, true) - << getUnqualified("Ice.AsyncResult", scope) + " " + asyncResult << epar << ';'; + _out << nl << retS << " end_" << p->name() << spar << getOutParams(p, package, false, true) + << getUnqualified("Ice.AsyncResult", package) + " " + asyncResult << epar << ';'; } } @@ -3847,14 +3912,16 @@ Slice::Gen::AsyncDelegateVisitor::AsyncDelegateVisitor(IceUtilInternal::Output& bool Slice::Gen::AsyncDelegateVisitor::visitModuleStart(const ModulePtr& p) { + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; return true; } void -Slice::Gen::AsyncDelegateVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::AsyncDelegateVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -3882,9 +3949,9 @@ Slice::Gen::AsyncDelegateVisitor::visitOperation(const OperationPtr& p) return; } - string scope = fixId(cl->scope()); - vector paramDeclAMI = getOutParams(p, scope, false, false); - string retS = typeToString(p->returnType(), scope, p->returnIsOptional()); + string package = getPackage(cl); + vector paramDeclAMI = getOutParams(p, package, false, false); + string retS = typeToString(p->returnType(), package, p->returnIsOptional()); string delName = "Callback_" + cl->name() + "_" + p->name(); _out << sp; @@ -3909,15 +3976,16 @@ Slice::Gen::OpsVisitor::visitModuleStart(const ModulePtr& p) { return false; } - + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; return true; } void -Slice::Gen::OpsVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::OpsVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -3932,7 +4000,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p) return false; } string name = p->name(); - string scope = fixId(p->scope()); + string package = getPackage(p); string scoped = fixId(p->scoped()); ClassList bases = p->bases(); string opIntfName = "Operations"; @@ -3960,7 +4028,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p) } string s = (*q)->scoped(); s += "Operations"; - _out << getUnqualified(fixId(s), scope) << '_'; + _out << getUnqualified(fixId(s), package) << '_'; } ++q; } @@ -3974,7 +4042,7 @@ Slice::Gen::OpsVisitor::visitClassDefStart(const ClassDefPtr& p) bool amd = !p->isLocal() && (p->hasMetaData("amd") || op->hasMetaData("amd")); string retS; vector params, args; - string name = getDispatchParams(op, retS, params, args, scope); + string name = getDispatchParams(op, retS, params, args, package); _out << sp; if(amd) { @@ -4009,14 +4077,16 @@ Slice::Gen::HelperVisitor::visitModuleStart(const ModulePtr& p) return false; } + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; return true; } void -Slice::Gen::HelperVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::HelperVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -4029,14 +4099,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) } string name = p->name(); - string scope = fixId(p->scope()); + string package = getPackage(p); ClassList bases = p->bases(); _out << sp; emitComVisibleAttribute(); emitGeneratedCodeAttribute(); - _out << nl << "[_System.Serializable]"; - _out << nl << "public sealed class " << name << "PrxHelper : " << getUnqualified("Ice.ObjectPrxHelperBase", scope) + _out << nl << "[global::System.Serializable]"; + _out << nl << "public sealed class " << name << "PrxHelper : " << getUnqualified("Ice.ObjectPrxHelperBase", package) << ", " << name << "Prx"; _out << sb; @@ -4046,8 +4116,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb; _out << sp; - _out << nl << "public " << name << "PrxHelper(_System.Runtime.Serialization.SerializationInfo info, " - << "_System.Runtime.Serialization.StreamingContext context) : base(info, context)"; + _out << nl << "public " << name << "PrxHelper(global::System.Runtime.Serialization.SerializationInfo info, " + << "global::System.Runtime.Serialization.StreamingContext context) : base(info, context)"; _out << sb; _out << eb; @@ -4064,9 +4134,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); string opName = fixId(op->name(), DotNet::ICloneable, true); TypePtr ret = op->returnType(); - string retS = typeToString(ret, scope, op->returnIsOptional()); + string retS = typeToString(ret, package, op->returnIsOptional()); - vector params = getParams(op, scope); + vector params = getParams(op, package); vector args = getArgs(op); vector argsAMI = getInArgs(op); @@ -4095,8 +4165,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp; _out << nl << "public " << retS << " " << opName << spar << params - << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " + - getUnqualified("Ice.OptionalContext", scope) + "()") << epar; + << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " + + getUnqualified("Ice.OptionalContext", package) + "()") << epar; _out << sb; _out << nl << "try"; _out << sb; @@ -4119,7 +4189,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) } } _out << "_iceI_" << op->name() << "Async" << spar << argsAMI << context - << "null" << "_System.Threading.CancellationToken.None" << "true" << epar; + << "null" << "global::System.Threading.CancellationToken.None" << "true" << epar; if(ret || outParams.size() > 0) { @@ -4144,7 +4214,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) } } _out << eb; - _out << nl << "catch(_System.AggregateException ex_)"; + _out << nl << "catch(global::System.AggregateException ex_)"; _out << sb; _out << nl << "throw ex_.InnerException;"; _out << eb; @@ -4165,7 +4235,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) OperationPtr op = *r; ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); - vector paramsAMI = getInParams(op, scope); + vector paramsAMI = getInParams(op, package); vector argsAMI = getInArgs(op); string opName = op->name(); @@ -4179,9 +4249,9 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) TypePtr ret = op->returnType(); - string retS = typeToString(ret, scope, op->returnIsOptional()); + string retS = typeToString(ret, package, op->returnIsOptional()); - string returnTypeS = resultType(op, scope); + string returnTypeS = resultType(op, package); ExceptionList throws = op->throws(); throws.sort(); @@ -4203,16 +4273,16 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) // Write the public Async method. // _out << sp; - _out << nl << "public _System.Threading.Tasks.Task"; + _out << nl << "public global::System.Threading.Tasks.Task"; if(!returnTypeS.empty()) { _out << "<" << returnTypeS << ">"; } _out << " " << opName << "Async" << spar << paramsAMI - << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " + - getUnqualified("Ice.OptionalContext", scope) + "()") - << ("_System.IProgress " + progress + " = null") - << ("_System.Threading.CancellationToken " + cancel + " = new _System.Threading.CancellationToken()") + << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " + + getUnqualified("Ice.OptionalContext", package) + "()") + << ("global::System.IProgress " + progress + " = null") + << ("global::System.Threading.CancellationToken " + cancel + " = new global::System.Threading.CancellationToken()") << epar; _out << sb; @@ -4224,15 +4294,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) // Write the Async method implementation. // _out << sp; - _out << nl << "private _System.Threading.Tasks.Task"; + _out << nl << "private global::System.Threading.Tasks.Task"; if(!returnTypeS.empty()) { _out << "<" << returnTypeS << ">"; } - _out << " _iceI_" << opName << "Async" << spar << getInParams(op, scope, true) - << getUnqualified("Ice.OptionalContext", scope) + " context" - << "_System.IProgress progress" - << "_System.Threading.CancellationToken cancel" + _out << " _iceI_" << opName << "Async" << spar << getInParams(op, package, true) + << getUnqualified("Ice.OptionalContext", package) + " context" + << "global::System.IProgress progress" + << "global::System.Threading.CancellationToken cancel" << "bool synchronous" << epar; _out << sb; @@ -4244,12 +4314,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) if(returnTypeS.empty()) { _out << nl << "var completed = " - << "new IceInternal.OperationTaskCompletionCallback(progress, cancel);"; + << "new global::IceInternal.OperationTaskCompletionCallback(progress, cancel);"; } else { _out << nl << "var completed = " - << "new IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress, cancel);"; + << "new global::IceInternal.OperationTaskCompletionCallback<" << returnTypeS << ">(progress, cancel);"; } _out << nl << "_iceI_" << opName << spar << getInArgs(op, true) << "context" << "synchronous" << "completed" @@ -4264,10 +4334,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) // Write the common invoke method // _out << sp << nl; - _out << "private void _iceI_" << op->name() << spar << getInParams(op, scope, true) - << "_System.Collections.Generic.Dictionary context" + _out << "private void _iceI_" << op->name() << spar << getInParams(op, package, true) + << "global::System.Collections.Generic.Dictionary context" << "bool synchronous" - << "IceInternal.OutgoingAsyncCompletionCallback completed" << epar; + << "global::IceInternal.OutgoingAsyncCompletionCallback completed" << epar; _out << sb; if(returnTypeS.empty()) @@ -4282,16 +4352,16 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "outAsync.invoke("; _out.inc(); _out << nl << flatName << ","; - _out << nl << sliceModeToIceMode(op->sendMode()) << ","; - _out << nl << opFormatTypeToString(op) << ","; + _out << nl << sliceModeToIceMode(op->sendMode(), package) << ","; + _out << nl << opFormatTypeToString(op, package) << ","; _out << nl << "context,"; _out << nl << "synchronous"; if(!inParams.empty()) { _out << ","; - _out << nl << "write: (" << getUnqualified("Ice.OutputStream", scope) << " ostr) =>"; + _out << nl << "write: (" << getUnqualified("Ice.OutputStream", package) << " ostr) =>"; _out << sb; - writeMarshalUnmarshalParams(inParams, 0, true, scope); + writeMarshalUnmarshalParams(inParams, 0, true, package); if(op->sendsClasses(false)) { _out << nl << "ostr.writePendingValues();"; @@ -4302,7 +4372,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) if(!throws.empty()) { _out << ","; - _out << nl << "userException: (" << getUnqualified("Ice.UserException", scope) << " ex) =>"; + _out << nl << "userException: (" << getUnqualified("Ice.UserException", package) << " ex) =>"; _out << sb; _out << nl << "try"; _out << sb; @@ -4314,13 +4384,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) // for(ExceptionList::const_iterator i = throws.begin(); i != throws.end(); ++i) { - _out << nl << "catch(" << getUnqualified(fixId((*i)->scoped()), scope) << ")"; + _out << nl << "catch(" << getUnqualified(*i, package) << ")"; _out << sb; _out << nl << "throw;"; _out << eb; } - _out << nl << "catch(" << getUnqualified("Ice.UserException", scope) << ")"; + _out << nl << "catch(" << getUnqualified("Ice.UserException", package) << ")"; _out << sb; _out << eb; @@ -4330,7 +4400,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) if(ret || !outParams.empty()) { _out << ","; - _out << nl << "read: (" << getUnqualified("Ice.InputStream", scope) << " istr) =>"; + _out << nl << "read: (" << getUnqualified("Ice.InputStream", package) << " istr) =>"; _out << sb; if(outParams.empty()) { @@ -4349,7 +4419,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) } else if(isClassType(ret)) { - _out << " = " << getUnqualified("Ice.Util", scope) << ".None"; + _out << " = " << getUnqualified("Ice.Util", package) << ".None"; } _out << ";"; } @@ -4360,14 +4430,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) else { TypePtr t = outParams.front()->type(); - _out << nl << typeToString(t, scope, (outParams.front()->optional())) << " iceP_" + _out << nl << typeToString(t, package, (outParams.front()->optional())) << " iceP_" << outParams.front()->name(); if(!outParams.front()->optional()) { StructPtr st = StructPtr::dynamicCast(t); if(st && isValueType(st)) { - _out << " = " << "new " << typeToString(t, scope) << "()"; + _out << " = " << "new " << typeToString(t, package) << "()"; } else if(isClassType(t) || st) { @@ -4376,12 +4446,12 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) } else if(isClassType(t)) { - _out << " = " << getUnqualified("Ice.Util", scope) << ".None"; + _out << " = " << getUnqualified("Ice.Util", package) << ".None"; } _out << ";"; } - writeMarshalUnmarshalParams(outParams, op, false, scope, true); + writeMarshalUnmarshalParams(outParams, op, false, package, true); if(op->returnsClasses(false)) { _out << nl << "istr.readPendingValues();"; @@ -4413,48 +4483,48 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) OperationPtr op = *r; ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); - vector paramsAMI = getInParams(op, scope); + vector paramsAMI = getInParams(op, package); vector argsAMI = getInArgs(op); string opName = op->name(); ParamDeclList inParams = op->inParameters(); ParamDeclList outParams = op->outParameters(); TypePtr ret = op->returnType(); - string retS = typeToString(ret, scope, op->returnIsOptional()); + string retS = typeToString(ret, package, op->returnIsOptional()); - string returnTypeS = resultType(op, scope); + string returnTypeS = resultType(op, package); // // Write the begin_ methods. // - string clScope = fixId(cl->scope()); - string delType = getUnqualified(clScope + "Callback_" + cl->name() + "_" + op->name(), scope); + string clScope = getPackage(cl); + string delType = getUnqualified(clScope + ".Callback_" + cl->name() + "_" + op->name(), package); string context = getEscapedParamName(op, "context"); string callback = getEscapedParamName(op, "callback"); string cookie = getEscapedParamName(op, "cookie"); _out << sp; - _out << nl << "public " << getUnqualified("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << opName - << spar << paramsAMI << (getUnqualified("Ice.OptionalContext", scope) + " " + context + " = new " + - getUnqualified("Ice.OptionalContext", scope) + "()") << epar; + _out << nl << "public " << getUnqualified("Ice.AsyncResult", package) << "<" << delType << "> begin_" << opName + << spar << paramsAMI << (getUnqualified("Ice.OptionalContext", package) + " " + context + " = new " + + getUnqualified("Ice.OptionalContext", package) + "()") << epar; _out << sb; _out << nl << "return begin_" << opName << spar << argsAMI << context << "null" << "null" << "false" << epar << ';'; _out << eb; _out << sp; - _out << nl << "public " << getUnqualified("Ice.AsyncResult", scope) << " begin_" << opName << spar << paramsAMI - << getUnqualified("Ice.AsyncCallback", scope) + " " + callback << "object " + cookie << epar; + _out << nl << "public " << getUnqualified("Ice.AsyncResult", package) << " begin_" << opName << spar << paramsAMI + << getUnqualified("Ice.AsyncCallback", package) + " " + callback << "object " + cookie << epar; _out << sb; _out << nl << "return begin_" << opName << spar << argsAMI - << "new " + getUnqualified("Ice.OptionalContext", scope) + "()" << callback << cookie << "false" << epar << ';'; + << "new " + getUnqualified("Ice.OptionalContext", package) + "()" << callback << cookie << "false" << epar << ';'; _out << eb; _out << sp; - _out << nl << "public " << getUnqualified("Ice.AsyncResult", scope) + " begin_" << opName << spar << paramsAMI - << getUnqualified("Ice.OptionalContext", scope) + " " + context - << getUnqualified("Ice.AsyncCallback", scope) + " " + callback + _out << nl << "public " << getUnqualified("Ice.AsyncResult", package) + " begin_" << opName << spar << paramsAMI + << getUnqualified("Ice.OptionalContext", package) + " " + context + << getUnqualified("Ice.AsyncCallback", package) + " " + callback << "object " + cookie << epar; _out << sb; _out << nl << "return begin_" << opName << spar << argsAMI << context << callback @@ -4467,19 +4537,19 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) string flatName = "_" + opName + "_name"; string asyncResult = getEscapedParamName(op, "asyncResult"); - _out << sp << nl << "public " << retS << " end_" << opName << spar << getOutParams(op, scope, false, true) - << getUnqualified("Ice.AsyncResult", scope) + " " + asyncResult << epar; + _out << sp << nl << "public " << retS << " end_" << opName << spar << getOutParams(op, package, false, true) + << getUnqualified("Ice.AsyncResult", package) + " " + asyncResult << epar; _out << sb; - _out << nl << "var resultI_ = IceInternal.AsyncResultI.check(" + asyncResult + ", this, " << flatName << ");"; + _out << nl << "var resultI_ = global::IceInternal.AsyncResultI.check(" + asyncResult + ", this, " << flatName << ");"; if(returnTypeS.empty()) { - _out << nl << "((IceInternal.OutgoingAsyncT)resultI_.OutgoingAsync).getResult(resultI_.wait());"; + _out << nl << "((global::IceInternal.OutgoingAsyncT)resultI_.OutgoingAsync).getResult(resultI_.wait());"; } else { - _out << nl << "var outgoing_ = (IceInternal.OutgoingAsyncT<" << returnTypeS << ">)resultI_.OutgoingAsync;"; + _out << nl << "var outgoing_ = (global::IceInternal.OutgoingAsyncT<" << returnTypeS << ">)resultI_.OutgoingAsync;"; if(outParams.empty()) { _out << nl << "return outgoing_.getResult(resultI_.wait());"; @@ -4508,10 +4578,10 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) // Write the common begin_ implementation. // _out << sp; - _out << nl << "private " << getUnqualified("Ice.AsyncResult", scope) << "<" << delType << "> begin_" << opName << spar - << getInParams(op, scope, true) - << "_System.Collections.Generic.Dictionary context" - << getUnqualified("Ice.AsyncCallback", scope) + " completedCallback" << "object cookie" << "bool synchronous" + _out << nl << "private " << getUnqualified("Ice.AsyncResult", package) << "<" << delType << "> begin_" << opName << spar + << getInParams(op, package, true) + << "global::System.Collections.Generic.Dictionary context" + << getUnqualified("Ice.AsyncCallback", package) + " completedCallback" << "object cookie" << "bool synchronous" << epar; _out << sb; @@ -4519,7 +4589,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) { _out << nl << "iceCheckAsyncTwowayOnly(" << flatName << ");"; } - _out << nl << "var completed = new IceInternal.OperationAsyncResultCompletionCallback<" << delType; + _out << nl << "var completed = new global::IceInternal.OperationAsyncResultCompletionCallback<" << delType; _out << ", " << (returnTypeS.empty() ? "object" : returnTypeS); _out << ">("; @@ -4565,7 +4635,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp << nl << "#endregion"; // Asynchronous operations _out << sp << nl << "#region Checked and unchecked cast operations"; - _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope) << " b)"; + _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; @@ -4582,8 +4652,8 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb; _out << sp << nl << "public static " << name - << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope) - << " b, _System.Collections.Generic.Dictionary ctx)"; + << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package) + << " b, global::System.Collections.Generic.Dictionary ctx)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; @@ -4599,14 +4669,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "return r;"; _out << eb; - _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope) + _out << sp << nl << "public static " << name << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b, string f)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; _out << nl << "return null;"; _out << eb; - _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);"; + _out << nl << getUnqualified("Ice.ObjectPrx", package) << " bb = b.ice_facet(f);"; _out << nl << "try"; _out << sb; _out << nl << "if(bb.ice_isA(ice_staticId()))"; @@ -4616,21 +4686,21 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "return h;"; _out << eb; _out << eb; - _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", scope) << ")"; + _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", package) << ")"; _out << sb; _out << eb; _out << nl << "return null;"; _out << eb; _out << sp << nl << "public static " << name - << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", scope) << " b, string f, " - << "_System.Collections.Generic.Dictionary ctx)"; + << "Prx checkedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b, string f, " + << "global::System.Collections.Generic.Dictionary ctx)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; _out << nl << "return null;"; _out << eb; - _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);"; + _out << nl << getUnqualified("Ice.ObjectPrx", package) << " bb = b.ice_facet(f);"; _out << nl << "try"; _out << sb; _out << nl << "if(bb.ice_isA(ice_staticId(), ctx))"; @@ -4640,13 +4710,13 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "return h;"; _out << eb; _out << eb; - _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", scope) << ")"; + _out << nl << "catch(" << getUnqualified("Ice.FacetNotExistException", package) << ")"; _out << sb; _out << eb; _out << nl << "return null;"; _out << eb; - _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", scope) << " b)"; + _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; @@ -4662,14 +4732,14 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "return r;"; _out << eb; - _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", scope) + _out << sp << nl << "public static " << name << "Prx uncheckedCast(" << getUnqualified("Ice.ObjectPrx", package) << " b, string f)"; _out << sb; _out << nl << "if(b == null)"; _out << sb; _out << nl << "return null;"; _out << eb; - _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " bb = b.ice_facet(f);"; + _out << nl << getUnqualified("Ice.ObjectPrx", package) << " bb = b.ice_facet(f);"; _out << nl << name << "PrxHelper h = new " << name << "PrxHelper();"; _out << nl << "h.iceCopyFrom(bb);"; _out << nl << "return h;"; @@ -4719,15 +4789,15 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp << nl << "#region Marshaling support"; - _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << name + _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << name << "Prx v)"; _out << sb; _out << nl << "ostr.writeProxy(v);"; _out << eb; - _out << sp << nl << "public static " << name << "Prx read(" << getUnqualified("Ice.InputStream", scope) << " istr)"; + _out << sp << nl << "public static " << name << "Prx read(" << getUnqualified("Ice.InputStream", package) << " istr)"; _out << sb; - _out << nl << getUnqualified("Ice.ObjectPrx", scope) << " proxy = istr.readProxy();"; + _out << nl << getUnqualified("Ice.ObjectPrx", package) << " proxy = istr.readProxy();"; _out << nl << "if(proxy != null)"; _out << sb; _out << nl << name << "PrxHelper result = new " << name << "PrxHelper();"; @@ -4759,23 +4829,23 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p) return; } - string scope = fixId(p->scope()); - string typeS = typeToString(p, scope); + string package = getPackage(p); + string typeS = typeToString(p, package); _out << sp; emitGeneratedCodeAttribute(); _out << nl << "public sealed class " << p->name() << "Helper"; _out << sb; - _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", scope) << " ostr, " << typeS + _out << sp << nl << "public static void write(" << getUnqualified("Ice.OutputStream", package) << " ostr, " << typeS << " v)"; _out << sb; - writeSequenceMarshalUnmarshalCode(_out, p, scope, "v", true, false); + writeSequenceMarshalUnmarshalCode(_out, p, package, "v", true, false); _out << eb; - _out << sp << nl << "public static " << typeS << " read(" << getUnqualified("Ice.InputStream", scope) << " istr)"; + _out << sp << nl << "public static " << typeS << " read(" << getUnqualified("Ice.InputStream", package) << " istr)"; _out << sb; _out << nl << typeS << " v;"; - writeSequenceMarshalUnmarshalCode(_out, p, scope, "v", false, false); + writeSequenceMarshalUnmarshalCode(_out, p, package, "v", false, false); _out << nl << "return v;"; _out << eb; _out << eb; @@ -4840,10 +4910,10 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) genericType = meta.substr(prefix.size()); } - string scope = fixId(p->scope()); - string keyS = typeToString(key, scope); - string valueS = typeToString(value, scope); - string name = "_System.Collections.Generic." + genericType + "<" + keyS + ", " + valueS + ">"; + string package = getPackage(p); + string keyS = typeToString(key, package); + string valueS = typeToString(value, package); + string name = "global::System.Collections.Generic." + genericType + "<" + keyS + ", " + valueS + ">"; _out << sp; emitGeneratedCodeAttribute(); @@ -4852,7 +4922,7 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) _out << sp << nl << "public static void write("; _out.useCurrentPosAsIndent(); - _out << getUnqualified("Ice.OutputStream", scope) << " ostr,"; + _out << getUnqualified("Ice.OutputStream", package) << " ostr,"; _out << nl << name << " v)"; _out.restoreIndent(); _out << sb; @@ -4863,17 +4933,17 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) _out << nl << "else"; _out << sb; _out << nl << "ostr.writeSize(v.Count);"; - _out << nl << "foreach(_System.Collections."; + _out << nl << "foreach(global::System.Collections."; _out << "Generic.KeyValuePair<" << keyS << ", " << valueS << ">"; _out << " e in v)"; _out << sb; - writeMarshalUnmarshalCode(_out, key, scope, "e.Key", true); - writeMarshalUnmarshalCode(_out, value, scope, "e.Value", true); + writeMarshalUnmarshalCode(_out, key, package, "e.Key", true); + writeMarshalUnmarshalCode(_out, value, package, "e.Value", true); _out << eb; _out << eb; _out << eb; - _out << sp << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", scope) << " istr)"; + _out << sp << nl << "public static " << name << " read(" << getUnqualified("Ice.InputStream", package) << " istr)"; _out << sb; _out << nl << "int sz = istr.readSize();"; _out << nl << name << " r = new " << name << "();"; @@ -4885,20 +4955,20 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) { if(isValueType(st)) { - _out << nl << "k = new " << typeToString(key, scope) << "();"; + _out << nl << "k = new " << typeToString(key, package) << "();"; } else { _out << nl << "k = null;"; } } - writeMarshalUnmarshalCode(_out, key, scope, "k", false); + writeMarshalUnmarshalCode(_out, key, package, "k", false); if(isClassType(value)) { ostringstream os; - os << '(' << typeToString(value, scope) << " v) => { r[k] = v; }"; - writeMarshalUnmarshalCode(_out, value, scope, os.str(), false); + os << '(' << typeToString(value, package) << " v) => { r[k] = v; }"; + writeMarshalUnmarshalCode(_out, value, package, os.str(), false); } else { @@ -4908,14 +4978,14 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p) { if(isValueType(st)) { - _out << nl << "v = new " << typeToString(value, scope) << "();"; + _out << nl << "v = new " << typeToString(value, package) << "();"; } else { _out << nl << "v = null;"; } } - writeMarshalUnmarshalCode(_out, value, scope, "v", false); + writeMarshalUnmarshalCode(_out, value, package, "v", false); _out << nl << "r[k] = v;"; } _out << eb; @@ -4939,14 +5009,16 @@ Slice::Gen::DispatcherVisitor::visitModuleStart(const ModulePtr& p) return false; } + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; return true; } void -Slice::Gen::DispatcherVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::DispatcherVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -4961,8 +5033,8 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) ClassList bases = p->bases(); bool hasBaseClass = !bases.empty() && !bases.front()->isInterface(); string name = p->name(); - string scope = fixId(p->scope()); - string baseClass = getUnqualified("Ice.ObjectImpl", scope); + string package = getPackage(p); + string baseClass = getUnqualified("Ice.ObjectImpl", package); if(hasBaseClass && !bases.front()->allOperations().empty()) { baseClass = fixId(bases.front()->scoped() + "Disp_"); @@ -4992,7 +5064,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) for(ClassList::const_iterator i = allBases.begin(); i != allBases.end(); ++i) { - _out << ", " << getUnqualified(fixId((*i)->scoped()), scope); + _out << ", " << getUnqualified(*i, package); } } @@ -5008,7 +5080,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) { string retS; vector params, args; - string name = getDispatchParams(*i, retS, params, args, scope); + string name = getDispatchParams(*i, retS, params, args, package); _out << sp << nl << "public abstract " << retS << " " << name << spar << params << epar << ';'; } @@ -5032,7 +5104,7 @@ Slice::Gen::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp; emitComVisibleAttribute(); emitGeneratedCodeAttribute(); - _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, " << getUnqualified("Ice.TieBase", scope); + _out << nl << "public class " << name << "Tie_ : " << name << "Disp_, " << getUnqualified("Ice.TieBase", package); _out << sb; @@ -5093,14 +5165,14 @@ Slice::Gen::DispatcherVisitor::visitClassDefEnd(const ClassDefPtr&) void Slice::Gen::DispatcherVisitor::writeTieOperations(const ClassDefPtr& p, NameSet* opNames) { - string scope = fixId(p->scope()); + string package = getPackage(p); OperationList ops = p->operations(); for(OperationList::const_iterator r = ops.begin(); r != ops.end(); ++r) { string retS; vector params; vector args; - string opName = getDispatchParams(*r, retS, params, args, scope); + string opName = getDispatchParams(*r, retS, params, args, package); if(opNames) { if(opNames->find(opName) != opNames->end()) @@ -5149,7 +5221,7 @@ void Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment, bool forTie) { ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container()); - string scope = fixId(cl->scope()); + string package = getPackage(cl); string opName = op->name(); TypePtr ret = op->returnType(); ParamDeclList params = op->parameters(); @@ -5179,8 +5251,8 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment if(!cl->isLocal() && (cl->hasMetaData("amd") || op->hasMetaData("amd"))) { ParamDeclList::const_iterator i; - vector pDecl = getInParams(op, scope); - string resultType = CsGenerator::resultType(op, scope, true); + vector pDecl = getInParams(op, package); + string resultType = CsGenerator::resultType(op, package, true); _out << "public "; if(!forTie) @@ -5188,12 +5260,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment _out << "override "; } - _out << "_System.Threading.Tasks.Task"; + _out << "global::System.Threading.Tasks.Task"; if(!resultType.empty()) { _out << "<" << resultType << ">"; } - _out << " " << opName << "Async" << spar << pDecl << getUnqualified("Ice.Current", scope) + " current = null" + _out << " " << opName << "Async" << spar << pDecl << getUnqualified("Ice.Current", package) + " current = null" << epar; if(comment) @@ -5205,7 +5277,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment _out << sb; if(ret) { - _out << nl << typeToString(ret, scope) << " ret = " << writeValue(ret, scope) << ';'; + _out << nl << typeToString(ret, package) << " ret = " << writeValue(ret, package) << ';'; } for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i) { @@ -5213,13 +5285,13 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment { string name = fixId((*i)->name()); TypePtr type = (*i)->type(); - _out << nl << typeToString(type, scope) << ' ' << name << " = " << writeValue(type, scope) << ';'; + _out << nl << typeToString(type, package) << ' ' << name << " = " << writeValue(type, package) << ';'; } } - _out << nl << "return _System.Threading.Tasks.Task.FromResult"; + _out << nl << "return global::System.Threading.Tasks.Task.FromResult"; if(resultType.empty()) { - _out << "<_System.Object>(null);"; + _out << "(null);"; } else { @@ -5263,9 +5335,9 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment { string retS = op->hasMarshaledResult() ? fixId(cl->scope() + resultStructName(cl->name(), op->name(), true)) : - typeToString(ret, scope); + typeToString(ret, package); - vector pDecls = op->hasMarshaledResult() ? getInParams(op, scope) : getParams(op, scope); + vector pDecls = op->hasMarshaledResult() ? getInParams(op, package) : getParams(op, package); _out << "public "; if(!forTie && !cl->isLocal()) @@ -5275,7 +5347,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment _out << retS << ' ' << fixId(opName, DotNet::ICloneable, true) << spar << pDecls; if(!cl->isLocal()) { - _out << getUnqualified("Ice.Current", scope) + " current = null"; + _out << getUnqualified("Ice.Current", package) + " current = null"; } _out << epar; if(comment) @@ -5290,7 +5362,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment << "("; if(ret) { - _out << writeValue(ret, scope); + _out << writeValue(ret, package); } for(ParamDeclList::const_iterator i = outParams.begin(); i != outParams.end(); ++i) { @@ -5298,7 +5370,7 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment { _out << ", "; } - _out << writeValue((*i)->type(), scope); + _out << writeValue((*i)->type(), package); } _out << ", current);"; } @@ -5308,12 +5380,12 @@ Slice::Gen::BaseImplVisitor::writeOperation(const OperationPtr& op, bool comment { string name = fixId((*i)->name()); TypePtr type = (*i)->type(); - _out << nl << name << " = " << writeValue(type, scope) << ';'; + _out << nl << name << " = " << writeValue(type, package) << ';'; } if(ret) { - _out << nl << "return " << writeValue(ret, scope) << ';'; + _out << nl << "return " << writeValue(ret, package) << ';'; } } _out << eb; @@ -5333,6 +5405,7 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) return false; } + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; @@ -5340,8 +5413,9 @@ Slice::Gen::ImplVisitor::visitModuleStart(const ModulePtr& p) } void -Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::ImplVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } @@ -5401,6 +5475,7 @@ Slice::Gen::ImplTieVisitor::visitModuleStart(const ModulePtr& p) return false; } + CsVisitor::visitModuleStart(p); _out << sp << nl << "namespace " << fixId(p->name()); _out << sb; @@ -5408,8 +5483,9 @@ Slice::Gen::ImplTieVisitor::visitModuleStart(const ModulePtr& p) } void -Slice::Gen::ImplTieVisitor::visitModuleEnd(const ModulePtr&) +Slice::Gen::ImplTieVisitor::visitModuleEnd(const ModulePtr& p) { + CsVisitor::visitModuleEnd(p); _out << eb; } diff --git a/cpp/src/slice2cs/Gen.h b/cpp/src/slice2cs/Gen.h index e2cedb4e52e..61430e16934 100644 --- a/cpp/src/slice2cs/Gen.h +++ b/cpp/src/slice2cs/Gen.h @@ -74,6 +74,10 @@ class CsVisitor : public CsGenerator, public ParserVisitor void writeDocCommentAMD(const OperationPtr&, const std::string&); void writeDocCommentParam(const OperationPtr&, ParamDir, bool); + virtual bool visitModuleStart(const ModulePtr&); + virtual void visitModuleEnd(const ModulePtr&); + + ::IceUtilInternal::Output& _out; }; diff --git a/cpp/test/Ice/scope/AllTests.cpp b/cpp/test/Ice/scope/AllTests.cpp index 624c34a916a..2c2977da6d2 100644 --- a/cpp/test/Ice/scope/AllTests.cpp +++ b/cpp/test/Ice/scope/AllTests.cpp @@ -79,7 +79,7 @@ class Callback : public IceUtil::Shared void check() { IceUtil::Monitor::Lock sync(_m); - while (!_called) + while(!_called) { _m.wait(); } @@ -155,7 +155,7 @@ class Callback : public IceUtil::Shared void check() { IceUtil::Monitor::Lock sync(_m); - while (!_called) + while(!_called) { _m.wait(); } @@ -231,7 +231,95 @@ class Callback : public IceUtil::Shared void check() { IceUtil::Monitor::Lock sync(_m); - while (!_called) + while(!_called) + { + _m.wait(); + } + _called = false; + } + +private: + + IceUtil::Monitor _m; + bool _called; +}; + +} + +} + +} + +namespace Inner +{ + +namespace Test +{ + +namespace Inner2 +{ + +class Callback : public IceUtil::Shared +{ +public: + + Callback() : _called(false) + { + } + + void opS(const ::Test::S& s2, const ::Test::S& s3) + { + test(s2 == s3); + called(); + } + + void opSSeq(const ::Test::SSeq& s2, const ::Test::SSeq& s3) + { + test(s2 == s3); + called(); + } + + void opSMap(const ::Test::SMap& s2, const ::Test::SMap& s3) + { + test(s2 == s3); + called(); + } + + void opC(const ::Test::CPtr& s2, const ::Test::CPtr& s3) + { + test(s2 == s3); + called(); + } + + void opCSeq(const ::Test::CSeq& s2, const ::Test::CSeq& s3) + { + test(s2 == s3); + called(); + } + + void opCMap(const ::Test::CMap& s2, const ::Test::CMap& s3) + { + test(s2 == s3); + called(); + } + + void error(const Ice::Exception& ex) + { + test(false); + } + + void called() + { + IceUtil::Monitor::Lock sync(_m); + assert(!_called); + _called = true; + _m.notify(); + } + + void check() + { + IceUtil::Monitor::Lock sync(_m); + while(!_called) { _m.wait(); } @@ -416,7 +504,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -444,7 +532,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -471,7 +559,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -499,7 +587,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -527,7 +615,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -767,7 +855,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -795,7 +883,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -823,7 +911,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -851,7 +939,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -879,7 +967,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -907,7 +995,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1159,7 +1247,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1187,7 +1275,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1215,7 +1303,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1243,7 +1331,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1271,7 +1359,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1299,7 +1387,7 @@ allTests(Test::TestHelper* helper) { f.get(); } - catch (const exception& ex) + catch(const exception& ex) { cerr << ex.what() << endl; test(false); @@ -1311,9 +1399,9 @@ allTests(Test::TestHelper* helper) // C++ 98 AsyncResult API // { - Test::Inner::Inner2::IPrxPtr i = - ICE_CHECKED_CAST(Test::Inner::Inner2::IPrx, - communicator->stringToProxy("i2:" + helper->getTestEndpoint())); + Test::Inner::IPrxPtr i = + ICE_CHECKED_CAST(Test::Inner::IPrx, + communicator->stringToProxy("i3:" + helper->getTestEndpoint())); Test::Inner::Inner2::S s1; s1.v = 0; @@ -1361,66 +1449,460 @@ allTests(Test::TestHelper* helper) // C++ 98 type safe callbacks // { - Test::Inner::Inner2::IPrxPtr i = - ICE_CHECKED_CAST(Test::Inner::Inner2::IPrx, - communicator->stringToProxy("i2:" + helper->getTestEndpoint())); + Test::Inner::IPrxPtr i = + ICE_CHECKED_CAST(Test::Inner::IPrx, + communicator->stringToProxy("i3:" + helper->getTestEndpoint())); - IceUtil::Handle cb = new Test::Inner::Inner2::Callback(); + IceUtil::Handle cb = new Test::Inner::Callback(); Test::Inner::Inner2::S s1; s1.v = 0; - Test::Inner::Inner2::Callback_I_opSPtr opSCB = - Test::Inner::Inner2::newCallback_I_opS(cb, - &Test::Inner::Inner2::Callback::opS, - &Test::Inner::Inner2::Callback::error); + Test::Inner::Callback_I_opSPtr opSCB = + Test::Inner::newCallback_I_opS(cb, + &Test::Inner::Callback::opS, + &Test::Inner::Callback::error); i->begin_opS(s1, opSCB); cb->check(); Test::Inner::Inner2::SSeq sseq1; sseq1.push_back(s1); - Test::Inner::Inner2::Callback_I_opSSeqPtr opSSeqCB = - Test::Inner::Inner2::newCallback_I_opSSeq(cb, - &Test::Inner::Inner2::Callback::opSSeq, - &Test::Inner::Inner2::Callback::error); + Test::Inner::Callback_I_opSSeqPtr opSSeqCB = + Test::Inner::newCallback_I_opSSeq(cb, + &Test::Inner::Callback::opSSeq, + &Test::Inner::Callback::error); i->begin_opSSeq(sseq1, opSSeqCB); cb->check(); Test::Inner::Inner2::SMap smap1; smap1["a"] = s1; - Test::Inner::Inner2::Callback_I_opSMapPtr opSMapCB = - Test::Inner::Inner2::newCallback_I_opSMap(cb, - &Test::Inner::Inner2::Callback::opSMap, - &Test::Inner::Inner2::Callback::error); + Test::Inner::Callback_I_opSMapPtr opSMapCB = + Test::Inner::newCallback_I_opSMap(cb, + &Test::Inner::Callback::opSMap, + &Test::Inner::Callback::error); i->begin_opSMap(smap1, opSMapCB); cb->check(); Test::Inner::Inner2::CPtr c1 = new Test::Inner::Inner2::C(s1); - Test::Inner::Inner2::Callback_I_opCPtr opCCB = - Test::Inner::Inner2::newCallback_I_opC(cb, - &Test::Inner::Inner2::Callback::opC, - &Test::Inner::Inner2::Callback::error); + Test::Inner::Callback_I_opCPtr opCCB = + Test::Inner::newCallback_I_opC(cb, + &Test::Inner::Callback::opC, + &Test::Inner::Callback::error); i->begin_opC(c1, opCCB); cb->check(); Test::Inner::Inner2::CSeq cseq1; cseq1.push_back(c1); - Test::Inner::Inner2::Callback_I_opCSeqPtr opCSeqCB = - Test::Inner::Inner2::newCallback_I_opCSeq(cb, - &Test::Inner::Inner2::Callback::opCSeq, - &Test::Inner::Inner2::Callback::error); + Test::Inner::Callback_I_opCSeqPtr opCSeqCB = + Test::Inner::newCallback_I_opCSeq(cb, + &Test::Inner::Callback::opCSeq, + &Test::Inner::Callback::error); i->begin_opCSeq(cseq1, opCSeqCB); cb->check(); Test::Inner::Inner2::CMap cmap1; cmap1["a"] = c1; - Test::Inner::Inner2::Callback_I_opCMapPtr opCMapCB = - Test::Inner::Inner2::newCallback_I_opCMap(cb, - &Test::Inner::Inner2::Callback::opCMap, - &Test::Inner::Inner2::Callback::error); + Test::Inner::Callback_I_opCMapPtr opCMapCB = + Test::Inner::newCallback_I_opCMap(cb, + &Test::Inner::Callback::opCMap, + &Test::Inner::Callback::error); + i->begin_opCMap(cmap1, opCMapCB); + cb->check(); + } +#endif + + { + Inner::Test::Inner2::IPrxPtr i = + ICE_CHECKED_CAST(Inner::Test::Inner2::IPrx, communicator->stringToProxy("i4:" + helper->getTestEndpoint())); + + Test::S s1; + s1.v = 0; + Test::S s2; + Test::S s3 = i->opS(s1, s2); + test(s1 == s2); + test(s1 == s3); + + Test::SSeq sseq1; + sseq1.push_back(s1); + Test::SSeq sseq2; + Test::SSeq sseq3 = i->opSSeq(sseq1, sseq2); + test(sseq2 == sseq1); + test(sseq3 == sseq1); + + Test::SMap smap1; + smap1["a"] = s1; + Test::SMap smap2; + Test::SMap smap3 = i->opSMap(smap1, smap2); + test(smap2 == smap1); + test(smap3 == smap1); + + Test::CPtr c1 = ICE_MAKE_SHARED(Test::C, s1); + Test::CPtr c2; + Test::CPtr c3 = i->opC(c1, c2); + test(c2->s == c1->s); + test(c3->s == c1->s); + + Test::CSeq cseq1; + cseq1.push_back(c1); + Test::CSeq cseq2; + Test::CSeq cseq3 = i->opCSeq(cseq1, cseq2); + test(cseq2[0]->s == c1->s); + test(cseq3[0]->s == c1->s); + + Test::CMap cmap1; + cmap1["a"] = c1; + Test::CMap cmap2; + Test::CMap cmap3 = i->opCMap(cmap1, cmap2); + test(cmap2["a"]->s == c1->s); + test(cmap3["a"]->s == c1->s); + } + +#ifdef ICE_CPP11_MAPPING + // + // C++ 11 Future-Based Async Function + // + { + Inner::Test::Inner2::IPrxPtr i = + ICE_CHECKED_CAST(Inner::Test::Inner2::IPrx, communicator->stringToProxy("i4:" + helper->getTestEndpoint())); + + Test::S s1; + s1.v = 0; + { + auto result = i->opSAsync(s1).get(); + test(result.returnValue == s1); + test(result.s2 == s1); + } + + Test::SSeq sseq1; + sseq1.push_back(s1); + { + auto result = i->opSSeqAsync(sseq1).get(); + test(result.returnValue == sseq1); + test(result.s2 == sseq1); + } + + Test::SMap smap1; + smap1["a"] = s1; + { + auto result = i->opSMapAsync(smap1).get(); + test(result.returnValue == smap1); + test(result.s2 == smap1); + } + + Test::CPtr c1 = make_shared(s1); + { + auto result = i->opCAsync(c1).get(); + test(Ice::targetEqualTo(result.returnValue, c1)); + test(Ice::targetEqualTo(result.c2, c1)); + } + + Test::CSeq cseq1; + cseq1.push_back(c1); + { + auto result = i->opCSeqAsync(cseq1).get(); + test(Ice::targetEqualTo(result.returnValue[0], c1)); + test(Ice::targetEqualTo(result.c2[0], c1)); + } + + Test::CMap cmap1; + cmap1["a"] = c1; + { + auto result = i->opCMapAsync(cmap1).get(); + test(Ice::targetEqualTo(result.returnValue["a"], c1)); + test(Ice::targetEqualTo(result.c2["a"], c1)); + } + } + + // + // C++11 Callback-Based Async Function + // + { + Inner::Test::Inner2::IPrxPtr i = + ICE_CHECKED_CAST(Inner::Test::Inner2::IPrx, communicator->stringToProxy("i4:" + helper->getTestEndpoint())); + + Test::S s1; + s1.v = 0; + { + promise p; + auto f = p.get_future(); + auto result = i->opSAsync(s1, + [&p, &s1](Test::S s2, Test::S s3) + { + test(s2 == s1); + test(s3 == s1); + p.set_value(); + }, + [&p](exception_ptr e) + { + p.set_exception(e); + }); + + try + { + f.get(); + } + catch(const exception& ex) + { + cerr << ex.what() << endl; + test(false); + } + } + + Test::SSeq sseq1; + sseq1.push_back(s1); + { + promise p; + auto f = p.get_future(); + auto result = i->opSSeqAsync(sseq1, + [&p, &sseq1](Test::SSeq s2, Test::SSeq s3) + { + test(s2 == sseq1); + test(s3 == sseq1); + p.set_value(); + }, + [&p](exception_ptr e) + { + p.set_exception(e); + }); + + try + { + f.get(); + } + catch(const exception& ex) + { + cerr << ex.what() << endl; + test(false); + } + } + + Test::SMap smap1; + smap1["a"] = s1; + { + promise p; + auto f = p.get_future(); + auto result = i->opSMapAsync(smap1, + [&p, &smap1](Test::SMap s2, Test::SMap s3) + { + test(s2 == smap1); + test(s3 == smap1); + p.set_value(); + }, + [&p](exception_ptr e) + { + p.set_exception(e); + }); + + try + { + f.get(); + } + catch(const exception& ex) + { + cerr << ex.what() << endl; + test(false); + } + } + + auto c1 = make_shared(s1); + { + promise p; + auto f = p.get_future(); + auto result = i->opCAsync(c1, + [&p, &c1](shared_ptr c2, + shared_ptr c3) + { + test(Ice::targetEqualTo(c2, c1)); + test(Ice::targetEqualTo(c3, c1)); + p.set_value(); + }, + [&p](exception_ptr e) + { + p.set_exception(e); + }); + + try + { + f.get(); + } + catch(const exception& ex) + { + cerr << ex.what() << endl; + test(false); + } + } + + Test::CSeq cseq1; + cseq1.push_back(c1); + { + promise p; + auto f = p.get_future(); + auto result = i->opCSeqAsync(cseq1, + [&p, c1](Test::CSeq c2, Test::CSeq c3) + { + test(Ice::targetEqualTo(c2[0], c1)); + test(Ice::targetEqualTo(c3[0], c1)); + p.set_value(); + }, + [&p](exception_ptr e) + { + p.set_exception(e); + }); + + try + { + f.get(); + } + catch(const exception& ex) + { + cerr << ex.what() << endl; + test(false); + } + } + + Test::CMap cmap1; + cmap1["a"] = c1; + { + promise p; + auto f = p.get_future(); + auto result = i->opCMapAsync(cmap1, + [&p, c1](Test::CMap c2, Test::CMap c3) + { + test(Ice::targetEqualTo(c2["a"], c1)); + test(Ice::targetEqualTo(c3["a"], c1)); + p.set_value(); + }, + [&p](exception_ptr e) + { + p.set_exception(e); + }); + + try + { + f.get(); + } + catch(const exception& ex) + { + cerr << ex.what() << endl; + test(false); + } + } + } +#else + // + // C++ 98 AsyncResult API + // + { + Inner::Test::Inner2::IPrxPtr i = + ICE_CHECKED_CAST(Inner::Test::Inner2::IPrx, + communicator->stringToProxy("i4:" + helper->getTestEndpoint())); + + Test::S s1; + s1.v = 0; + + Test::S s2; + Test::S s3 = i->end_opS(s2, i->begin_opS(s1)); + + Test::SSeq sseq1; + sseq1.push_back(s1); + sseq1.push_back(s2); + sseq1.push_back(s3); + + Test::SSeq sseq2; + Test::SSeq sseq3 = i->end_opSSeq(sseq2, i->begin_opSSeq(sseq1)); + + Test::SMap smap1; + smap1["a"] = s1; + smap1["b"] = s2; + smap1["c"] = s3; + + Test::SMap smap2; + Test::SMap smap3 = i->end_opSMap(smap2, i->begin_opSMap(smap1)); + + Test::CPtr c1 = new Test::C(s1); + Test::CPtr c2; + Test::CPtr c3 = i->end_opC(c2, i->begin_opC(c1)); + + Test::CSeq cseq1; + cseq1.push_back(c1); + cseq1.push_back(c2); + cseq1.push_back(c3); + + Test::CSeq cseq2; + Test::CSeq cseq3 = i->end_opCSeq(cseq2, i->begin_opCSeq(cseq1)); + + Test::CMap cmap1; + cmap1["a"] = c1; + cmap1["b"] = c2; + cmap1["c"] = c3; + + Test::CMap cmap2; + Test::CMap cmap3 = i->end_opCMap(cmap2, i->begin_opCMap(cmap1)); + } + // + // C++ 98 type safe callbacks + // + { + Inner::Test::Inner2::IPrxPtr i = + ICE_CHECKED_CAST(Inner::Test::Inner2::IPrx, + communicator->stringToProxy("i4:" + helper->getTestEndpoint())); + + IceUtil::Handle cb = new Inner::Test::Inner2::Callback(); + + Test::S s1; + s1.v = 0; + Inner::Test::Inner2::Callback_I_opSPtr opSCB = + Inner::Test::Inner2::newCallback_I_opS(cb, + &Inner::Test::Inner2::Callback::opS, + &Inner::Test::Inner2::Callback::error); + i->begin_opS(s1, opSCB); + cb->check(); + + Test::SSeq sseq1; + sseq1.push_back(s1); + Inner::Test::Inner2::Callback_I_opSSeqPtr opSSeqCB = + Inner::Test::Inner2::newCallback_I_opSSeq(cb, + &Inner::Test::Inner2::Callback::opSSeq, + &Inner::Test::Inner2::Callback::error); + i->begin_opSSeq(sseq1, opSSeqCB); + cb->check(); + + Test::SMap smap1; + smap1["a"] = s1; + Inner::Test::Inner2::Callback_I_opSMapPtr opSMapCB = + Inner::Test::Inner2::newCallback_I_opSMap(cb, + &Inner::Test::Inner2::Callback::opSMap, + &Inner::Test::Inner2::Callback::error); + i->begin_opSMap(smap1, opSMapCB); + cb->check(); + + Test::CPtr c1 = new Test::C(s1); + Inner::Test::Inner2::Callback_I_opCPtr opCCB = + Inner::Test::Inner2::newCallback_I_opC(cb, + &Inner::Test::Inner2::Callback::opC, + &Inner::Test::Inner2::Callback::error); + i->begin_opC(c1, opCCB); + cb->check(); + + Test::CSeq cseq1; + cseq1.push_back(c1); + Inner::Test::Inner2::Callback_I_opCSeqPtr opCSeqCB = + Inner::Test::Inner2::newCallback_I_opCSeq(cb, + &Inner::Test::Inner2::Callback::opCSeq, + &Inner::Test::Inner2::Callback::error); + i->begin_opCSeq(cseq1, opCSeqCB); + cb->check(); + + Test::CMap cmap1; + cmap1["a"] = c1; + Inner::Test::Inner2::Callback_I_opCMapPtr opCMapCB = + Inner::Test::Inner2::newCallback_I_opCMap(cb, + &Inner::Test::Inner2::Callback::opCMap, + &Inner::Test::Inner2::Callback::error); i->begin_opCMap(cmap1, opCMapCB); cb->check(); } #endif + Test::IPrxPtr i = ICE_CHECKED_CAST(Test::IPrx, communicator->stringToProxy("i1:" + helper->getTestEndpoint())); i->shutdown(); } diff --git a/cpp/test/Ice/scope/Server.cpp b/cpp/test/Ice/scope/Server.cpp index bd0e76ea41d..7b5967b7256 100644 --- a/cpp/test/Ice/scope/Server.cpp +++ b/cpp/test/Ice/scope/Server.cpp @@ -85,6 +85,31 @@ class I3 : public Test::Inner::I virtual void shutdown(const Ice::Current&); }; +class I4 : public Inner::Test::Inner2::I +{ +public: + + virtual Test::S + opS(ICE_IN(Test::S), Test::S&, const Ice::Current&); + + virtual Test::SSeq + opSSeq(ICE_IN(Test::SSeq), Test::SSeq&, const Ice::Current&); + + virtual Test::SMap + opSMap(ICE_IN(Test::SMap), Test::SMap&, const Ice::Current&); + + virtual Test::CPtr + opC(ICE_IN(Test::CPtr), Test::CPtr&, const Ice::Current&); + + virtual Test::CSeq + opCSeq(ICE_IN(Test::CSeq), Test::CSeq&, const Ice::Current&); + + virtual Test::CMap + opCMap(ICE_IN(Test::CMap), Test::CMap&, const Ice::Current&); + + virtual void shutdown(const Ice::Current&); +}; + // // I1 implementation // @@ -235,6 +260,57 @@ I3::shutdown(const Ice::Current& current) current.adapter->getCommunicator()->shutdown(); } +// +// I4 implementation +// +Test::S +I4::opS(ICE_IN(Test::S) s1, Test::S& s2, const Ice::Current&) +{ + s2 = s1; + return s1; +} + +Test::SSeq +I4::opSSeq(ICE_IN(Test::SSeq) s1, Test::SSeq& s2, const Ice::Current&) +{ + s2 = s1; + return s1; +} + +Test::SMap +I4::opSMap(ICE_IN(Test::SMap) s1, Test::SMap& s2, const Ice::Current&) +{ + s2 = s1; + return s1; +} + +Test::CPtr +I4::opC(ICE_IN(Test::CPtr) c1, Test::CPtr& c2, const Ice::Current&) +{ + c2 = c1; + return c1; +} + +Test::CSeq +I4::opCSeq(ICE_IN(Test::CSeq) c1, Test::CSeq& c2, const Ice::Current&) +{ + c2 = c1; + return c1; +} + +Test::CMap +I4::opCMap(ICE_IN(Test::CMap) c1, Test::CMap& c2, const Ice::Current&) +{ + c2 = c1; + return c1; +} + +void +I4::shutdown(const Ice::Current& current) +{ + current.adapter->getCommunicator()->shutdown(); +} + void Server::run(int argc, char** argv) { @@ -244,6 +320,7 @@ Server::run(int argc, char** argv) adapter->add(ICE_MAKE_SHARED(I1), Ice::stringToIdentity("i1")); adapter->add(ICE_MAKE_SHARED(I2), Ice::stringToIdentity("i2")); adapter->add(ICE_MAKE_SHARED(I3), Ice::stringToIdentity("i3")); + adapter->add(ICE_MAKE_SHARED(I4), Ice::stringToIdentity("i4")); adapter->activate(); serverReady(); communicator->waitForShutdown(); diff --git a/cpp/test/Ice/scope/Test.ice b/cpp/test/Ice/scope/Test.ice index fbd505e2ee4..e40116886d3 100644 --- a/cpp/test/Ice/scope/Test.ice +++ b/cpp/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/cpp/test/include/TestHelper.h b/cpp/test/include/TestHelper.h index 8827019d929..84a9cf72889 100644 --- a/cpp/test/include/TestHelper.h +++ b/cpp/test/include/TestHelper.h @@ -259,6 +259,6 @@ runTest(int argc, char* argv[]) #endif -#define test(ex) ((ex) ? ((void)0) : Test::testFailed(#ex, __FILE__, __LINE__)) +#define test(ex) ((ex) ? ((void)0) : ::Test::testFailed(#ex, __FILE__, __LINE__)) #endif diff --git a/csharp/msbuild/ice.net45.test.sln b/csharp/msbuild/ice.net45.test.sln index 9c95baf122a..e1389d8fb82 100644 --- a/csharp/msbuild/ice.net45.test.sln +++ b/csharp/msbuild/ice.net45.test.sln @@ -405,6 +405,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "client", "..\test\Ice\scope EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "server", "..\test\Ice\scope\msbuild\server\net45\server.csproj", "{81A5EA86-74C3-45BD-B04E-FB21983302F2}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packagemd", "packagemd", "{1B87FBB5-12E7-41D8-9135-9D00544508C8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "client", "..\test\Ice\packagemd\msbuild\client\net45\client.csproj", "{2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "server", "..\test\Ice\packagemd\msbuild\server\net45\server.csproj", "{D8F04A5C-9692-4A62-93BD-81483EBEA8F5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -2023,6 +2029,30 @@ Global {81A5EA86-74C3-45BD-B04E-FB21983302F2}.Release|x64.Build.0 = Release|x64 {81A5EA86-74C3-45BD-B04E-FB21983302F2}.Release|x86.ActiveCfg = Release|Win32 {81A5EA86-74C3-45BD-B04E-FB21983302F2}.Release|x86.Build.0 = Release|Win32 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Debug|x64.ActiveCfg = Debug|x64 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Debug|x64.Build.0 = Debug|x64 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Debug|x86.ActiveCfg = Debug|Win32 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Debug|x86.Build.0 = Debug|Win32 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Release|Any CPU.Build.0 = Release|Any CPU + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Release|x64.ActiveCfg = Release|x64 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Release|x64.Build.0 = Release|x64 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Release|x86.ActiveCfg = Release|Win32 + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29}.Release|x86.Build.0 = Release|Win32 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Debug|x64.ActiveCfg = Debug|x64 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Debug|x64.Build.0 = Debug|x64 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Debug|x86.ActiveCfg = Debug|Win32 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Debug|x86.Build.0 = Debug|Win32 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Release|Any CPU.Build.0 = Release|Any CPU + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Release|x64.ActiveCfg = Release|x64 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Release|x64.Build.0 = Release|x64 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Release|x86.ActiveCfg = Release|Win32 + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2221,6 +2251,9 @@ Global {F6EE8CEA-A87E-48C0-9840-A5E3D3C4C51D} = {484370F6-E5AC-4355-8667-4E4E79CEF6FE} {EDF26324-B301-4C47-975E-CD9C3FDE3D50} = {F6EE8CEA-A87E-48C0-9840-A5E3D3C4C51D} {81A5EA86-74C3-45BD-B04E-FB21983302F2} = {F6EE8CEA-A87E-48C0-9840-A5E3D3C4C51D} + {1B87FBB5-12E7-41D8-9135-9D00544508C8} = {484370F6-E5AC-4355-8667-4E4E79CEF6FE} + {2BB1FE54-54EF-4974-9F5D-ABFEC740AE29} = {1B87FBB5-12E7-41D8-9135-9D00544508C8} + {D8F04A5C-9692-4A62-93BD-81483EBEA8F5} = {1B87FBB5-12E7-41D8-9135-9D00544508C8} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {15DF2743-037C-4EFD-A711-205BC13C746F} diff --git a/csharp/msbuild/ice.netstandard2.0.test.sln b/csharp/msbuild/ice.netstandard2.0.test.sln index 06ca80e3cb4..7465c5b6d4d 100644 --- a/csharp/msbuild/ice.netstandard2.0.test.sln +++ b/csharp/msbuild/ice.netstandard2.0.test.sln @@ -764,6 +764,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "client", "..\test\Ice\scope EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "server", "..\test\Ice\scope\msbuild\server\netstandard2.0\server.csproj", "{F67DF0EA-3830-4D17-B60B-0F6BAD76AEAA}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packagemd", "packagemd", "{2988E030-1F8E-490B-B8A3-D1F02073500A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "client", "..\test\Ice\packagemd\msbuild\client\netstandard2.0\client.csproj", "{C56E9BC5-37E6-4001-A45C-D11E64C7385E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "server", "..\test\Ice\packagemd\msbuild\server\netstandard2.0\server.csproj", "{33983EDC-CF67-4697-81D4-AA5337733FE0}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -2334,6 +2340,30 @@ Global {F67DF0EA-3830-4D17-B60B-0F6BAD76AEAA}.Release|x64.Build.0 = Release|Any CPU {F67DF0EA-3830-4D17-B60B-0F6BAD76AEAA}.Release|x86.ActiveCfg = Release|Any CPU {F67DF0EA-3830-4D17-B60B-0F6BAD76AEAA}.Release|x86.Build.0 = Release|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Debug|x64.ActiveCfg = Debug|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Debug|x64.Build.0 = Debug|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Debug|x86.ActiveCfg = Debug|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Debug|x86.Build.0 = Debug|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Release|Any CPU.Build.0 = Release|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Release|x64.ActiveCfg = Release|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Release|x64.Build.0 = Release|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Release|x86.ActiveCfg = Release|Any CPU + {C56E9BC5-37E6-4001-A45C-D11E64C7385E}.Release|x86.Build.0 = Release|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Debug|x64.ActiveCfg = Debug|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Debug|x64.Build.0 = Debug|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Debug|x86.ActiveCfg = Debug|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Debug|x86.Build.0 = Debug|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Release|Any CPU.Build.0 = Release|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Release|x64.ActiveCfg = Release|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Release|x64.Build.0 = Release|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Release|x86.ActiveCfg = Release|Any CPU + {33983EDC-CF67-4697-81D4-AA5337733FE0}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -2719,6 +2749,9 @@ Global {A1152815-0E00-4E4C-B13E-E466550D83AB} = {85BCFA35-57C4-447A-BBD6-C81D2F12AD25} {B4061AF6-374C-4011-9CE7-B9D69F106317} = {A1152815-0E00-4E4C-B13E-E466550D83AB} {F67DF0EA-3830-4D17-B60B-0F6BAD76AEAA} = {A1152815-0E00-4E4C-B13E-E466550D83AB} + {2988E030-1F8E-490B-B8A3-D1F02073500A} = {85BCFA35-57C4-447A-BBD6-C81D2F12AD25} + {C56E9BC5-37E6-4001-A45C-D11E64C7385E} = {2988E030-1F8E-490B-B8A3-D1F02073500A} + {33983EDC-CF67-4697-81D4-AA5337733FE0} = {2988E030-1F8E-490B-B8A3-D1F02073500A} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {647B3637-5175-460B-86AA-95BBD22CDE63} diff --git a/csharp/src/Ice/Instance.cs b/csharp/src/Ice/Instance.cs index 6936f13ef71..136d5208889 100644 --- a/csharp/src/Ice/Instance.cs +++ b/csharp/src/Ice/Instance.cs @@ -672,7 +672,38 @@ public void public Type resolveClass(string id) { - Type c = AssemblyUtil.findType(this, typeToClass(id)); + string className = typeToClass(id); + + Type c = AssemblyUtil.findType(this, className); + + // + // See if the application defined an Ice.Package.MODULE property. + // + if(c == null) + { + int pos = id.IndexOf(':', 2); + if(pos != -1) + { + String topLevelModule = id.Substring(2, pos - 2); + String pkg = _initData.properties.getProperty("Ice.Package." + topLevelModule); + if(pkg.Length > 0) + { + c = AssemblyUtil.findType(this, pkg + "." + className); + } + } + } + + // + // See if the application defined a default package. + // + if(c == null) + { + String pkg = _initData.properties.getProperty("Ice.Default.Package"); + if(pkg.Length > 0) + { + c = AssemblyUtil.findType(this, pkg + "." + className); + } + } // // Ensure the class is instantiable. diff --git a/csharp/test/Ice/packagemd/.gitignore b/csharp/test/Ice/packagemd/.gitignore new file mode 100644 index 00000000000..67872faa673 --- /dev/null +++ b/csharp/test/Ice/packagemd/.gitignore @@ -0,0 +1,7 @@ +// Generated by makegitignore.py + +// IMPORTANT: Do not edit this file -- any edits made here will be lost! +client +server +Test.cpp +Test.h diff --git a/csharp/test/Ice/packagemd/AllTests.cs b/csharp/test/Ice/packagemd/AllTests.cs new file mode 100644 index 00000000000..e8d96095be8 --- /dev/null +++ b/csharp/test/Ice/packagemd/AllTests.cs @@ -0,0 +1,176 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using Test; + +public class AllTests : Test.AllTests +{ + public static InitialPrx allTests(TestHelper helper) + { + var communicator = helper.communicator(); + Console.Out.Write("testing stringToProxy... "); + Console.Out.Flush(); + var @base = communicator.stringToProxy("initial:" + helper.getTestEndpoint(0)); + test(@base != null); + Console.Out.WriteLine("ok"); + + Console.Out.Write("testing checked cast... "); + Console.Out.Flush(); + var initial = InitialPrxHelper.checkedCast(@base); + test(initial != null); + test(initial.Equals(@base)); + Console.Out.WriteLine("ok"); + + { + Console.Out.Write("testing types without package... "); + Console.Out.Flush(); + test.Ice.packagemd.Test1.C1 c1 = initial.getTest1C2AsC1(); + test(c1 != null); + test(c1 is test.Ice.packagemd.Test1.C2); + test.Ice.packagemd.Test1.C2 c2 = initial.getTest1C2AsC2(); + test(c2 != null); + try + { + initial.throwTest1E2AsE1(); + test(false); + } + catch(test.Ice.packagemd.Test1.E1 ex) + { + test(ex is test.Ice.packagemd.Test1.E2); + } + try + { + initial.throwTest1E2AsE2(); + test(false); + } + catch(test.Ice.packagemd.Test1.E2) + { + // Expected + } + try + { + initial.throwTest1Notify(); + test(false); + } + catch(test.Ice.packagemd.Test1.@notify) + { + // Expected + } + Console.Out.WriteLine("ok"); + } + + { + Console.Out.Write("testing types with package... "); + Console.Out.Flush(); + + { + try + { + initial.throwTest2E2AsE1(); + test(false); + } + catch(Ice.UnknownUserException) + { + // Expected + } + catch(Ice.MarshalException) + { + // Expected + } + catch(test.Ice.packagemd.testpkg.Test2.E1) + { + test(false); + } + try + { + initial.throwTest2E2AsE2(); + test(false); + } + catch(Ice.UnknownUserException) + { + // Expected + } + catch(Ice.MarshalException) + { + // Expected + } + catch(test.Ice.packagemd.testpkg.Test2.E1) + { + test(false); + } + } + + { + // + // Define Ice.Package.Test2=testpkg and try again. + // + communicator.getProperties().setProperty("Ice.Package.Test2", "test.Ice.packagemd.testpkg"); + test.Ice.packagemd.testpkg.Test2.C1 c1 = initial.getTest2C2AsC1(); + test(c1 != null); + test(c1 is test.Ice.packagemd.testpkg.Test2.C2); + test.Ice.packagemd.testpkg.Test2.C2 c2 = initial.getTest2C2AsC2(); + test(c2 != null); + try + { + initial.throwTest2E2AsE1(); + test(false); + } + catch (test.Ice.packagemd.testpkg.Test2.E1 ex) + { + test(ex is test.Ice.packagemd.testpkg.Test2.E2); + } + try + { + initial.throwTest2E2AsE2(); + test(false); + } + catch(test.Ice.packagemd.testpkg.Test2.E2) + { + // Expected + } + } + + { + // + // Define Ice.Default.Package=testpkg and try again. We can't retrieve + // the Test2.* types again (with this communicator) because factories + // have already been cached for them, so now we use the Test3.* types. + // + communicator.getProperties().setProperty("Ice.Default.Package", "test.Ice.packagemd.modpkg"); + test.Ice.packagemd.modpkg.Test3.C1 c1 = initial.getTest3C2AsC1(); + test(c1 != null); + test(c1 is test.Ice.packagemd.modpkg.Test3.C2); + test.Ice.packagemd.modpkg.Test3.C2 c2 = initial.getTest3C2AsC2(); + test(c2 != null); + try + { + initial.throwTest3E2AsE1(); + test(false); + } + catch (test.Ice.packagemd.modpkg.Test3.E1 ex) + { + test(ex is test.Ice.packagemd.modpkg.Test3.E2); + } + try + { + initial.throwTest3E2AsE2(); + test(false); + } + catch (test.Ice.packagemd.modpkg.Test3.E2) + { + // Expected + } + } + + Console.Out.WriteLine("ok"); + } + return initial; + } +} \ No newline at end of file diff --git a/csharp/test/Ice/packagemd/Client.cs b/csharp/test/Ice/packagemd/Client.cs new file mode 100644 index 00000000000..b7897cfff2b --- /dev/null +++ b/csharp/test/Ice/packagemd/Client.cs @@ -0,0 +1,38 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IceTest")] +[assembly: AssemblyDescription("Ice test")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Client : Test.TestHelper +{ + override public void run(string[] args) + { + Ice.Properties properties = createTestProperties(ref args); + properties.setProperty("Ice.Warn.Dispatch", "0"); + properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); + properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); + using (var communicator = initialize(properties)) + { + var initial = AllTests.allTests(this); + initial.shutdown(); + } + } + + public static int Main(string[] args) + { + return Test.TestDriver.runTest(args); + } +} diff --git a/csharp/test/Ice/packagemd/InitialI.cs b/csharp/test/Ice/packagemd/InitialI.cs new file mode 100644 index 00000000000..1490f0ac075 --- /dev/null +++ b/csharp/test/Ice/packagemd/InitialI.cs @@ -0,0 +1,87 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + + +using Ice; +using test.Ice.packagemd.modpkg.Test3; +using test.Ice.packagemd.Test1; +using test.Ice.packagemd.testpkg.Test2; + +public class InitialI : Test.InitialDisp_ +{ + public override test.Ice.packagemd.Test1.C1 getTest1C2AsC1(Current current = null) + { + return new test.Ice.packagemd.Test1.C2(); + } + + public override test.Ice.packagemd.Test1.C2 getTest1C2AsC2(Current current = null) + { + return new test.Ice.packagemd.Test1.C2(); + } + + public override test.Ice.packagemd.testpkg.Test2.C1 getTest2C2AsC1(Current current = null) + { + return new test.Ice.packagemd.testpkg.Test2.C2(); + } + + public override test.Ice.packagemd.testpkg.Test2.C2 getTest2C2AsC2(Current current = null) + { + return new test.Ice.packagemd.testpkg.Test2.C2(); + } + + public override test.Ice.packagemd.modpkg.Test3.C1 getTest3C2AsC1(Current current = null) + { + return new test.Ice.packagemd.modpkg.Test3.C2(); + } + + public override test.Ice.packagemd.modpkg.Test3.C2 getTest3C2AsC2(Current current = null) + { + return new test.Ice.packagemd.modpkg.Test3.C2(); + } + + public override void shutdown(Current current = null) + { + current.adapter.getCommunicator().shutdown(); + } + + public override void throwTest1E2AsE1(Current current = null) + { + throw new test.Ice.packagemd.Test1.E2(); + } + + public override void throwTest1E2AsE2(Current current = null) + { + throw new test.Ice.packagemd.Test1.E2(); + } + + public override void throwTest1Notify(Current current = null) + { + throw new test.Ice.packagemd.Test1.@notify(); + } + + public override void throwTest2E2AsE1(Current current = null) + { + throw new test.Ice.packagemd.testpkg.Test2.E2(); + } + + public override void throwTest2E2AsE2(Current current = null) + { + throw new test.Ice.packagemd.testpkg.Test2.E2(); + } + + public override void throwTest3E2AsE1(Current current = null) + { + throw new test.Ice.packagemd.modpkg.Test3.E2(); + } + + public override void throwTest3E2AsE2(Current current = null) + { + throw new test.Ice.packagemd.modpkg.Test3.E2(); + } +} \ No newline at end of file diff --git a/csharp/test/Ice/packagemd/NoPackage.ice b/csharp/test/Ice/packagemd/NoPackage.ice new file mode 100644 index 00000000000..f3bc2476bf4 --- /dev/null +++ b/csharp/test/Ice/packagemd/NoPackage.ice @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +[["cs:namespace:test.Ice.packagemd"]] +module Test1 +{ +class C1 +{ + int i; +} + +class C2 extends C1 +{ + long l; +} + +exception E1 +{ + int i; +} + +exception E2 extends E1 +{ + long l; +} + +exception notify /* Test keyword escape. */ +{ + int i; +} +} diff --git a/csharp/test/Ice/packagemd/Package.ice b/csharp/test/Ice/packagemd/Package.ice new file mode 100644 index 00000000000..7987773ead2 --- /dev/null +++ b/csharp/test/Ice/packagemd/Package.ice @@ -0,0 +1,59 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +[["cs:namespace:test.Ice.packagemd.testpkg"]] + +module Test2 +{ +class C1 +{ + int i; +} + +class C2 extends C1 +{ + long l; +} + +exception E1 +{ + int i; +} + +exception E2 extends E1 +{ + long l; +} +} + +["cs:namespace:test.Ice.packagemd.modpkg"] +module Test3 +{ +class C1 +{ + int i; +} + +class C2 extends C1 +{ + long l; +} + +exception E1 +{ + int i; +} + +exception E2 extends E1 +{ + long l; +} +} diff --git a/csharp/test/Ice/packagemd/Server.cs b/csharp/test/Ice/packagemd/Server.cs new file mode 100644 index 00000000000..bf5252fc4fb --- /dev/null +++ b/csharp/test/Ice/packagemd/Server.cs @@ -0,0 +1,40 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +using System; +using System.Reflection; + +[assembly: CLSCompliant(true)] + +[assembly: AssemblyTitle("IceTest")] +[assembly: AssemblyDescription("Ice test")] +[assembly: AssemblyCompany("ZeroC, Inc.")] + +public class Server : Test.TestHelper +{ + public override void run(string[] args) + { + Ice.Properties properties = createTestProperties(ref args); + properties.setProperty("Ice.Package.Test", "test.Ice.packagemd"); + properties.setProperty("Ice.Package.Test1", "test.Ice.packagemd"); + using (var communicator = initialize(properties)) + { + properties.setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); + var adapter = communicator.createObjectAdapter("TestAdapter"); + adapter.add(new InitialI(), Ice.Util.stringToIdentity("initial")); + adapter.activate(); + communicator.waitForShutdown(); + } + } + + public static int Main(string[] args) + { + return Test.TestDriver.runTest(args); + } +} diff --git a/csharp/test/Ice/packagemd/Test.ice b/csharp/test/Ice/packagemd/Test.ice new file mode 100644 index 00000000000..01fbbec0e16 --- /dev/null +++ b/csharp/test/Ice/packagemd/Test.ice @@ -0,0 +1,39 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2018 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#pragma once + +#include +#include + +module Test +{ + +interface Initial +{ + Test1::C1 getTest1C2AsC1(); + Test1::C2 getTest1C2AsC2(); + void throwTest1E2AsE1() throws Test1::E1; + void throwTest1E2AsE2() throws Test1::E2; + void throwTest1Notify() throws Test1::notify; + + Test2::C1 getTest2C2AsC1(); + Test2::C2 getTest2C2AsC2(); + void throwTest2E2AsE1() throws Test2::E1; + void throwTest2E2AsE2() throws Test2::E2; + + Test3::C1 getTest3C2AsC1(); + Test3::C2 getTest3C2AsC2(); + void throwTest3E2AsE1() throws Test3::E1; + void throwTest3E2AsE2() throws Test3::E2; + + void shutdown(); +} + +} diff --git a/csharp/test/Ice/scope/AllTests.cs b/csharp/test/Ice/scope/AllTests.cs index 17e4ae4ef32..73ae2a479ca 100644 --- a/csharp/test/Ice/scope/AllTests.cs +++ b/csharp/test/Ice/scope/AllTests.cs @@ -266,6 +266,89 @@ public static void allTests(TestHelper helper) }).Wait(); } + { + Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + Inner.Test.Inner2.IPrx i = Inner.Test.Inner2.IPrxHelper.checkedCast(obj); + + Test.S s1 = new Test.S(0); + Test.S s2; + Test.S s3 = i.opS(s1, out s2); + test(s2.Equals(s1)); + test(s3.Equals(s1)); + + Test.S[] sseq1 = new Test.S[] { s1 }; + Test.S[] sseq2; + Test.S[] sseq3 = i.opSSeq(sseq1, out sseq2); + test(sseq2[0].Equals(s1)); + test(sseq3[0].Equals(s1)); + + Dictionary smap1 = new Dictionary(); + smap1["a"] = s1; + Dictionary smap2; + Dictionary smap3 = i.opSMap(smap1, out smap2); + test(smap2["a"].Equals(s1)); + test(smap3["a"].Equals(s1)); + + Test.C c1 = new Test.C(s1); + Test.C c2; + Test.C c3 = i.opC(c1, out c2); + test(c2.s.Equals(c1.s)); + test(c3.s.Equals(c1.s)); + + Test.C[] cseq1 = new Test.C[] { c1 }; + Test.C[] cseq2; + Test.C[] cseq3 = i.opCSeq(cseq1, out cseq2); + test(cseq2[0].s.Equals(s1)); + test(cseq3[0].s.Equals(s1)); + + Dictionary cmap1 = new Dictionary(); + cmap1["a"] = c1; + Dictionary cmap2; + Dictionary cmap3 = i.opCMap(cmap1, out cmap2); + test(cmap2["a"].s.Equals(s1)); + test(cmap3["a"].s.Equals(s1)); + } + + { + Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + Inner.Test.Inner2.IPrx i = Inner.Test.Inner2.IPrxHelper.checkedCast(obj); + + Task.Run(async () => + { + Test.S s1 = new Test.S(0); + Inner.Test.Inner2.I_OpSResult opSResult = await i.opSAsync(s1); + test(s1.Equals(opSResult.returnValue)); + test(s1.Equals(opSResult.s2)); + + Test.S[] sseq1 = new Test.S[] { s1 }; + Inner.Test.Inner2.I_OpSSeqResult opSSeqResult = await i.opSSeqAsync(sseq1); + test(opSSeqResult.returnValue[0].Equals(s1)); + test(opSSeqResult.s2[0].Equals(s1)); + + Dictionary smap1 = new Dictionary(); + smap1["a"] = s1; + Inner.Test.Inner2.I_OpSMapResult opSMapResult = await i.opSMapAsync(smap1); + test(opSMapResult.returnValue["a"].Equals(s1)); + test(opSMapResult.s2["a"].Equals(s1)); + + Test.C c1 = new Test.C(s1); + Inner.Test.Inner2.I_OpCResult opCResult = await i.opCAsync(c1); + test(c1.s.Equals(opCResult.returnValue.s)); + test(c1.s.Equals(opCResult.c2.s)); + + Test.C[] cseq1 = new Test.C[] { c1 }; + Inner.Test.Inner2.I_OpCSeqResult opCSeqResult = await i.opCSeqAsync(cseq1); + test(opCSeqResult.returnValue[0].s.Equals(s1)); + test(opCSeqResult.c2[0].s.Equals(s1)); + + Dictionary cmap1 = new Dictionary(); + cmap1["a"] = c1; + Inner.Test.Inner2.I_OpCMapResult opCMapResult = await i.opCMapAsync(cmap1); + test(opCMapResult.returnValue["a"].s.Equals(s1)); + test(opCMapResult.c2["a"].s.Equals(s1)); + }).Wait(); + } + { Ice.ObjectPrx obj = communicator.stringToProxy("i1:" + helper.getTestEndpoint()); IPrx i = IPrxHelper.checkedCast(obj); diff --git a/csharp/test/Ice/scope/Server.cs b/csharp/test/Ice/scope/Server.cs index 1480dd0c028..d814fcbc6ea 100644 --- a/csharp/test/Ice/scope/Server.cs +++ b/csharp/test/Ice/scope/Server.cs @@ -87,7 +87,8 @@ public override Test.Inner.Inner2.S[] } public override Dictionary - opSMap(Dictionary s1, out Dictionary s2, Ice.Current current) + opSMap(Dictionary s1, out Dictionary s2, + Ice.Current current) { s2 = s1; return s1; @@ -108,7 +109,8 @@ public override Test.Inner.Inner2.C[] } public override Dictionary - opCMap(Dictionary c1, out Dictionary c2, Ice.Current current) + opCMap(Dictionary c1, out Dictionary c2, + Ice.Current current) { c2 = c1; return c1; @@ -138,7 +140,8 @@ public override Test.Inner.Inner2.S[] } public override Dictionary - opSMap(Dictionary s1, out Dictionary s2, Ice.Current current) + opSMap(Dictionary s1, out Dictionary s2, + Ice.Current current) { s2 = s1; return s1; @@ -159,7 +162,8 @@ public override Test.Inner.Inner2.C[] } public override Dictionary - opCMap(Dictionary c1, out Dictionary c2, Ice.Current current) + opCMap(Dictionary c1, out Dictionary c2, + Ice.Current current) { c2 = c1; return c1; @@ -172,6 +176,58 @@ public void shutdown(Ice.Current current) } } + class I4 : Inner.Test.Inner2.IDisp_ + { + public override Test.S + opS(Test.S s1, out Test.S s2, Ice.Current current) + { + s2 = s1; + return s1; + } + + public override Test.S[] + opSSeq(Test.S[] s1, out Test.S[] s2, Ice.Current current) + { + s2 = s1; + return s1; + } + + public override Dictionary + opSMap(Dictionary s1, out Dictionary s2, + Ice.Current current) + { + s2 = s1; + return s1; + } + + public override Test.C + opC(Test.C c1, out Test.C c2, Ice.Current current) + { + c2 = c1; + return c1; + } + + public override Test.C[] + opCSeq(Test.C[] c1, out Test.C[] c2, Ice.Current current) + { + c2 = c1; + return c1; + } + + public override Dictionary + opCMap(Dictionary c1, out Dictionary c2, + Ice.Current current) + { + c2 = c1; + return c1; + } + + public override void shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } + } + public override void run(string[] args) { Ice.Properties properties = createTestProperties(ref args); @@ -182,6 +238,7 @@ public override void run(string[] args) adapter.add(new I1(), Ice.Util.stringToIdentity("i1")); adapter.add(new I2(), Ice.Util.stringToIdentity("i2")); adapter.add(new I3(), Ice.Util.stringToIdentity("i3")); + adapter.add(new I4(), Ice.Util.stringToIdentity("i4")); adapter.activate(); communicator.waitForShutdown(); } diff --git a/csharp/test/Ice/scope/Test.ice b/csharp/test/Ice/scope/Test.ice index 667d680ccc5..f207bbb9f10 100644 --- a/csharp/test/Ice/scope/Test.ice +++ b/csharp/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/java-compat/test/src/main/java/test/Ice/scope/AllTests.java b/java-compat/test/src/main/java/test/Ice/scope/AllTests.java index 4e6db75321e..ef1b549ab2c 100644 --- a/java-compat/test/src/main/java/test/Ice/scope/AllTests.java +++ b/java-compat/test/src/main/java/test/Ice/scope/AllTests.java @@ -880,6 +880,276 @@ public void check() } } + { + Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + test.Ice.scope.Inner.Test.Inner2.IPrx i = test.Ice.scope.Inner.Test.Inner2.IPrxHelper.checkedCast(obj); + + test.Ice.scope.Test.S s1 = new test.Ice.scope.Test.S(0); + test.Ice.scope.Test.SHolder s2 = new test.Ice.scope.Test.SHolder(); + test.Ice.scope.Test.S s3 = i.opS(s1, s2); + test(s1.equals(s2.value)); + test(s1.equals(s3)); + + test.Ice.scope.Test.S[] sseq1 = new test.Ice.scope.Test.S[]{ s1 }; + test.Ice.scope.Test.SSeqHolder sseq2 = new test.Ice.scope.Test.SSeqHolder(); + test.Ice.scope.Test.S[] sseq3 = i.opSSeq(sseq1, sseq2); + test(sseq2.value[0].equals(s1)); + test(sseq3[0].equals(s1)); + + java.util.Map smap1 = new java.util.HashMap(); + smap1.put("a", s1); + test.Ice.scope.Test.SMapHolder smap2 = new test.Ice.scope.Test.SMapHolder(); + java.util.Map smap3 = i.opSMap(smap1, smap2); + test(smap2.value.get("a").equals(s1)); + test(smap3.get("a").equals(s1)); + + test.Ice.scope.Test.C c1 = new test.Ice.scope.Test.C(s1); + test.Ice.scope.Test.CHolder c2 = new test.Ice.scope.Test.CHolder(); + test.Ice.scope.Test.C c3 = i.opC(c1, c2); + test(c1.s.equals(c2.value.s)); + test(c1.s.equals(c3.s)); + + test.Ice.scope.Test.C[] cseq1 = new test.Ice.scope.Test.C[]{ c1 }; + test.Ice.scope.Test.CSeqHolder cseq2 = new test.Ice.scope.Test.CSeqHolder(); + test.Ice.scope.Test.C[] cseq3 = i.opCSeq(cseq1, cseq2); + test(cseq2.value[0].s.equals(s1)); + test(cseq3[0].s.equals(s1)); + + java.util.Map cmap1 = new java.util.HashMap(); + cmap1.put("a", c1); + test.Ice.scope.Test.CMapHolder cmap2 = new test.Ice.scope.Test.CMapHolder(); + java.util.Map cmap3 = i.opCMap(cmap1, cmap2); + test(cmap2.value.get("a").s.equals(s1)); + test(cmap3.get("a").s.equals(s1)); + } + + { + Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + test.Ice.scope.Inner.Test.Inner2.IPrx i = test.Ice.scope.Inner.Test.Inner2.IPrxHelper.checkedCast(obj); + + test.Ice.scope.Test.S s1 = new test.Ice.scope.Test.S(0); + test.Ice.scope.Test.SHolder s2 = new test.Ice.scope.Test.SHolder(); + test.Ice.scope.Test.S s3 = i.end_opS(s2, i.begin_opS(s1)); + test(s1.equals(s2.value)); + test(s1.equals(s3)); + + test.Ice.scope.Test.S[] sseq1 = new test.Ice.scope.Test.S[]{ s1 }; + test.Ice.scope.Test.SSeqHolder sseq2 = new test.Ice.scope.Test.SSeqHolder(); + test.Ice.scope.Test.S[] sseq3 = i.end_opSSeq(sseq2, i.begin_opSSeq(sseq1)); + test(sseq2.value[0].equals(s1)); + test(sseq3[0].equals(s1)); + + java.util.Map smap1 = new java.util.HashMap(); + smap1.put("a", s1); + test.Ice.scope.Test.SMapHolder smap2 = new test.Ice.scope.Test.SMapHolder(); + java.util.Map smap3 = i.end_opSMap(smap2, i.begin_opSMap(smap1)); + test(smap2.value.get("a").equals(s1)); + test(smap3.get("a").equals(s1)); + + test.Ice.scope.Test.C c1 = new test.Ice.scope.Test.C(s1); + test.Ice.scope.Test.CHolder c2 = new test.Ice.scope.Test.CHolder(); + test.Ice.scope.Test.C c3 = i.end_opC(c2, i.begin_opC(c1)); + test(c1.s.equals(c2.value.s)); + test(c1.s.equals(c3.s)); + + test.Ice.scope.Test.C[] cseq1 = new test.Ice.scope.Test.C[]{ c1 }; + test.Ice.scope.Test.CSeqHolder cseq2 = new test.Ice.scope.Test.CSeqHolder(); + test.Ice.scope.Test.C[] cseq3 = i.end_opCSeq(cseq2, i.begin_opCSeq(cseq1)); + test(cseq2.value[0].s.equals(s1)); + test(cseq3[0].s.equals(s1)); + + java.util.Map cmap1 = new java.util.HashMap(); + cmap1.put("a", c1); + test.Ice.scope.Test.CMapHolder cmap2 = new test.Ice.scope.Test.CMapHolder(); + java.util.Map cmap3 = i.end_opCMap(cmap2, i.begin_opCMap(cmap1)); + test(cmap2.value.get("a").s.equals(s1)); + test(cmap3.get("a").s.equals(s1)); + } + + { + Ice.ObjectPrx obj = communicator.stringToProxy("i3:" + helper.getTestEndpoint()); + test.Ice.scope.Test.Inner.Inner2.IPrx i = test.Ice.scope.Test.Inner.Inner2.IPrxHelper.checkedCast(obj); + + final test.Ice.scope.Test.Inner.Inner2.S s1 = new test.Ice.scope.Test.Inner.Inner2.S(0); + { + class OpSCallback extends test.Ice.scope.Test.Inner.Inner2.Callback_I_opS + { + public void response(test.Ice.scope.Test.Inner.Inner2.S s2, + test.Ice.scope.Test.Inner.Inner2.S s3) + { + test(s1.equals(s2)); + test(s1.equals(s3)); + _callback.called(); + } + + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + _callback.check(); + } + + private Callback _callback = new Callback(); + } + OpSCallback cb = new OpSCallback(); + i.begin_opS(s1, cb); + cb.check(); + } + + test.Ice.scope.Test.Inner.Inner2.S[] sseq1 = new test.Ice.scope.Test.Inner.Inner2.S[]{ s1 }; + { + class OpSSeqCallback extends test.Ice.scope.Test.Inner.Inner2.Callback_I_opSSeq + { + public void response(test.Ice.scope.Test.Inner.Inner2.S[] s2, + test.Ice.scope.Test.Inner.Inner2.S[] s3) + { + test(s1.equals(s2[0])); + test(s1.equals(s3[0])); + _callback.called(); + } + + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + _callback.check(); + } + + private Callback _callback = new Callback(); + } + OpSSeqCallback cb = new OpSSeqCallback(); + i.begin_opSSeq(sseq1, cb); + cb.check(); + } + + java.util.Map smap1 = + new java.util.HashMap(); + smap1.put("a", s1); + { + class OpSMapCallback extends test.Ice.scope.Test.Inner.Inner2.Callback_I_opSMap + { + public void response(java.util.Map s2, + java.util.Map s3) + { + test(s1.equals(s2.get("a"))); + test(s1.equals(s3.get("a"))); + _callback.called(); + } + + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + _callback.check(); + } + + private Callback _callback = new Callback(); + } + OpSMapCallback cb = new OpSMapCallback(); + i.begin_opSMap(smap1, cb); + cb.check(); + } + + test.Ice.scope.Test.Inner.Inner2.C c1 = new test.Ice.scope.Test.Inner.Inner2.C(s1); + { + class OpCCallback extends test.Ice.scope.Test.Inner.Inner2.Callback_I_opC + { + public void response(test.Ice.scope.Test.Inner.Inner2.C c2, + test.Ice.scope.Test.Inner.Inner2.C c3) + { + test(s1.equals(c2.s)); + test(s1.equals(c3.s)); + _callback.called(); + } + + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + _callback.check(); + } + + private Callback _callback = new Callback(); + } + OpCCallback cb = new OpCCallback(); + i.begin_opC(c1, cb); + cb.check(); + } + + test.Ice.scope.Test.Inner.Inner2.C[] cseq1 = + new test.Ice.scope.Test.Inner.Inner2.C[]{ c1 }; + { + class OpCSeqCallback extends test.Ice.scope.Test.Inner.Inner2.Callback_I_opCSeq + { + public void response(test.Ice.scope.Test.Inner.Inner2.C[] c2, + test.Ice.scope.Test.Inner.Inner2.C[] c3) + { + test(s1.equals(c2[0].s)); + test(s1.equals(c3[0].s)); + _callback.called(); + } + + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + _callback.check(); + } + + private Callback _callback = new Callback(); + } + OpCSeqCallback cb = new OpCSeqCallback(); + i.begin_opCSeq(cseq1, cb); + cb.check(); + } + + java.util.Map cmap1 = + new java.util.HashMap(); + cmap1.put("a", c1); + { + class OpCMapCallback extends test.Ice.scope.Test.Inner.Inner2.Callback_I_opCMap + { + public void response(java.util.Map c2, + java.util.Map c3) + { + test(s1.equals(c2.get("a").s)); + test(s1.equals(c3.get("a").s)); + _callback.called(); + } + + public void exception(Ice.LocalException ex) + { + test(false); + } + + public void check() + { + _callback.check(); + } + + private Callback _callback = new Callback(); + } + OpCMapCallback cb = new OpCMapCallback(); + i.begin_opCMap(cmap1, cb); + cb.check(); + } + } + { Ice.ObjectPrx obj = communicator.stringToProxy("i1:" + helper.getTestEndpoint()); test.Ice.scope.Test.IPrx i = test.Ice.scope.Test.IPrxHelper.checkedCast(obj); diff --git a/java-compat/test/src/main/java/test/Ice/scope/Server.java b/java-compat/test/src/main/java/test/Ice/scope/Server.java index fcca0a57298..6040f321b81 100644 --- a/java-compat/test/src/main/java/test/Ice/scope/Server.java +++ b/java-compat/test/src/main/java/test/Ice/scope/Server.java @@ -190,6 +190,56 @@ public void shutdown(Ice.Current current) } } + class I4 extends test.Ice.scope.Inner.Test.Inner2._IDisp + { + public test.Ice.scope.Test.S + opS(test.Ice.scope.Test.S s1, test.Ice.scope.Test.SHolder s2, Ice.Current current) + { + s2.value = s1; + return s1; + } + + public test.Ice.scope.Test.S[] + opSSeq(test.Ice.scope.Test.S[] s1, test.Ice.scope.Test.SSeqHolder s2, Ice.Current current) + { + s2.value = s1; + return s1; + } + + public java.util.Map + opSMap(java.util.Map s1, test.Ice.scope.Test.SMapHolder s2, Ice.Current current) + { + s2.value = s1; + return s1; + } + + public test.Ice.scope.Test.C + opC(test.Ice.scope.Test.C c1, test.Ice.scope.Test.CHolder c2, Ice.Current current) + { + c2.value = c1; + return c1; + } + + public test.Ice.scope.Test.C[] + opCSeq(test.Ice.scope.Test.C[] c1, test.Ice.scope.Test.CSeqHolder c2, Ice.Current current) + { + c2.value = c1; + return c1; + } + + public java.util.Map + opCMap(java.util.Map c1, test.Ice.scope.Test.CMapHolder c2, Ice.Current current) + { + c2.value = c1; + return c1; + } + + public void shutdown(Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } + } + public void run(String[] args) { Ice.Properties properties = createTestProperties(args); @@ -201,6 +251,7 @@ public void run(String[] args) adapter.add(new I1(), Ice.Util.stringToIdentity("i1")); adapter.add(new I2(), Ice.Util.stringToIdentity("i2")); adapter.add(new I3(), Ice.Util.stringToIdentity("i3")); + adapter.add(new I4(), Ice.Util.stringToIdentity("i4")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/java-compat/test/src/main/java/test/Ice/scope/Test.ice b/java-compat/test/src/main/java/test/Ice/scope/Test.ice index 94eac462d02..1b177702140 100644 --- a/java-compat/test/src/main/java/test/Ice/scope/Test.ice +++ b/java-compat/test/src/main/java/test/Ice/scope/Test.ice @@ -114,3 +114,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/java/test/src/main/java/test/Ice/scope/AllTests.java b/java/test/src/main/java/test/Ice/scope/AllTests.java index f86a298cca9..66dd6e3d307 100644 --- a/java/test/src/main/java/test/Ice/scope/AllTests.java +++ b/java/test/src/main/java/test/Ice/scope/AllTests.java @@ -256,6 +256,43 @@ public static void allTests(test.TestHelper helper) test(opCMapResult.c2.get("a").s.equals(s1)); } + { + com.zeroc.Ice.ObjectPrx obj = communicator.stringToProxy("i4:" + helper.getTestEndpoint()); + test.Ice.scope.Inner.Test.Inner2.IPrx i = test.Ice.scope.Inner.Test.Inner2.IPrx.checkedCast(obj); + + test.Ice.scope.Test.S s1 = new test.Ice.scope.Test.S(0); + test.Ice.scope.Inner.Test.Inner2.I.OpSResult opSResult = i.opSAsync(s1).join(); + test(s1.equals(opSResult.returnValue)); + test(s1.equals(opSResult.s2)); + + test.Ice.scope.Test.S[] sseq1 = new test.Ice.scope.Test.S[]{ s1 }; + test.Ice.scope.Inner.Test.Inner2.I.OpSSeqResult opSSeqResult = i.opSSeqAsync(sseq1).join(); + test(opSSeqResult.returnValue[0].equals(s1)); + test(opSSeqResult.s2[0].equals(s1)); + + java.util.Map smap1 = new java.util.HashMap(); + smap1.put("a", s1); + test.Ice.scope.Inner.Test.Inner2.I.OpSMapResult opSMapResult = i.opSMapAsync(smap1).join(); + test(opSMapResult.returnValue.get("a").equals(s1)); + test(opSMapResult.s2.get("a").equals(s1)); + + test.Ice.scope.Test.C c1 = new test.Ice.scope.Test.C(s1); + test.Ice.scope.Inner.Test.Inner2.I.OpCResult opCResult = i.opCAsync(c1).join(); + test(c1.s.equals(opCResult.returnValue.s)); + test(c1.s.equals(opCResult.c2.s)); + + test.Ice.scope.Test.C[] cseq1 = new test.Ice.scope.Test.C[]{ c1 }; + test.Ice.scope.Inner.Test.Inner2.I.OpCSeqResult opCSeqResult = i.opCSeqAsync(cseq1).join(); + test(opCSeqResult.returnValue[0].s.equals(s1)); + test(opCSeqResult.c2[0].s.equals(s1)); + + java.util.Map cmap1 = new java.util.HashMap(); + cmap1.put("a", c1); + test.Ice.scope.Inner.Test.Inner2.I.OpCMapResult opCMapResult = i.opCMapAsync(cmap1).join(); + test(opCMapResult.returnValue.get("a").s.equals(s1)); + test(opCMapResult.c2.get("a").s.equals(s1)); + } + { test.Ice.scope.Test.IPrx i = test.Ice.scope.Test.IPrx.checkedCast(communicator.stringToProxy("i1:" + helper.getTestEndpoint())); diff --git a/java/test/src/main/java/test/Ice/scope/Server.java b/java/test/src/main/java/test/Ice/scope/Server.java index 3f0baf668ff..9fe5e5ae64c 100644 --- a/java/test/src/main/java/test/Ice/scope/Server.java +++ b/java/test/src/main/java/test/Ice/scope/Server.java @@ -201,6 +201,72 @@ public void shutdown(com.zeroc.Ice.Current current) } } + class I4 implements test.Ice.scope.Inner.Test.Inner2.I + { + public test.Ice.scope.Inner.Test.Inner2.I.OpSResult + opS(test.Ice.scope.Test.S s1, com.zeroc.Ice.Current current) + { + test.Ice.scope.Inner.Test.Inner2.I.OpSResult result = new test.Ice.scope.Inner.Test.Inner2.I.OpSResult(); + result.returnValue = s1; + result.s2 = s1; + return result; + } + + public test.Ice.scope.Inner.Test.Inner2.I.OpSSeqResult + opSSeq(test.Ice.scope.Test.S[] s1, com.zeroc.Ice.Current current) + { + test.Ice.scope.Inner.Test.Inner2.I.OpSSeqResult result = + new test.Ice.scope.Inner.Test.Inner2.I.OpSSeqResult(); + result.returnValue = s1; + result.s2 = s1; + return result; + } + + public test.Ice.scope.Inner.Test.Inner2.I.OpSMapResult + opSMap(java.util.Map s1, com.zeroc.Ice.Current current) + { + test.Ice.scope.Inner.Test.Inner2.I.OpSMapResult result = + new test.Ice.scope.Inner.Test.Inner2.I.OpSMapResult(); + result.returnValue = s1; + result.s2 = s1; + return result; + } + + public test.Ice.scope.Inner.Test.Inner2.I.OpCResult + opC(test.Ice.scope.Test.C c1, com.zeroc.Ice.Current current) + { + test.Ice.scope.Inner.Test.Inner2.I.OpCResult result = new test.Ice.scope.Inner.Test.Inner2.I.OpCResult(); + result.returnValue = c1; + result.c2 = c1; + return result; + } + + public test.Ice.scope.Inner.Test.Inner2.I.OpCSeqResult + opCSeq(test.Ice.scope.Test.C[] c1, com.zeroc.Ice.Current current) + { + test.Ice.scope.Inner.Test.Inner2.I.OpCSeqResult result = + new test.Ice.scope.Inner.Test.Inner2.I.OpCSeqResult(); + result.returnValue = c1; + result.c2 = c1; + return result; + } + + public test.Ice.scope.Inner.Test.Inner2.I.OpCMapResult + opCMap(java.util.Map c1, com.zeroc.Ice.Current current) + { + test.Ice.scope.Inner.Test.Inner2.I.OpCMapResult result = + new test.Ice.scope.Inner.Test.Inner2.I.OpCMapResult(); + result.returnValue = c1; + result.c2 = c1; + return result; + } + + public void shutdown(com.zeroc.Ice.Current current) + { + current.adapter.getCommunicator().shutdown(); + } + } + public void run(String[] args) { com.zeroc.Ice.Properties properties = createTestProperties(args); @@ -212,6 +278,7 @@ public void run(String[] args) adapter.add(new I1(), com.zeroc.Ice.Util.stringToIdentity("i1")); adapter.add(new I2(), com.zeroc.Ice.Util.stringToIdentity("i2")); adapter.add(new I3(), com.zeroc.Ice.Util.stringToIdentity("i3")); + adapter.add(new I4(), com.zeroc.Ice.Util.stringToIdentity("i4")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/java/test/src/main/java/test/Ice/scope/Test.ice b/java/test/src/main/java/test/Ice/scope/Test.ice index 94eac462d02..1b177702140 100644 --- a/java/test/src/main/java/test/Ice/scope/Test.ice +++ b/java/test/src/main/java/test/Ice/scope/Test.ice @@ -114,3 +114,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/js/test/Ice/scope/Client.js b/js/test/Ice/scope/Client.js index 7327149b4b6..f0f72f42697 100644 --- a/js/test/Ice/scope/Client.js +++ b/js/test/Ice/scope/Client.js @@ -11,6 +11,7 @@ { const Ice = require("ice").Ice; const Test = require("Test").Test; + const Inner = require("Test").Inner; async function allTests(out, communicator) { @@ -123,6 +124,39 @@ test(cmap3.get("a").s.equals(s1)); } + { + const i4 = await Inner.Test.Inner2.IPrx.checkedCast(communicator.stringToProxy("i4:default -p 12010")); + const s1 = new Test.S(0); + + const [s2, s3] = await i4.opS(s1); + test(s2.equals(s1)); + test(s3.equals(s1)); + + const [sseq2, sseq3] = await i4.opSSeq([s1]); + test(sseq2[0].equals(s1)); + test(sseq3[0].equals(s1)); + + const smap1 = new Map([["a", s1]]); + const [smap2, smap3] = await i4.opSMap(smap1); + test(smap2.get("a").equals(s1)); + test(smap3.get("a").equals(s1)); + + const c1 = new Test.C(s1); + + const [c2, c3] = await i4.opC(c1); + test(c2.s.equals(s1)); + test(c3.s.equals(s1)); + + const [cseq2, cseq3] = await i4.opCSeq([c1]); + test(cseq2[0].s.equals(s1)); + test(cseq3[0].s.equals(s1)); + + const cmap1 = new Map([["a", c1]]); + const [cmap2, cmap3] = await i4.opCMap(cmap1); + test(cmap2.get("a").s.equals(s1)); + test(cmap3.get("a").s.equals(s1)); + } + { const i1 = await Test.IPrx.checkedCast(communicator.stringToProxy("i1:default -p 12010")); await i1.shutdown(); diff --git a/js/test/Ice/scope/Test.ice b/js/test/Ice/scope/Test.ice index fbd505e2ee4..e40116886d3 100644 --- a/js/test/Ice/scope/Test.ice +++ b/js/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/php/test/Ice/scope/Test.ice b/php/test/Ice/scope/Test.ice index fbd505e2ee4..e40116886d3 100644 --- a/php/test/Ice/scope/Test.ice +++ b/php/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/python/test/Ice/scope/Test.ice b/python/test/Ice/scope/Test.ice index fbd505e2ee4..e40116886d3 100644 --- a/python/test/Ice/scope/Test.ice +++ b/python/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/ruby/test/Ice/scope/Test.ice b/ruby/test/Ice/scope/Test.ice index fbd505e2ee4..e40116886d3 100644 --- a/ruby/test/Ice/scope/Test.ice +++ b/ruby/test/Ice/scope/Test.ice @@ -113,3 +113,29 @@ module Test sequence ISeq; } } + +module Inner +{ + +module Test +{ + +module Inner2 +{ + interface I + { + Test::S opS(Test::S s1, out Test::S s2); + Test::SSeq opSSeq(Test::SSeq s1, out Test::SSeq s2); + Test::SMap opSMap(Test::SMap s1, out Test::SMap s2); + + Test::C opC(Test::C c1, out Test::C c2); + Test::CSeq opCSeq(Test::CSeq c1, out Test::CSeq c2); + Test::CMap opCMap(Test::CMap c1, out Test::CMap c2); + + void shutdown(); + } +} + +} + +} diff --git a/slice/Ice/Communicator.ice b/slice/Ice/Communicator.ice index 5a850af8f82..dcc017e1412 100644 --- a/slice/Ice/Communicator.ice +++ b/slice/Ice/Communicator.ice @@ -54,7 +54,7 @@ module Ice * @see ValueFactory * **/ -["clr:implements:_System.IDisposable", "java:implements:java.lang.AutoCloseable", "php:internal", "matlab:internal"] +["clr:implements:global::System.IDisposable", "java:implements:java.lang.AutoCloseable", "php:internal", "matlab:internal"] local interface Communicator {