diff options
author | Bernard Normier <bernard@zeroc.com> | 2019-06-11 15:29:14 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2019-06-11 15:29:14 -0400 |
commit | a7b5fe39d00ed9b030731f2274396954697b69d6 (patch) | |
tree | 196d17e30a828d7bf1f1bb4d5172fdd3ae908167 | |
parent | Fixed comments (diff) | |
download | ice-a7b5fe39d00ed9b030731f2274396954697b69d6.tar.bz2 ice-a7b5fe39d00ed9b030731f2274396954697b69d6.tar.xz ice-a7b5fe39d00ed9b030731f2274396954697b69d6.zip |
Reworked Traits and fixed comments
-rw-r--r-- | cpp/src/slice2swift/Gen.cpp | 285 | ||||
-rw-r--r-- | cpp/src/slice2swift/Gen.h | 16 | ||||
-rw-r--r-- | swift/src/Ice/Object.swift | 23 | ||||
-rw-r--r-- | swift/src/Ice/Proxy.swift | 8 | ||||
-rw-r--r-- | swift/src/Ice/Value.swift | 4 | ||||
-rw-r--r-- | swift/test/Ice/defaultServant/AllTests.swift | 20 | ||||
-rw-r--r-- | swift/test/Ice/location/AllTests.swift | 30 | ||||
-rw-r--r-- | swift/test/Ice/operations/TestI.swift | 161 | ||||
-rw-r--r-- | swift/test/Ice/proxy/TestAMDI.swift | 20 | ||||
-rw-r--r-- | swift/test/Ice/proxy/TestI.swift | 20 |
10 files changed, 278 insertions, 309 deletions
diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index b550435e73c..7ff72953c30 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -101,9 +101,6 @@ Gen::generate(const UnitPtr& p) ObjectExtVisitor objectExtVisitor(_out); p->visit(&objectExtVisitor, false); - ObjectDispVisitor objectDispVisitor(_out); - p->visit(&objectDispVisitor, false); - LocalObjectVisitor localObjectVisitor(_out); p->visit(&localObjectVisitor, false); } @@ -312,8 +309,56 @@ Gen::TypesVisitor::TypesVisitor(IceUtilInternal::Output& o) : out(o) } bool -Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr&) +Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) { + if(p->isLocal()) + { + return false; + } + + const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); + const string name = fixIdent(getUnqualified(getAbsolute(p), swiftModule)); + const string traits = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + "Traits"); + + ClassList allBases = p->allBases(); + StringList allIds; + transform(allBases.begin(), allBases.end(), back_inserter(allIds), ::IceUtil::constMemFun(&Contained::scoped)); + allIds.push_back(p->scoped()); + allIds.push_back("::Ice::Object"); + allIds.sort(); + allIds.unique(); + + ostringstream ids; + + ids << "["; + for(StringList::const_iterator r = allIds.begin(); r != allIds.end(); ++r) + { + if(r != allIds.begin()) + { + ids << ", "; + } + ids << "\"" << (*r) << "\""; + + } + ids << "]"; + + out << sp; + out << nl << "/// Traits for Slice "; + if(p->isInterface()) + { + out << "interface "; + } + else + { + out << "class "; + } + out << '`' << name << "`."; + out << nl << "public struct " << traits << ": " << getUnqualified("Ice.SliceTraits", swiftModule); + out << sb; + out << nl << "public static let staticIds = " << ids.str(); + out << nl << "public static let staticId = \"" << p->scoped() << '"'; + out << eb; + return false; } @@ -1094,6 +1139,7 @@ Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); const string name = getUnqualified(getAbsolute(p), swiftModule); + const string traits = name + "Traits"; const string prx = name + "Prx"; const string prxI = name + "PrxI"; @@ -1133,7 +1179,7 @@ Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "public override class func ice_staticId() -> Swift.String"; out << sb; - out << nl << "return \"" << p->scoped() << "\""; + out << nl << "return " << traits << ".staticId"; out << eb; out << eb; @@ -1176,7 +1222,6 @@ Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) out << sp; out << nl << "/// Downcasts the given proxy to this type without contacting the remote server."; out << nl << "///"; - out << nl << "///"; out << nl << "/// - parameter prx: `Ice.ObjectPrx` The proxy to be cast."; out << nl << "///"; out << nl << "/// - parameter type: `" << prx << ".Protocol` - The proxy type to cast to."; @@ -1203,7 +1248,7 @@ Gen::ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "/// returns: `String` - The type id of the interface or class associated with this proxy type."; out << nl << "public func ice_staticId" << spar << ("_ type: " + prx + ".Protocol") << epar << " -> Swift.String"; out << sb; - out << nl << "return " << prxI << ".ice_staticId()"; + out << nl << "return " << traits << ".staticId"; out << eb; // @@ -1275,6 +1320,7 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) const string prefix = getClassResolverPrefix(p->unit()); const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); const string name = getUnqualified(getAbsolute(p), swiftModule); + const string traits = name + "Traits"; ClassList bases = p->bases(); ClassDefPtr base; @@ -1372,7 +1418,7 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "///"; out << nl << "/// - returns: `String` - The Slice type ID of the most-derived interface supported by this object"; out << nl << "open override func ice_id() -> Swift.String" << sb; - out << nl << "return \"" << p->scoped() << "\""; + out << nl << "return " << traits << ".staticId"; out << eb; out << sp; @@ -1380,7 +1426,7 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "///"; out << nl << "/// - returns: `String` - The Slice type ID of the interface supported by this object."; out << nl << "open override class func ice_staticId() -> Swift.String" << sb; - out << nl << "return \"" << p->scoped() << "\""; + out << nl << "return " << traits << ".staticId"; out << eb; out << sp; @@ -1411,7 +1457,7 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) out << nl << "open override func _iceWriteImpl(to ostr: " << getUnqualified("Ice.OutputStream", swiftModule) << ")"; out << sb; - out << nl << "ostr.startSlice(typeId: " << fixIdent(name) << ".ice_staticId(), compactId: " << p->compactId() + out << nl << "ostr.startSlice(typeId: " << name << "Traits.staticId, compactId: " << p->compactId() << ", last: " << (!base ? "true" : "false") << ")"; for(DataMemberList::const_iterator i = members.begin(); i != members.end(); ++i) { @@ -1499,6 +1545,85 @@ Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) return false; } + const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); + const string disp = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + "Disp"); + const string traits = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + "Traits"); + const string servant = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + + (p->isInterface() ? "" : "Operations")); + + + // + // Disp struct + // + out << sp; + out << sp; + out << nl << "/// Dispatcher for `" << servant << "` servants."; + out << nl << "public struct " << disp << ": " << getUnqualified("Ice.Disp", swiftModule); + out << sb; + out << nl << "public let servant: " << servant; + + out << nl << "private static let defaultObjectImpl = " << getUnqualified("Ice.DefaultObjectImpl", swiftModule) + << "<" << traits << ">()"; + + out << sp; + out << nl << "public init(_ servant: " << servant << ")"; + out << sb; + out << nl << "self.servant = servant"; + out << eb; + + const OperationList allOps = p->allOperations(); + + StringList allOpNames; + transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); + + allOpNames.push_back("ice_id"); + allOpNames.push_back("ice_ids"); + allOpNames.push_back("ice_isA"); + allOpNames.push_back("ice_ping"); + allOpNames.sort(); + allOpNames.unique(); + + out << sp; + out << nl; + out << "public func dispatch"; + out << spar; + out << ("incoming inS: " + getUnqualified("Ice.Incoming", swiftModule)); + out << ("current: " + getUnqualified("Ice.Current", swiftModule)); + out << epar; + out << " throws"; + + out << sb; + out << nl << "switch current.operation"; + out << sb; + out.dec(); // to align case with switch + for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end(); ++q) + { + const string opName = *q; + out << nl << "case \"" << opName << "\":"; + out.inc(); + if(opName == "ice_id" || opName == "ice_ids" || opName == "ice_isA" || opName == "ice_ping") + { + out << nl << "try (servant as? Object ?? " << disp << ".defaultObjectImpl)._iceD_" + << opName << "(incoming: inS, current: current)"; + } + else + { + out << nl << "try servant._iceD_" << opName << "(incoming: inS, current: current)"; + } + out.dec(); + } + out << nl << "default:"; + out.inc(); + out << nl << "throw " << getUnqualified("Ice.OperationNotExistException", swiftModule) + << "(id: current.id, facet: current.facet, operation: current.operation)"; + // missing dec to compensate for the extra dec after switch sb + out << eb; + out << eb; + out << eb; + + // + // Protocol + // ClassList bases = p->bases(); bool hasBase = false; while(!bases.empty() && !hasBase) @@ -1515,9 +1640,6 @@ Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } } - const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); - const string name = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + (p->isInterface() ? "" : "Operations")); - StringList baseNames; for(ClassList::const_iterator i = bases.begin(); i != bases.end(); ++i) { @@ -1526,7 +1648,7 @@ Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) } // - // Check for swift:inherit metadata. + // Check for swift:inherits metadata. // const StringList metaData = p->getMetaData(); static const string prefix = "swift:inherits:"; @@ -1540,7 +1662,7 @@ Gen::ObjectVisitor::visitClassDefStart(const ClassDefPtr& p) out << sp; writeDocSummary(out, p); - out << nl << "public protocol " << name; + out << nl << "public protocol " << servant; if(!baseNames.empty()) { out << ":"; @@ -1658,139 +1780,6 @@ Gen::ObjectExtVisitor::visitOperation(const OperationPtr& op) } } -Gen::ObjectDispVisitor::ObjectDispVisitor(::IceUtilInternal::Output& o) : out(o) -{ -} - -bool -Gen::ObjectDispVisitor::visitModuleStart(const ModulePtr&) -{ - return true; -} - -void -Gen::ObjectDispVisitor::visitModuleEnd(const ModulePtr&) -{ -} - -bool -Gen::ObjectDispVisitor::visitClassDefStart(const ClassDefPtr& p) -{ - if(p->isLocal() || (!p->isInterface() && p->allOperations().empty())) - { - return false; - } - - const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); - const string name = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + "Disp"); - const string servant = fixIdent(getUnqualified(getAbsolute(p), swiftModule) + - (p->isInterface() ? "" : "Operations")); - - ClassList allBases = p->allBases(); - StringList allIds; - transform(allBases.begin(), allBases.end(), back_inserter(allIds), ::IceUtil::constMemFun(&Contained::scoped)); - allIds.push_back(p->scoped()); - allIds.push_back("::Ice::Object"); - allIds.sort(); - allIds.unique(); - - ostringstream ids; - - ids << "["; - for(StringList::const_iterator r = allIds.begin(); r != allIds.end(); ++r) - { - if(r != allIds.begin()) - { - ids << ", "; - } - ids << "\"" << (*r) << "\""; - - } - ids << "]"; - - out << sp; - writeServantDocSummary(out, p, swiftModule); - out << nl << "public struct " << name << ": " - << getUnqualified("Ice.Disp", swiftModule) << ", " - << getUnqualified("Ice.InterfaceTraits", swiftModule); - - out << sb; - - out << nl << "public static let staticIds = " << ids.str(); - out << nl << "public static let staticId = \"" << p->scoped() << '"'; - out << nl << "public let servant: " << servant; - - out << nl << "private static let defaultObjectImpl = " << getUnqualified("Ice.DefaultObjectImpl", swiftModule) - << "<" << name << ">()"; - - out << sp; - out << nl << "public init(_ servant: " << servant << ")"; - out << sb; - out << nl << "self.servant = servant"; - out << eb; - - return true; -} - -void -Gen::ObjectDispVisitor::visitClassDefEnd(const ClassDefPtr& p) -{ - const string swiftModule = getSwiftModule(getTopLevelModule(ContainedPtr::dynamicCast(p))); - const string name = getUnqualified(getAbsolute(p), swiftModule); - - const OperationList allOps = p->allOperations(); - - StringList allOpNames; - transform(allOps.begin(), allOps.end(), back_inserter(allOpNames), ::IceUtil::constMemFun(&Contained::name)); - - allOpNames.push_back("ice_id"); - allOpNames.push_back("ice_ids"); - allOpNames.push_back("ice_isA"); - allOpNames.push_back("ice_ping"); - allOpNames.sort(); - allOpNames.unique(); - - out << sp; - out << nl; - out << "public func dispatch"; - out << spar; - out << ("incoming inS: " + getUnqualified("Ice.Incoming", swiftModule)); - out << ("current: " + getUnqualified("Ice.Current", swiftModule)); - out << epar; - out << " throws"; - - out << sb; - out << nl << "switch current.operation"; - - out << sb; - for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end(); ++q) - { - const string opName = *q; - out << nl << "case \"" << opName << "\":"; - out.inc(); - if(opName == "ice_id" || opName == "ice_ids" || opName == "ice_isA" || opName == "ice_ping") - { - out << nl << "try (servant as? Object ?? " << fixIdent(name + "Disp") << ".defaultObjectImpl)._iceD_" - << opName << "(incoming: inS, current: current)"; - } - else - { - out << nl << "try servant._iceD_" << opName << "(incoming: inS, current: current)"; - } - out.dec(); - } - out << nl << "default:"; - out.inc(); - out << nl << "throw " << getUnqualified("Ice.OperationNotExistException", swiftModule) - << "(id: current.id, facet: current.facet, operation: current.operation)"; - out.dec(); - out << eb; - - out << eb; - - out << eb; -} - Gen::LocalObjectVisitor::LocalObjectVisitor(::IceUtilInternal::Output& o) : out(o) { } diff --git a/cpp/src/slice2swift/Gen.h b/cpp/src/slice2swift/Gen.h index b5939d4b99c..14c246946fd 100644 --- a/cpp/src/slice2swift/Gen.h +++ b/cpp/src/slice2swift/Gen.h @@ -144,22 +144,6 @@ private: IceUtilInternal::Output& out; }; - class ObjectDispVisitor : public SwiftGenerator, public ParserVisitor - { - public: - - ObjectDispVisitor(::IceUtilInternal::Output&); - - virtual bool visitModuleStart(const ModulePtr&); - virtual void visitModuleEnd(const ModulePtr&); - virtual bool visitClassDefStart(const ClassDefPtr&); - virtual void visitClassDefEnd(const ClassDefPtr&); - - private: - - IceUtilInternal::Output& out; - }; - class LocalObjectVisitor : public SwiftGenerator, public ParserVisitor { public: diff --git a/swift/src/Ice/Object.swift b/swift/src/Ice/Object.swift index 60df4b4e63f..158cb663c29 100644 --- a/swift/src/Ice/Object.swift +++ b/swift/src/Ice/Object.swift @@ -10,9 +10,12 @@ public protocol Disp { func dispatch(incoming: Incoming, current: Current) throws } -/// An InterfacesTraits struct describes a Slice interface. -public protocol InterfaceTraits { +/// A SliceTraits struct describes a Slice interface, class or exception. +public protocol SliceTraits { + /// List of all type-ids. static var staticIds: [String] { get } + + /// Most derived type-id. static var staticId: String { get } } @@ -89,24 +92,30 @@ public extension Object { } } +/// Traits for Object. +public struct ObjectTraits: SliceTraits { + public static let staticIds = ["::Ice::Object"] + public static let staticId = "::Ice::Object" +} + /// class DefaultObjectImpl provides the default implementation of Object operations (ice_id, /// ice_ping etc.) for a given Slice interface. -public class DefaultObjectImpl<T: InterfaceTraits>: Object { +open class DefaultObjectImpl<T: SliceTraits>: Object { public init() {} - public func ice_id(current _: Current) throws -> String { + open func ice_id(current _: Current) throws -> String { return T.staticId } - public func ice_ids(current _: Current) throws -> [String] { + open func ice_ids(current _: Current) throws -> [String] { return T.staticIds } - public func ice_isA(s: String, current _: Current) throws -> Bool { + open func ice_isA(s: String, current _: Current) throws -> Bool { return T.staticIds.contains(s) } - public func ice_ping(current _: Current) throws { + open func ice_ping(current _: Current) throws { // Do nothing } } diff --git a/swift/src/Ice/Proxy.swift b/swift/src/Ice/Proxy.swift index 7702e76fafb..11cdf8db276 100644 --- a/swift/src/Ice/Proxy.swift +++ b/swift/src/Ice/Proxy.swift @@ -363,7 +363,7 @@ public func uncheckedCast(prx: Ice.ObjectPrx, /// /// - returns: `String` - The type id, "::Ice::Object". public func ice_staticId(_: ObjectPrx.Protocol) -> Swift.String { - return ObjectPrxI.ice_staticId() + return ObjectTraits.staticId } public func != (lhs: ObjectPrx?, rhs: ObjectPrx?) -> Bool { @@ -584,9 +584,9 @@ public extension ObjectPrx { var data: Data? var ok: Bool = false try _impl.handle.invoke(operation, mode: mode.rawValue, inParams: inEncaps, context: context) { - ok = $0 - data = Data($1) // make a copy - } + ok = $0 + data = Data($1) // make a copy + } return (ok, data!) } else { try _impl.handle.onewayInvoke(operation, mode: mode.rawValue, inParams: inEncaps, context: context) diff --git a/swift/src/Ice/Value.swift b/swift/src/Ice/Value.swift index 3139fe4b8f5..67634de67b1 100644 --- a/swift/src/Ice/Value.swift +++ b/swift/src/Ice/Value.swift @@ -46,11 +46,11 @@ open class Value { os.endValue() } - /// Returns the Slice type ID of the interface supported by this object. + /// Returns the Slice type ID of this object. /// /// - returns: `String` - The Slice type ID. open class func ice_staticId() -> String { - return "::Ice::Value" + return "::Ice::Object" } } diff --git a/swift/test/Ice/defaultServant/AllTests.swift b/swift/test/Ice/defaultServant/AllTests.swift index 37ee8dbb400..a93039679f4 100644 --- a/swift/test/Ice/defaultServant/AllTests.swift +++ b/swift/test/Ice/defaultServant/AllTests.swift @@ -5,20 +5,8 @@ import Ice import TestCommon -final class MyObjectI: MyObject, Object { - func ice_id(current: Current) -> String { - return MyObjectDisp.staticId - } - - func ice_ids(current: Current) -> [String] { - return MyObjectDisp.staticIds - } - - func ice_isA(s: String, current: Current) -> Bool { - return MyObjectDisp.staticIds.contains(s) - } - - func ice_ping(current: Ice.Current) throws { +final class MyObjectI: DefaultObjectImpl<MyObjectTraits>, MyObject { + override func ice_ping(current: Ice.Current) throws { if current.id.name == "ObjectNotExist" { throw Ice.ObjectNotExistException(id: current.id, facet: "", operation: "ice_ping") } else if current.id.name == "FacetNotExist" { @@ -68,9 +56,9 @@ func allTests(_ helper: TestHelper) throws { var identity = Ice.Identity() identity.category = "foo" - let names = ["foo", "bar", "x", "y", "abcdefg"] + let names = ["foo", "bar", "x", "y", "abcdefg"] - var prx: MyObjectPrx! = nil + var prx: MyObjectPrx! for name in names { identity.name = name prx = try uncheckedCast(prx: oa.createProxy(identity), type: MyObjectPrx.self) diff --git a/swift/test/Ice/location/AllTests.swift b/swift/test/Ice/location/AllTests.swift index 25ef72bd89c..f54ca2b3c67 100644 --- a/swift/test/Ice/location/AllTests.swift +++ b/swift/test/Ice/location/AllTests.swift @@ -2,10 +2,10 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice -import TestCommon import PromiseKit -import Foundation +import TestCommon func allTests(_ helper: TestHelper) throws { func test(_ value: Bool, file: String = #file, line: Int = #line) throws { @@ -17,7 +17,8 @@ func allTests(_ helper: TestHelper) throws { let manager = try checkedCast( prx: communicator.stringToProxy("ServerManager:\(helper.getTestEndpoint(num: 0))")!, - type: ServerManagerPrx.self)! + type: ServerManagerPrx.self + )! let locator = uncheckedCast(prx: communicator.getDefaultLocator()!, type: TestLocatorPrx.self) @@ -241,7 +242,7 @@ func allTests(_ helper: TestHelper) throws { } results.removeAll() try test(locator.getRequestCount() > count && - locator.getRequestCount() < count + 999) + locator.getRequestCount() < count + 999) if try locator.getRequestCount() > count + 800 { try output.write("queuing = \(locator.getRequestCount() - count)") @@ -261,7 +262,7 @@ func allTests(_ helper: TestHelper) throws { // XXX: // Take into account the retries. try test(locator.getRequestCount() > count && - locator.getRequestCount() < count + 1999) + locator.getRequestCount() < count + 1999) if try locator.getRequestCount() > count + 800 { try output.write("queuing = \(locator.getRequestCount() - count)") @@ -282,7 +283,8 @@ func allTests(_ helper: TestHelper) throws { try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() try registry.setAdapterDirectProxy( id: "TestAdapter3", - proxy: communicator.stringToProxy("dummy:\(helper.getTestEndpoint(num: 99))")) + proxy: communicator.stringToProxy("dummy:\(helper.getTestEndpoint(num: 99))") + ) try communicator.stringToProxy("test@TestAdapter3")!.ice_ping() } catch { try test(false) @@ -383,13 +385,13 @@ func allTests(_ helper: TestHelper) throws { count = try locator.getRequestCount() try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(0).ice_ping(); // No locator cache. + try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(0).ice_ping() // No locator cache. count += 3 try test(count == locator.getRequestCount()) try registry.setAdapterDirectProxy(id: "TestAdapter5", proxy: nil) try registry.addObject(communicator.stringToProxy("test3:" + helper.getTestEndpoint(num: 99))) - try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout. - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(10).ice_ping(); // 10s timeout. + try ic.stringToProxy("test@TestAdapter5")!.ice_locatorCacheTimeout(10).ice_ping() // 10s timeout. + try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(10).ice_ping() // 10s timeout. try test(count == locator.getRequestCount()) Thread.sleep(forTimeInterval: 1.2) @@ -410,7 +412,7 @@ func allTests(_ helper: TestHelper) throws { do { while true { - try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(1).ice_ping(); // 1s timeout. + try ic.stringToProxy("test3")!.ice_locatorCacheTimeout(1).ice_ping() // 1s timeout. Thread.sleep(forTimeInterval: 0.1) } } catch is Ice.LocalException { @@ -488,14 +490,14 @@ func allTests(_ helper: TestHelper) throws { try registry.addObject(adapter.add(servant: HelloDisp(HelloI()), id: ident)) try adapter.activate() - /*let helloPrx*/ _ = try checkedCast( + /* let helloPrx */ _ = try checkedCast( prx: communicator.stringToProxy("\"\(communicator.identityToString(ident))\"")!, - type: HelloPrx.self)! + type: HelloPrx.self + )! - // TODO in Swift the call doesn't use collocation optimization because + // TODO: in Swift the call doesn't use collocation optimization because // ServantManager::hasServant only checks C++ ASM for the given identity // try test(helloPrx.ice_getConnection() == nil) - adapter.deactivate() output.writeLine("ok") diff --git a/swift/test/Ice/operations/TestI.swift b/swift/test/Ice/operations/TestI.swift index b2f0ee8cfe1..5bfd0abfdf1 100644 --- a/swift/test/Ice/operations/TestI.swift +++ b/swift/test/Ice/operations/TestI.swift @@ -2,20 +2,17 @@ // Copyright (c) ZeroC, Inc. All rights reserved. // +import Foundation import Ice import TestCommon -import Foundation class BI: MBOperations { - func opB(current: Ice.Current) throws { - } + func opB(current _: Ice.Current) throws {} - func opIntf(current: Ice.Current) throws { - } + func opIntf(current _: Ice.Current) throws {} } -class MyDerivedClassI: MyDerivedClass { - +class MyDerivedClassI: DefaultObjectImpl<MyDerivedClassTraits>, MyDerivedClass { var _helper: TestHelper var _opByteSOnewayCallCount: Int32 = 0 var _lock = os_unfair_lock() @@ -23,33 +20,34 @@ class MyDerivedClassI: MyDerivedClass { init(_ helper: TestHelper) { _helper = helper } + // // Override the Object "pseudo" operations to verify the operation mode. // - func ice_isA(id: String, current: Ice.Current) throws -> Bool { + override func ice_isA(s: String, current: Ice.Current) throws -> Bool { try _helper.test(current.mode == .Nonmutating) - return ["::Ice::Object", "::Test::MyClass", "::Test::MyDerivedClass"].contains(id) + return try super.ice_isA(s: s, current: current) } - func ice_ping(current: Ice.Current) throws { + override func ice_ping(current: Ice.Current) throws { try _helper.test(current.mode == .Nonmutating) } - func ice_ids(current: Ice.Current) throws -> [String] { + override func ice_ids(current: Ice.Current) throws -> [String] { try _helper.test(current.mode == .Nonmutating) - return ["::Ice::Object", "::Test::MyClass", "::Test::MyDerivedClass"] + return try super.ice_ids(current: current) } - func ice_id(current: Ice.Current) throws -> String { + override func ice_id(current: Ice.Current) throws -> String { try _helper.test(current.mode == .Nonmutating) - return "::Test::MyDerivedClass" + return try super.ice_id(current: current) } func shutdown(current: Ice.Current) throws { current.adapter!.getCommunicator().shutdown() } - func supportsCompress(current: Ice.Current) throws -> Bool { + func supportsCompress(current _: Ice.Current) throws -> Bool { return true } @@ -57,59 +55,59 @@ class MyDerivedClassI: MyDerivedClass { try _helper.test(current.mode == .Normal) } - func opBool(p1: Bool, p2: Bool, current: Ice.Current) throws -> (returnValue: Bool, p3: Bool) { + func opBool(p1: Bool, p2: Bool, current _: Ice.Current) throws -> (returnValue: Bool, p3: Bool) { return (p2, p1) } - func opBoolS(p1: [Bool], p2: [Bool], current: Ice.Current) throws -> (returnValue: [Bool], p3: [Bool]) { + func opBoolS(p1: [Bool], p2: [Bool], current _: Ice.Current) throws -> (returnValue: [Bool], p3: [Bool]) { return (p1.reversed(), p1 + p2) } - func opBoolSS(p1: [[Bool]], p2: [[Bool]], current: Ice.Current) throws -> (returnValue: [[Bool]], p3: [[Bool]]) { + func opBoolSS(p1: [[Bool]], p2: [[Bool]], current _: Ice.Current) throws -> (returnValue: [[Bool]], p3: [[Bool]]) { return (p1.reversed(), p1 + p2) } - func opByte(p1: UInt8, p2: UInt8, current: Ice.Current) throws -> (returnValue: UInt8, p3: UInt8) { + func opByte(p1: UInt8, p2: UInt8, current _: Ice.Current) throws -> (returnValue: UInt8, p3: UInt8) { return (p1, p1 ^ p2) } func opByteBoolD(p1: [UInt8: Bool], p2: [UInt8: Bool], - current: Ice.Current) throws -> (returnValue: [UInt8: Bool], p3: [UInt8: Bool]) { + current _: Ice.Current) throws -> (returnValue: [UInt8: Bool], p3: [UInt8: Bool]) { return (p1.merging(p2) { _, new in new }, p1) } func opByteS(p1: ByteSeq, - p2: ByteSeq, current: Ice.Current) throws -> (returnValue: ByteSeq, p3: ByteSeq) { + p2: ByteSeq, current _: Ice.Current) throws -> (returnValue: ByteSeq, p3: ByteSeq) { return (p1 + p2, ByteSeq(p1.reversed())) } func opByteSS(p1: [ByteSeq], - p2: [ByteSeq], current: Ice.Current) throws -> (returnValue: [ByteSeq], p3: [ByteSeq]) { + p2: [ByteSeq], current _: Ice.Current) throws -> (returnValue: [ByteSeq], p3: [ByteSeq]) { return (p1 + p2, p1.reversed()) } func opFloatDouble(p1: Float, p2: Double, - current: Ice.Current) throws -> (returnValue: Double, p3: Float, p4: Double) { + current _: Ice.Current) throws -> (returnValue: Double, p3: Float, p4: Double) { return (p2, p1, p2) } func opFloatDoubleS(p1: [Float], p2: [Double], - current: Ice.Current) throws -> (returnValue: [Double], p3: [Float], p4: [Double]) { + current _: Ice.Current) throws -> (returnValue: [Double], p3: [Float], p4: [Double]) { return (p2 + p1.map { Double($0) }, p1, p2.reversed()) } func opFloatDoubleSS(p1: [[Float]], p2: [[Double]], - current: Ice.Current) throws -> (returnValue: [[Double]], p3: [[Float]], p4: [[Double]]) { + current _: Ice.Current) throws -> (returnValue: [[Double]], p3: [[Float]], p4: [[Double]]) { return (p2 + p2, p1, p2.reversed()) } func opLongFloatD(p1: [Int64: Float], p2: [Int64: Float], - current: Ice.Current) throws -> (returnValue: [Int64: Float], p3: [Int64: Float]) { + current _: Ice.Current) throws -> (returnValue: [Int64: Float], p3: [Int64: Float]) { return (p1.merging(p2) { _, new in new }, p1) } @@ -124,170 +122,170 @@ class MyDerivedClassI: MyDerivedClass { type: MyClassPrx.self)) } - func opMyEnum(p1: MyEnum, current: Ice.Current) throws -> (returnValue: MyEnum, p2: MyEnum) { + func opMyEnum(p1: MyEnum, current _: Ice.Current) throws -> (returnValue: MyEnum, p2: MyEnum) { return (MyEnum.enum3, p1) } func opShortIntD(p1: [Int16: Int32], p2: [Int16: Int32], - current: Ice.Current) throws -> (returnValue: [Int16: Int32], p3: [Int16: Int32]) { + current _: Ice.Current) throws -> (returnValue: [Int16: Int32], p3: [Int16: Int32]) { return (p1.merging(p2) { _, new in new }, p1) } func opShortIntLong(p1: Int16, p2: Int32, p3: Int64, - current: Ice.Current) throws -> (returnValue: Int64, p4: Int16, p5: Int32, p6: Int64) { + current _: Ice.Current) throws -> (returnValue: Int64, p4: Int16, p5: Int32, p6: Int64) { return (p3, p1, p2, p3) } func opShortIntLongS(p1: [Int16], p2: [Int32], p3: [Int64], - current: Ice.Current) throws -> (returnValue: [Int64], p4: [Int16], p5: [Int32], p6: [Int64]) { - return (p3, p1, p2.reversed(), p3 + p3) + current _: Ice.Current) throws -> (returnValue: [Int64], p4: [Int16], p5: [Int32], p6: [Int64]) { + return (p3, p1, p2.reversed(), p3 + p3) } func opShortIntLongSS(p1: [[Int16]], p2: [[Int32]], p3: [[Int64]], - current: Ice.Current) throws -> (returnValue: [[Int64]], - p4: [[Int16]], - p5: [[Int32]], - p6: [[Int64]]) { + current _: Ice.Current) throws -> (returnValue: [[Int64]], + p4: [[Int16]], + p5: [[Int32]], + p6: [[Int64]]) { return (p3, p1, p2.reversed(), p3 + p3) } - func opString(p1: String, p2: String, current: Ice.Current) throws -> (returnValue: String, p3: String) { + func opString(p1: String, p2: String, current _: Ice.Current) throws -> (returnValue: String, p3: String) { return ("\(p1) \(p2)", "\(p2) \(p1)") } func opStringMyEnumD(p1: [String: MyEnum], p2: [String: MyEnum], - current: Ice.Current) throws -> (returnValue: [String: MyEnum], p3: [String: MyEnum]) { + current _: Ice.Current) throws -> (returnValue: [String: MyEnum], p3: [String: MyEnum]) { return (p1.merging(p2) { _, new in new }, p1) } func opMyEnumStringD(p1: [MyEnum: String], p2: [MyEnum: String], - current: Ice.Current) throws -> (returnValue: [MyEnum: String], p3: [MyEnum: String]) { + current _: Ice.Current) throws -> (returnValue: [MyEnum: String], p3: [MyEnum: String]) { return (p1.merging(p2) { _, new in new }, p1) } func opMyStructMyEnumD(p1: [MyStruct: MyEnum], p2: [MyStruct: MyEnum], - current: Ice.Current) throws -> (returnValue: [MyStruct: MyEnum], p3: [MyStruct: MyEnum]) { + current _: Ice.Current) throws -> (returnValue: [MyStruct: MyEnum], p3: [MyStruct: MyEnum]) { return (p1.merging(p2) { _, new in new }, p1) } func opByteBoolDS(p1: [[UInt8: Bool]], p2: [[UInt8: Bool]], - current: Ice.Current) throws -> (returnValue: [[UInt8: Bool]], p3: [[UInt8: Bool]]) { + current _: Ice.Current) throws -> (returnValue: [[UInt8: Bool]], p3: [[UInt8: Bool]]) { return (p1.reversed(), p2 + p1) } func opShortIntDS(p1: [[Int16: Int32]], p2: [[Int16: Int32]], - current: Ice.Current) throws -> (returnValue: [[Int16: Int32]], p3: [[Int16: Int32]]) { + current _: Ice.Current) throws -> (returnValue: [[Int16: Int32]], p3: [[Int16: Int32]]) { return (p1.reversed(), p2 + p1) } func opLongFloatDS(p1: [[Int64: Float]], p2: [[Int64: Float]], - current: Ice.Current) throws -> (returnValue: [[Int64: Float]], p3: [[Int64: Float]]) { + current _: Ice.Current) throws -> (returnValue: [[Int64: Float]], p3: [[Int64: Float]]) { return (p1.reversed(), p2 + p1) } func opStringStringDS(p1: [[String: String]], p2: [[String: String]], - current: Ice.Current) throws -> (returnValue: [[String: String]], p3: [[String: String]]) { + current _: Ice.Current) throws -> (returnValue: [[String: String]], p3: [[String: String]]) { return (p1.reversed(), p2 + p1) } func opStringMyEnumDS(p1: [[String: MyEnum]], p2: [[String: MyEnum]], - current: Ice.Current) throws -> (returnValue: [[String: MyEnum]], p3: [[String: MyEnum]]) { + current _: Ice.Current) throws -> (returnValue: [[String: MyEnum]], p3: [[String: MyEnum]]) { return (p1.reversed(), p2 + p1) } func opMyEnumStringDS(p1: [[MyEnum: String]], p2: [[MyEnum: String]], - current: Ice.Current) throws -> (returnValue: [[MyEnum: String]], p3: [[MyEnum: String]]) { + current _: Ice.Current) throws -> (returnValue: [[MyEnum: String]], p3: [[MyEnum: String]]) { return (p1.reversed(), p2 + p1) } func opMyStructMyEnumDS(p1: [[MyStruct: MyEnum]], p2: [[MyStruct: MyEnum]], - current: Ice.Current) throws -> (returnValue: [[MyStruct: MyEnum]], - p3: [[MyStruct: MyEnum]]) { + current _: Ice.Current) throws -> (returnValue: [[MyStruct: MyEnum]], + p3: [[MyStruct: MyEnum]]) { return (p1.reversed(), p2 + p1) } func opByteByteSD(p1: [UInt8: ByteSeq], p2: [UInt8: ByteSeq], - current: Ice.Current) throws -> (returnValue: [UInt8: ByteSeq], p3: [UInt8: ByteSeq]) { + current _: Ice.Current) throws -> (returnValue: [UInt8: ByteSeq], p3: [UInt8: ByteSeq]) { return (p1.merging(p2) { _, new in new }, p2) } func opBoolBoolSD(p1: [Bool: [Bool]], p2: [Bool: [Bool]], - current: Ice.Current) throws -> (returnValue: [Bool: [Bool]], p3: [Bool: [Bool]]) { + current _: Ice.Current) throws -> (returnValue: [Bool: [Bool]], p3: [Bool: [Bool]]) { return (p1.merging(p2) { _, new in new }, p2) } func opShortShortSD(p1: [Int16: [Int16]], p2: [Int16: [Int16]], - current: Ice.Current) throws -> (returnValue: [Int16: [Int16]], p3: [Int16: [Int16]]) { + current _: Ice.Current) throws -> (returnValue: [Int16: [Int16]], p3: [Int16: [Int16]]) { return (p1.merging(p2) { _, new in new }, p2) } func opIntIntSD(p1: [Int32: [Int32]], p2: [Int32: [Int32]], - current: Ice.Current) throws -> (returnValue: [Int32: [Int32]], p3: [Int32: [Int32]]) { + current _: Ice.Current) throws -> (returnValue: [Int32: [Int32]], p3: [Int32: [Int32]]) { return (p1.merging(p2) { _, new in new }, p2) } func opLongLongSD(p1: [Int64: [Int64]], p2: [Int64: [Int64]], - current: Ice.Current) throws -> (returnValue: [Int64: [Int64]], p3: [Int64: [Int64]]) { + current _: Ice.Current) throws -> (returnValue: [Int64: [Int64]], p3: [Int64: [Int64]]) { return (p1.merging(p2) { _, new in new }, p2) } func opStringFloatSD(p1: [String: [Float]], p2: [String: [Float]], - current: Ice.Current) throws -> (returnValue: [String: [Float]], p3: [String: [Float]]) { + current _: Ice.Current) throws -> (returnValue: [String: [Float]], p3: [String: [Float]]) { return (p1.merging(p2) { _, new in new }, p2) } func opStringDoubleSD(p1: [String: [Double]], p2: [String: [Double]], - current: Ice.Current) throws -> (returnValue: [String: [Double]], p3: [String: [Double]]) { + current _: Ice.Current) throws -> (returnValue: [String: [Double]], p3: [String: [Double]]) { return (p1.merging(p2) { _, new in new }, p2) } func opStringStringSD(p1: [String: [String]], p2: [String: [String]], - current: Ice.Current) throws -> (returnValue: [String: [String]], p3: [String: [String]]) { + current _: Ice.Current) throws -> (returnValue: [String: [String]], p3: [String: [String]]) { return (p1.merging(p2) { _, new in new }, p2) } func opMyEnumMyEnumSD(p1: [MyEnum: [MyEnum]], p2: [MyEnum: [MyEnum]], - current: Ice.Current) throws -> (returnValue: [MyEnum: [MyEnum]], p3: [MyEnum: [MyEnum]]) { + current _: Ice.Current) throws -> (returnValue: [MyEnum: [MyEnum]], p3: [MyEnum: [MyEnum]]) { return (p1.merging(p2) { _, new in new }, p2) } - func opIntS(s: [Int32], current: Ice.Current) throws -> [Int32] { + func opIntS(s: [Int32], current _: Ice.Current) throws -> [Int32] { return s.map { -$0 } } - func opByteSOneway(s: ByteSeq, current: Ice.Current) throws { + func opByteSOneway(s _: ByteSeq, current _: Ice.Current) throws { withLock(&_lock) { _opByteSOnewayCallCount += 1 } } - func opByteSOnewayCallCount(current: Ice.Current) throws -> Int32 { + func opByteSOnewayCallCount(current _: Ice.Current) throws -> Int32 { return withLock(&_lock) { let count = _opByteSOnewayCallCount _opByteSOnewayCallCount = 0 @@ -299,40 +297,39 @@ class MyDerivedClassI: MyDerivedClass { return current.ctx } - func opDoubleMarshaling(p1: Double, p2: [Double], current: Ice.Current) throws { - let d = Double(1278312346.0 / 13.0) + func opDoubleMarshaling(p1: Double, p2: [Double], current _: Ice.Current) throws { + let d = Double(1_278_312_346.0 / 13.0) try _helper.test(p1 == d) for p in p2 { try _helper.test(p == d) } } - func opStringS(p1: [String], p2: [String], current: Ice.Current) throws -> (returnValue: [String], p3: [String]) { + func opStringS(p1: [String], p2: [String], current _: Ice.Current) throws -> (returnValue: [String], p3: [String]) { return (p1.reversed(), p1 + p2) } func opStringSS(p1: [[String]], p2: [[String]], - current: Ice.Current) throws -> (returnValue: [[String]], p3: [[String]]) { + current _: Ice.Current) throws -> (returnValue: [[String]], p3: [[String]]) { return (p2.reversed(), p1 + p2) } func opStringSSS(p1: [[[String]]], p2: [[[String]]], - current: Ice.Current) throws -> (returnValue: [[[String]]], p3: [[[String]]]) { + current _: Ice.Current) throws -> (returnValue: [[[String]]], p3: [[[String]]]) { return (p2.reversed(), p1 + p2) } func opStringStringD(p1: [String: String], p2: [String: String], - current: Ice.Current) throws -> (returnValue: [String: String], p3: [String: String]) { - + current _: Ice.Current) throws -> (returnValue: [String: String], p3: [String: String]) { return (p1.merging(p2) { _, new in new }, p1) } func opStruct(p1: Structure, p2: Structure, - current: Ice.Current) throws -> (returnValue: Structure, p3: Structure) { + current _: Ice.Current) throws -> (returnValue: Structure, p3: Structure) { var p3 = p1 p3.s.s = "a new string" return (p2, p3) @@ -346,61 +343,61 @@ class MyDerivedClassI: MyDerivedClass { try _helper.test(current.mode == .Nonmutating) } - func opDerived(current: Ice.Current) throws {} + func opDerived(current _: Ice.Current) throws {} - func opByte1(opByte1: UInt8, current: Ice.Current) throws -> UInt8 { + func opByte1(opByte1: UInt8, current _: Ice.Current) throws -> UInt8 { return opByte1 } - func opShort1(opShort1: Int16, current: Ice.Current) throws -> Int16 { + func opShort1(opShort1: Int16, current _: Ice.Current) throws -> Int16 { return opShort1 } - func opInt1(opInt1: Int32, current: Ice.Current) throws -> Int32 { + func opInt1(opInt1: Int32, current _: Ice.Current) throws -> Int32 { return opInt1 } - func opLong1(opLong1: Int64, current: Ice.Current) throws -> Int64 { + func opLong1(opLong1: Int64, current _: Ice.Current) throws -> Int64 { return opLong1 } - func opFloat1(opFloat1: Float, current: Ice.Current) throws -> Float { + func opFloat1(opFloat1: Float, current _: Ice.Current) throws -> Float { return opFloat1 } - func opDouble1(opDouble1: Double, current: Ice.Current) throws -> Double { + func opDouble1(opDouble1: Double, current _: Ice.Current) throws -> Double { return opDouble1 } - func opString1(opString1: String, current: Ice.Current) throws -> String { + func opString1(opString1: String, current _: Ice.Current) throws -> String { return opString1 } - func opStringS1(opStringS1: [String], current: Ice.Current) throws -> [String] { + func opStringS1(opStringS1: [String], current _: Ice.Current) throws -> [String] { return opStringS1 } - func opByteBoolD1(opByteBoolD1: [UInt8: Bool], current: Ice.Current) throws -> [UInt8: Bool] { + func opByteBoolD1(opByteBoolD1: [UInt8: Bool], current _: Ice.Current) throws -> [UInt8: Bool] { return opByteBoolD1 } - func opStringS2(stringS: [String], current: Ice.Current) throws -> [String] { + func opStringS2(stringS: [String], current _: Ice.Current) throws -> [String] { return stringS } - func opByteBoolD2(byteBoolD: [UInt8: Bool], current: Ice.Current) throws -> [UInt8: Bool] { + func opByteBoolD2(byteBoolD: [UInt8: Bool], current _: Ice.Current) throws -> [UInt8: Bool] { return byteBoolD } - func opMyClass1(opMyClass1: MyClass1?, current: Ice.Current) throws -> MyClass1? { + func opMyClass1(opMyClass1: MyClass1?, current _: Ice.Current) throws -> MyClass1? { return opMyClass1 } - func opMyStruct1(opMyStruct1: MyStruct1, current: Ice.Current) throws -> MyStruct1 { + func opMyStruct1(opMyStruct1: MyStruct1, current _: Ice.Current) throws -> MyStruct1 { return opMyStruct1 } - func opStringLiterals(current: Ice.Current) throws -> [String] { + func opStringLiterals(current _: Ice.Current) throws -> [String] { return [s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, sw0, sw1, sw2, sw3, sw4, sw5, sw6, sw7, sw8, sw9, sw10, ss0, ss1, ss2, ss3, ss4, ss5, diff --git a/swift/test/Ice/proxy/TestAMDI.swift b/swift/test/Ice/proxy/TestAMDI.swift index 58aaaf90012..201577db052 100644 --- a/swift/test/Ice/proxy/TestAMDI.swift +++ b/swift/test/Ice/proxy/TestAMDI.swift @@ -4,10 +4,10 @@ import Ice import PromiseKit -final class MyDerivedClassI: MyDerivedClass, Object { +final class MyDerivedClassI: DefaultObjectImpl<MyDerivedClassTraits>, MyDerivedClass { var _ctx: [String: String] - init() { + override init() { _ctx = [String: String]() } @@ -23,26 +23,26 @@ final class MyDerivedClassI: MyDerivedClass, Object { return Promise.value(()) } - func getContextAsync(current: Ice.Current) -> PromiseKit.Promise<[String: String]> { + func getContextAsync(current _: Ice.Current) -> PromiseKit.Promise<[String: String]> { return Promise.value(_ctx) } - func ice_isA(s: String, current: Ice.Current) -> Bool { + override func ice_isA(s: String, current: Ice.Current) throws -> Bool { _ctx = current.ctx - return MyDerivedClassDisp.staticIds.contains(s) + return try super.ice_isA(s: s, current: current) } - func ice_ids(current: Ice.Current) -> [String] { + override func ice_ids(current: Ice.Current) throws -> [String] { _ctx = current.ctx - return MyDerivedClassDisp.staticIds + return try super.ice_ids(current: current) } - func ice_id(current: Ice.Current) -> String { + override func ice_id(current: Ice.Current) throws -> String { _ctx = current.ctx - return MyDerivedClassDisp.staticId + return try super.ice_id(current: current) } - func ice_ping(current: Ice.Current) { + override func ice_ping(current: Ice.Current) { _ctx = current.ctx } } diff --git a/swift/test/Ice/proxy/TestI.swift b/swift/test/Ice/proxy/TestI.swift index 3a8e6a388ed..9559531c5b4 100644 --- a/swift/test/Ice/proxy/TestI.swift +++ b/swift/test/Ice/proxy/TestI.swift @@ -3,10 +3,10 @@ // import Ice -final class MyDerivedClassI: MyDerivedClass, Object { +final class MyDerivedClassI: DefaultObjectImpl<MyDerivedClassTraits>, MyDerivedClass { var _ctx: [String: String] - init() { + override init() { _ctx = [String: String]() } @@ -21,26 +21,26 @@ final class MyDerivedClassI: MyDerivedClass, Object { adapter.getCommunicator().shutdown() } - func getContext(current: Ice.Current) throws -> [String: String] { + func getContext(current _: Ice.Current) throws -> [String: String] { return _ctx } - func ice_isA(s: String, current: Ice.Current) -> Bool { + override func ice_isA(s: String, current: Ice.Current) throws -> Bool { _ctx = current.ctx - return MyDerivedClassDisp.staticIds.contains(s) + return try super.ice_isA(s: s, current: current) } - func ice_id(current: Ice.Current) -> String { + override func ice_id(current: Ice.Current) throws -> String { _ctx = current.ctx - return MyDerivedClassDisp.staticId + return try super.ice_id(current: current) } - func ice_ids(current: Ice.Current) -> [String] { + override func ice_ids(current: Ice.Current) throws -> [String] { _ctx = current.ctx - return MyDerivedClassDisp.staticIds + return try super.ice_ids(current: current) } - func ice_ping(current: Current) { + override func ice_ping(current: Current) { _ctx = current.ctx } } |