From 13d9f3bedc9ac788fdc063be1ae8007d8d2c03d3 Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Tue, 7 May 2024 10:05:07 -0400 Subject: [PATCH 1/3] Remove tests that ensured built-in Object operations were 'nonmutating'. --- cpp/test/Ice/operations/TestAMDI.cpp | 28 ------------------- cpp/test/Ice/operations/TestI.cpp | 28 ------------------- .../test/Ice/operations/MyDerivedClassAMDI.cs | 27 ------------------ csharp/test/Ice/operations/MyDerivedClassI.cs | 28 ------------------- .../Ice/operations/AMDMyDerivedClassI.java | 28 ------------------- .../test/Ice/operations/MyDerivedClassI.java | 28 ------------------- js/test/Ice/operations/AMDMyDerivedClassI.js | 27 ------------------ js/test/Ice/operations/MyDerivedClassI.js | 27 ------------------ .../Ice/operations/AMDMyDerivedClassI.ts | 27 ------------------ .../Ice/operations/MyDerivedClassI.ts | 27 ------------------ python/test/Ice/operations/TestAMDCoroI.py | 16 ----------- python/test/Ice/operations/TestAMDI.py | 16 ----------- python/test/Ice/operations/TestI.py | 16 ----------- swift/test/Ice/operations/TestAMDI.swift | 22 --------------- swift/test/Ice/operations/TestI.swift | 22 --------------- 15 files changed, 367 deletions(-) diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index fec9d2b29d6..04b9a8c4f6f 100644 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp @@ -17,34 +17,6 @@ using namespace std; MyDerivedClassI::MyDerivedClassI() : _opByteSOnewayCallCount(0) {} -bool -MyDerivedClassI::ice_isA(string id, const Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - return MyDerivedClass::ice_isA(std::move(id), current); -} - -void -MyDerivedClassI::ice_ping(const Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - MyDerivedClass::ice_ping(current); -} - -std::vector -MyDerivedClassI::ice_ids(const Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - return MyDerivedClass::ice_ids(current); -} - -std::string -MyDerivedClassI::ice_id(const Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - return MyDerivedClass::ice_id(current); -} - void MyDerivedClassI::shutdownAsync(function response, function, const Current& current) { diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index cdd3e3ab256..741371774bd 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -14,34 +14,6 @@ using namespace std; MyDerivedClassI::MyDerivedClassI() : _opByteSOnewayCallCount(0) {} -bool -MyDerivedClassI::ice_isA(string id, const Ice::Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - return Test::MyDerivedClass::ice_isA(std::move(id), current); -} - -void -MyDerivedClassI::ice_ping(const Ice::Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - Test::MyDerivedClass::ice_ping(current); -} - -std::vector -MyDerivedClassI::ice_ids(const Ice::Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - return Test::MyDerivedClass::ice_ids(current); -} - -std::string -MyDerivedClassI::ice_id(const Ice::Current& current) const -{ - test(current.mode == OperationMode::Nonmutating); - return Test::MyDerivedClass::ice_id(current); -} - void MyDerivedClassI::shutdown(const Ice::Current& current) { diff --git a/csharp/test/Ice/operations/MyDerivedClassAMDI.cs b/csharp/test/Ice/operations/MyDerivedClassAMDI.cs index 5b3aa9bc038..b5c7d756dcc 100644 --- a/csharp/test/Ice/operations/MyDerivedClassAMDI.cs +++ b/csharp/test/Ice/operations/MyDerivedClassAMDI.cs @@ -47,33 +47,6 @@ public void Join() private Thread _thread; } - // - // Override the Object "pseudo" operations to verify the operation mode. - // - public override bool ice_isA(String id, Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - return base.ice_isA(id, current); - } - - public override void ice_ping(Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - base.ice_ping(current); - } - - public override string[] ice_ids(Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - return base.ice_ids(current); - } - - public override string ice_id(Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - return base.ice_id(current); - } - public override Task shutdownAsync(Ice.Current current) { while (_opVoidThread != null) diff --git a/csharp/test/Ice/operations/MyDerivedClassI.cs b/csharp/test/Ice/operations/MyDerivedClassI.cs index 139b3451537..e279a734467 100644 --- a/csharp/test/Ice/operations/MyDerivedClassI.cs +++ b/csharp/test/Ice/operations/MyDerivedClassI.cs @@ -14,34 +14,6 @@ private static void test(bool b) } } - // - // Override the Object "pseudo" operations to verify the operation mode. - // - - public override bool ice_isA(string id, Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - return base.ice_isA(id, current); - } - - public override void ice_ping(Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - base.ice_ping(current); - } - - public override string[] ice_ids(Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - return base.ice_ids(current); - } - - public override string ice_id(Ice.Current current) - { - test(current.mode == Ice.OperationMode.Nonmutating); - return base.ice_id(current); - } - public override void shutdown(Ice.Current current) { current.adapter.getCommunicator().shutdown(); diff --git a/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java b/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java index dd2847f20df..bbc0b0169b3 100644 --- a/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java +++ b/java/test/src/main/java/test/Ice/operations/AMDMyDerivedClassI.java @@ -30,34 +30,6 @@ public void run() { private CompletableFuture _future; } - // - // Override the Object "pseudo" operations to verify the operation mode. - // - - @Override - public boolean ice_isA(String id, Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - return MyDerivedClass.super.ice_isA(id, current); - } - - @Override - public void ice_ping(Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - MyDerivedClass.super.ice_ping(current); - } - - @Override - public String[] ice_ids(Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - return MyDerivedClass.super.ice_ids(current); - } - - @Override - public String ice_id(Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - return MyDerivedClass.super.ice_id(current); - } - @Override public synchronized CompletionStage shutdownAsync(Current current) { while (_opVoidThread != null) { diff --git a/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java b/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java index 0588dadb771..7751e17301e 100644 --- a/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java +++ b/java/test/src/main/java/test/Ice/operations/MyDerivedClassI.java @@ -15,34 +15,6 @@ private static void test(boolean b) { } } - // - // Override the Object "pseudo" operations to verify the operation mode. - // - - @Override - public boolean ice_isA(String id, Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - return MyDerivedClass.super.ice_isA(id, current); - } - - @Override - public void ice_ping(Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - MyDerivedClass.super.ice_ping(current); - } - - @Override - public String[] ice_ids(Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - return MyDerivedClass.super.ice_ids(current); - } - - @Override - public String ice_id(Current current) { - test(current.mode == com.zeroc.Ice.OperationMode.Nonmutating); - return MyDerivedClass.super.ice_id(current); - } - @Override public void shutdown(Current current) { current.adapter.getCommunicator().shutdown(); diff --git a/js/test/Ice/operations/AMDMyDerivedClassI.js b/js/test/Ice/operations/AMDMyDerivedClassI.js index a96f80e1db6..d2c76dbfdd3 100644 --- a/js/test/Ice/operations/AMDMyDerivedClassI.js +++ b/js/test/Ice/operations/AMDMyDerivedClassI.js @@ -10,9 +10,6 @@ class AMDMyDerivedClassI extends Test.MyDerivedClass { - // - // Override the Object "pseudo" operations to verify the operation mode. - // constructor(endpoints) { super(); @@ -20,30 +17,6 @@ this._endpoints = endpoints; } - ice_isA(id, current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_isA.call(this, id, current); - } - - ice_ping(current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - Ice.Object.prototype.ice_ping.call(this, current); - } - - ice_ids(current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_ids.call(this, current); - } - - ice_id(current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_id.call(this, current); - } - shutdown(current) { current.adapter.getCommunicator().shutdown(); diff --git a/js/test/Ice/operations/MyDerivedClassI.js b/js/test/Ice/operations/MyDerivedClassI.js index 6cd76a03121..7d7406b75c3 100644 --- a/js/test/Ice/operations/MyDerivedClassI.js +++ b/js/test/Ice/operations/MyDerivedClassI.js @@ -10,9 +10,6 @@ class MyDerivedClassI extends Test.MyDerivedClass { - // - // Override the Object "pseudo" operations to verify the operation mode. - // constructor(endpoints) { super(); @@ -20,30 +17,6 @@ this._endpoints = endpoints; } - ice_isA(id, current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_isA.call(this, id, current); - } - - ice_ping(current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - Ice.Object.prototype.ice_ping.call(this, current); - } - - ice_ids(current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_ids.call(this, current); - } - - ice_id(current) - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_id.call(this, current); - } - shutdown(current) { current.adapter.getCommunicator().shutdown(); diff --git a/js/test/typescript/Ice/operations/AMDMyDerivedClassI.ts b/js/test/typescript/Ice/operations/AMDMyDerivedClassI.ts index bebd16558e1..3bef182ce83 100644 --- a/js/test/typescript/Ice/operations/AMDMyDerivedClassI.ts +++ b/js/test/typescript/Ice/operations/AMDMyDerivedClassI.ts @@ -9,9 +9,6 @@ const test = TestHelper.test; export class AMDMyDerivedClassI extends Test.MyDerivedClass { - // - // Override the Object "pseudo" operations to verify the operation mode. - // constructor(endpoints:Ice.Endpoint[]) { super(); @@ -19,30 +16,6 @@ export class AMDMyDerivedClassI extends Test.MyDerivedClass this._endpoints = endpoints; } - ice_isA(id:string, current:Ice.Current):boolean - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_isA.call(this, id, current); - } - - ice_ping(current:Ice.Current):void - { - test(current.mode === Ice.OperationMode.Nonmutating); - Ice.Object.prototype.ice_ping.call(this, current); - } - - ice_ids(current:Ice.Current):Ice.StringSeq - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_ids.call(this, current); - } - - ice_id(current:Ice.Current):string - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_id.call(this, current); - } - shutdown(current:Ice.Current):void { current.adapter.getCommunicator().shutdown(); diff --git a/js/test/typescript/Ice/operations/MyDerivedClassI.ts b/js/test/typescript/Ice/operations/MyDerivedClassI.ts index d48d6b910ad..e3d015fcbb8 100644 --- a/js/test/typescript/Ice/operations/MyDerivedClassI.ts +++ b/js/test/typescript/Ice/operations/MyDerivedClassI.ts @@ -8,9 +8,6 @@ const test = TestHelper.test; export class MyDerivedClassI extends Test.MyDerivedClass { - // - // Override the Object "pseudo" operations to verify the operation mode. - // constructor(endpoints:Ice.Endpoint[]) { super(); @@ -18,30 +15,6 @@ export class MyDerivedClassI extends Test.MyDerivedClass this._endpoints = endpoints; } - ice_isA(id:string, current:Ice.Current):boolean - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_isA.call(this, id, current); - } - - ice_ping(current:Ice.Current):void - { - test(current.mode === Ice.OperationMode.Nonmutating); - Ice.Object.prototype.ice_ping.call(this, current); - } - - ice_ids(current:Ice.Current):Ice.StringSeq - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_ids.call(this, current); - } - - ice_id(current:Ice.Current):string - { - test(current.mode === Ice.OperationMode.Nonmutating); - return Ice.Object.prototype.ice_id.call(this, current); - } - shutdown(current:Ice.Current):void { current.adapter.getCommunicator().shutdown(); diff --git a/python/test/Ice/operations/TestAMDCoroI.py b/python/test/Ice/operations/TestAMDCoroI.py index 876492682df..33d9f713599 100755 --- a/python/test/Ice/operations/TestAMDCoroI.py +++ b/python/test/Ice/operations/TestAMDCoroI.py @@ -41,22 +41,6 @@ def __init__(self): self.lock = threading.Lock() self.opByteSOnewayCount = 0 - def ice_isA(self, id, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_isA(self, id, current) - - def ice_ping(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - Test.MyDerivedClass.ice_ping(self, current) - - def ice_ids(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_ids(self, current) - - def ice_id(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_id(self, current) - def shutdown(self, current=None): with self.threadLock: for thread in self.threads: diff --git a/python/test/Ice/operations/TestAMDI.py b/python/test/Ice/operations/TestAMDI.py index df20147b5e5..82aa9600b54 100755 --- a/python/test/Ice/operations/TestAMDI.py +++ b/python/test/Ice/operations/TestAMDI.py @@ -40,22 +40,6 @@ def __init__(self): self.lock = threading.Lock() self.opByteSOnewayCount = 0 - def ice_isA(self, id, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_isA(self, id, current) - - def ice_ping(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - Test.MyDerivedClass.ice_ping(self, current) - - def ice_ids(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_ids(self, current) - - def ice_id(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_id(self, current) - def shutdown(self, current=None): with self.threadLock: for thread in self.threads: diff --git a/python/test/Ice/operations/TestI.py b/python/test/Ice/operations/TestI.py index cac6917157f..0db868ef283 100644 --- a/python/test/Ice/operations/TestI.py +++ b/python/test/Ice/operations/TestI.py @@ -17,22 +17,6 @@ def __init__(self): self.lock = threading.Lock() self.opByteSOnewayCount = 0 - def ice_isA(self, id, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_isA(self, id, current) - - def ice_ping(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - Test.MyDerivedClass.ice_ping(self, current) - - def ice_ids(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_ids(self, current) - - def ice_id(self, current=None): - test(current.mode == Ice.OperationMode.Nonmutating) - return Test.MyDerivedClass.ice_id(self, current) - def shutdown(self, current=None): current.adapter.getCommunicator().shutdown() diff --git a/swift/test/Ice/operations/TestAMDI.swift b/swift/test/Ice/operations/TestAMDI.swift index 1912b42b0a6..6689e135c37 100644 --- a/swift/test/Ice/operations/TestAMDI.swift +++ b/swift/test/Ice/operations/TestAMDI.swift @@ -16,28 +16,6 @@ class MyDerivedClassI: ObjectI, MyDerivedClass { _helper = helper } - // - // Override the Object "pseudo" operations to verify the operation mode. - // - override func ice_isA(id: String, current: Ice.Current) throws -> Bool { - try _helper.test(current.mode == .Nonmutating) - return try super.ice_isA(id: id, current: current) - } - - override func ice_ping(current: Ice.Current) throws { - try _helper.test(current.mode == .Nonmutating) - } - - override func ice_ids(current: Ice.Current) throws -> [String] { - try _helper.test(current.mode == .Nonmutating) - return try super.ice_ids(current: current) - } - - override func ice_id(current: Ice.Current) throws -> String { - try _helper.test(current.mode == .Nonmutating) - return try super.ice_id(current: current) - } - func opDerivedAsync(current _: Current) -> Promise { return Promise.value(()) } diff --git a/swift/test/Ice/operations/TestI.swift b/swift/test/Ice/operations/TestI.swift index a4c1206f33b..d464c6b2534 100644 --- a/swift/test/Ice/operations/TestI.swift +++ b/swift/test/Ice/operations/TestI.swift @@ -15,28 +15,6 @@ class MyDerivedClassI: ObjectI, MyDerivedClass { _helper = helper } - // - // Override the Object "pseudo" operations to verify the operation mode. - // - override func ice_isA(id: String, current: Ice.Current) throws -> Bool { - try _helper.test(current.mode == .Nonmutating) - return try super.ice_isA(id: id, current: current) - } - - override func ice_ping(current: Ice.Current) throws { - try _helper.test(current.mode == .Nonmutating) - } - - override func ice_ids(current: Ice.Current) throws -> [String] { - try _helper.test(current.mode == .Nonmutating) - return try super.ice_ids(current: current) - } - - override func ice_id(current: Ice.Current) throws -> String { - try _helper.test(current.mode == .Nonmutating) - return try super.ice_id(current: current) - } - func shutdown(current: Ice.Current) throws { current.adapter!.getCommunicator().shutdown() } From 5475aa67e17f111162e7e624bfcf7e227b203cb3 Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Tue, 7 May 2024 11:30:56 -0400 Subject: [PATCH 2/3] Updated built-in Object operations to be 'idempotent' instead of 'nonmutating'. --- cpp/src/Ice/Object.cpp | 2 -- cpp/src/Ice/ProxyAsync.cpp | 8 ++++---- csharp/src/Ice/Object.cs | 6 ++---- csharp/src/Ice/Proxy.cs | 8 ++++---- .../src/main/java/com/zeroc/Ice/Object.java | 6 ++---- .../main/java/com/zeroc/Ice/_ObjectPrxI.java | 8 ++++---- js/src/Ice/Operation.js | 8 ++++---- matlab/lib/+Ice/ObjectPrx.m | 16 ++++++++-------- php/lib/Ice.php | 8 ++++---- python/python/Ice/__init__.py | 8 ++++---- slice/Ice/OperationMode.ice | 14 +++++--------- swift/src/Ice/Proxy.swift | 18 +++++++++--------- 12 files changed, 50 insertions(+), 60 deletions(-) diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp index 70cae96fb79..1b160dd7129 100644 --- a/cpp/src/Ice/Object.cpp +++ b/cpp/src/Ice/Object.cpp @@ -177,9 +177,7 @@ Ice::Object::_iceCheckMode(OperationMode expected, OperationMode received) assert(expected != OperationMode::Nonmutating); // We never expect Nonmutating if (expected == OperationMode::Idempotent && received == OperationMode::Nonmutating) { - // // Fine: typically an old client still using the deprecated nonmutating keyword - // } else { diff --git a/cpp/src/Ice/ProxyAsync.cpp b/cpp/src/Ice/ProxyAsync.cpp index a3fb41e488b..8b2d39e599e 100644 --- a/cpp/src/Ice/ProxyAsync.cpp +++ b/cpp/src/Ice/ProxyAsync.cpp @@ -334,7 +334,7 @@ Ice::ObjectPrx::_iceI_isA(const shared_ptr>& outAsync, stri _checkTwowayOnly(operationName); outAsync->invoke( operationName, - OperationMode::Nonmutating, + OperationMode::Idempotent, FormatType::DefaultFormat, ctx, [&](Ice::OutputStream* os) { os->write(typeId, false); }, @@ -373,7 +373,7 @@ void Ice::ObjectPrx::_iceI_ping(const shared_ptr>& outAsync, const Context& ctx) const { static constexpr string_view operationName = "ice_ping"; - outAsync->invoke(operationName, OperationMode::Nonmutating, FormatType::DefaultFormat, ctx, nullptr, nullptr); + outAsync->invoke(operationName, OperationMode::Idempotent, FormatType::DefaultFormat, ctx, nullptr, nullptr); } vector @@ -411,7 +411,7 @@ Ice::ObjectPrx::_iceI_ids(const shared_ptr>>& outA _checkTwowayOnly(operationName); outAsync->invoke( operationName, - OperationMode::Nonmutating, + OperationMode::Idempotent, FormatType::DefaultFormat, ctx, nullptr, @@ -459,7 +459,7 @@ Ice::ObjectPrx::_iceI_id(const shared_ptr>& outAsync, con _checkTwowayOnly(operationName); outAsync->invoke( operationName, - OperationMode::Nonmutating, + OperationMode::Idempotent, FormatType::DefaultFormat, ctx, nullptr, diff --git a/csharp/src/Ice/Object.cs b/csharp/src/Ice/Object.cs index 3fa9239f477..80b3316eac7 100644 --- a/csharp/src/Ice/Object.cs +++ b/csharp/src/Ice/Object.cs @@ -258,14 +258,12 @@ private static string operationModeToString(OperationMode mode) public static void iceCheckMode(OperationMode expected, OperationMode received) { + Debug.Assert(expected != OperationMode.Nonmutating); // We never expect Nonmutating if (expected != received) { if (expected == OperationMode.Idempotent && received == OperationMode.Nonmutating) { - // - // Fine: typically an old client still using the - // deprecated nonmutating keyword - // + // Fine: typically an old client still using the deprecated nonmutating keyword } else { diff --git a/csharp/src/Ice/Proxy.cs b/csharp/src/Ice/Proxy.cs index b2ae1f3bf78..03e3c05e15b 100644 --- a/csharp/src/Ice/Proxy.cs +++ b/csharp/src/Ice/Proxy.cs @@ -632,7 +632,7 @@ private void iceI_ice_isA(string id, { iceCheckAsyncTwowayOnly(_ice_isA_name); getOutgoingAsync(completed).invoke(_ice_isA_name, - OperationMode.Nonmutating, + OperationMode.Idempotent, FormatType.DefaultFormat, context, synchronous, @@ -685,7 +685,7 @@ private void iceI_ice_ping(Dictionary context, OutgoingAsyncComp bool synchronous) { getOutgoingAsync(completed).invoke(_ice_ping_name, - OperationMode.Nonmutating, + OperationMode.Idempotent, FormatType.DefaultFormat, context, synchronous); @@ -740,7 +740,7 @@ private void iceI_ice_ids(Dictionary context, OutgoingAsyncCompl { iceCheckAsyncTwowayOnly(_ice_ids_name); getOutgoingAsync(completed).invoke(_ice_ids_name, - OperationMode.Nonmutating, + OperationMode.Idempotent, FormatType.DefaultFormat, context, synchronous, @@ -793,7 +793,7 @@ private void iceI_ice_id(Dictionary context, bool synchronous) { getOutgoingAsync(completed).invoke(_ice_id_name, - OperationMode.Nonmutating, + OperationMode.Idempotent, FormatType.DefaultFormat, context, synchronous, diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java index cec969c8ccf..bdbf001ecea 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java @@ -280,12 +280,10 @@ static void _iceCheckMode(OperationMode expected, OperationMode received) { expected = OperationMode.Normal; } + assert expected != OperationMode.Nonmutating; // We never expect Nonmutating if (expected != received) { if (expected == OperationMode.Idempotent && received == OperationMode.Nonmutating) { - // - // Fine: typically an old client still using the - // deprecated nonmutating keyword - // + // Fine: typically an old client still using the deprecated nonmutating keyword } else { MarshalException ex = new MarshalException(); ex.reason = diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java index 06dd5ca862b..32341a9741d 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/_ObjectPrxI.java @@ -35,7 +35,7 @@ public CompletableFuture ice_isAAsync(String id, Map co private OutgoingAsync _iceI_ice_isAAsync( String id, Map context, boolean sync) { OutgoingAsync f = - new OutgoingAsync<>(this, "ice_isA", OperationMode.Nonmutating, sync, null); + new OutgoingAsync<>(this, "ice_isA", OperationMode.Idempotent, sync, null); f.invoke(true, context, null, ostr -> ostr.writeString(id), istr -> istr.readBool()); return f; } @@ -58,7 +58,7 @@ public CompletableFuture ice_pingAsync(Map context) { private OutgoingAsync _iceI_ice_pingAsync(Map context, boolean sync) { OutgoingAsync f = - new OutgoingAsync<>(this, "ice_ping", OperationMode.Nonmutating, sync, null); + new OutgoingAsync<>(this, "ice_ping", OperationMode.Idempotent, sync, null); f.invoke(false, context, null, null, null); return f; } @@ -81,7 +81,7 @@ public CompletableFuture ice_idsAsync(Map context) { private OutgoingAsync _iceI_ice_idsAsync(Map context, boolean sync) { OutgoingAsync f = - new OutgoingAsync<>(this, "ice_ids", OperationMode.Nonmutating, sync, null); + new OutgoingAsync<>(this, "ice_ids", OperationMode.Idempotent, sync, null); f.invoke(true, context, null, null, istr -> istr.readStringSeq()); return f; } @@ -104,7 +104,7 @@ public CompletableFuture ice_idAsync(Map context) { private OutgoingAsync _iceI_ice_idAsync(Map context, boolean sync) { OutgoingAsync f = - new OutgoingAsync<>(this, "ice_id", OperationMode.Nonmutating, sync, null); + new OutgoingAsync<>(this, "ice_id", OperationMode.Idempotent, sync, null); f.invoke(true, context, null, null, istr -> istr.readString()); return f; } diff --git a/js/src/Ice/Operation.js b/js/src/Ice/Operation.js index 0d4a6542f15..b16b8d64dd8 100644 --- a/js/src/Ice/Operation.js +++ b/js/src/Ice/Operation.js @@ -639,10 +639,10 @@ Slice.defineOperations = function(classType, proxyType, ids, id, ops) // Slice.defineOperations(Ice.Object, Ice.ObjectPrx, ["::Ice::Object"], "::Ice::Object", { - ice_ping: [undefined, 1, undefined, undefined, undefined, undefined, undefined], - ice_isA: [undefined, 1, undefined, [1], [[7]], undefined, undefined], - ice_id: [undefined, 1, undefined, [7], undefined, undefined, undefined], - ice_ids: [undefined, 1, undefined, ["Ice.StringSeqHelper"], undefined, undefined, undefined] + ice_ping: [undefined, 2, undefined, undefined, undefined, undefined, undefined], + ice_isA: [undefined, 2, undefined, [1], [[7]], undefined, undefined], + ice_id: [undefined, 2, undefined, [7], undefined, undefined, undefined], + ice_ids: [undefined, 2, undefined, ["Ice.StringSeqHelper"], undefined, undefined, undefined] }); module.exports.Ice = Ice; diff --git a/matlab/lib/+Ice/ObjectPrx.m b/matlab/lib/+Ice/ObjectPrx.m index 3f00b026b17..ebb138262c0 100644 --- a/matlab/lib/+Ice/ObjectPrx.m +++ b/matlab/lib/+Ice/ObjectPrx.m @@ -185,7 +185,7 @@ function ice_ping(obj, varargin) % Parameters: % context - Optional context map for the invocation. - obj.iceInvoke('ice_ping', 1, false, [], false, {}, varargin{:}); + obj.iceInvoke('ice_ping', 2, false, [], false, {}, varargin{:}); end function r = ice_pingAsync(obj, varargin) @@ -198,7 +198,7 @@ function ice_ping(obj, varargin) % Returns (Ice.Future) - A future that will be completed when the % invocation completes. - r = obj.iceInvokeAsync('ice_ping', 1, false, [], 0, [], {}, varargin{:}); + r = obj.iceInvokeAsync('ice_ping', 2, false, [], 0, [], {}, varargin{:}); end function r = ice_isA(obj, id, varargin) @@ -215,7 +215,7 @@ function ice_ping(obj, varargin) os = obj.iceStartWriteParams([]); os.writeString(id); obj.iceEndWriteParams(os); - is = obj.iceInvoke('ice_isA', 1, true, os, true, {}, varargin{:}); + is = obj.iceInvoke('ice_isA', 2, true, os, true, {}, varargin{:}); is.startEncapsulation(); r = is.readBool(); is.endEncapsulation(); @@ -240,7 +240,7 @@ function ice_ping(obj, varargin) varargout{1} = is.readBool(); is.endEncapsulation(); end - r = obj.iceInvokeAsync('ice_isA', 1, true, os, 1, @unmarshal, {}, varargin{:}); + r = obj.iceInvokeAsync('ice_isA', 2, true, os, 1, @unmarshal, {}, varargin{:}); end function r = ice_id(obj, varargin) @@ -252,7 +252,7 @@ function ice_ping(obj, varargin) % % Returns (char) - The Slice type ID of the most-derived interface. - is = obj.iceInvoke('ice_id', 1, true, [], true, {}, varargin{:}); + is = obj.iceInvoke('ice_id', 2, true, [], true, {}, varargin{:}); is.startEncapsulation(); r = is.readString(); is.endEncapsulation(); @@ -273,7 +273,7 @@ function ice_ping(obj, varargin) varargout{1} = is.readString(); is.endEncapsulation(); end - r = obj.iceInvokeAsync('ice_id', 1, true, [], 1, @unmarshal, {}, varargin{:}); + r = obj.iceInvokeAsync('ice_id', 2, true, [], 1, @unmarshal, {}, varargin{:}); end function r = ice_ids(obj, varargin) @@ -286,7 +286,7 @@ function ice_ping(obj, varargin) % Returns (cell array of char) - The Slice type IDs of the % interfaces supported by the target object, in alphabetical order. - is = obj.iceInvoke('ice_ids', 1, true, [], true, {}, varargin{:}); + is = obj.iceInvoke('ice_ids', 2, true, [], true, {}, varargin{:}); is.startEncapsulation(); r = is.readStringSeq(); is.endEncapsulation(); @@ -307,7 +307,7 @@ function ice_ping(obj, varargin) varargout{1} = is.readStringSeq(); is.endEncapsulation(); end - r = obj.iceInvokeAsync('ice_ids', 1, true, [], 1, @unmarshal, {}, varargin{:}); + r = obj.iceInvokeAsync('ice_ids', 2, true, [], 1, @unmarshal, {}, varargin{:}); end function r = ice_getIdentity(obj) diff --git a/php/lib/Ice.php b/php/lib/Ice.php index 30832d00fea..c0eda63b6f4 100644 --- a/php/lib/Ice.php +++ b/php/lib/Ice.php @@ -210,11 +210,11 @@ class FormatType $Ice_Encoding_1_0 = new Ice\EncodingVersion(1, 0); $Ice_Encoding_1_1 = new Ice\EncodingVersion(1, 1); - IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_isA', 1, 0, array(array($IcePHP__t_string)), null, + IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_isA', 2, 0, array(array($IcePHP__t_string)), null, array($IcePHP__t_bool), null); - IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_ping', 1, 0, null, null, null, null); - IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_id', 1, 0, null, null, array($IcePHP__t_string), null); - IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_ids', 1, 0, null, null, array($Ice__t_StringSeq), null); + IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_ping', 2, 0, null, null, null, null); + IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_id', 2, 0, null, null, array($IcePHP__t_string), null); + IcePHP_defineOperation($Ice__t_ObjectPrx, 'ice_ids', 2, 0, null, null, array($Ice__t_StringSeq), null); } namespace Ice diff --git a/python/python/Ice/__init__.py b/python/python/Ice/__init__.py index 79cccfd7f1e..578f97106d3 100644 --- a/python/python/Ice/__init__.py +++ b/python/python/Ice/__init__.py @@ -1948,7 +1948,7 @@ def _callbackOnInterruptCallback(self, sig): Object._op_ice_isA = IcePy.Operation( "ice_isA", - OperationMode.Nonmutating, + OperationMode.Idempotent, False, None, (), @@ -1959,7 +1959,7 @@ def _callbackOnInterruptCallback(self, sig): ) Object._op_ice_ping = IcePy.Operation( "ice_ping", - OperationMode.Nonmutating, + OperationMode.Idempotent, False, None, (), @@ -1970,7 +1970,7 @@ def _callbackOnInterruptCallback(self, sig): ) Object._op_ice_ids = IcePy.Operation( "ice_ids", - OperationMode.Nonmutating, + OperationMode.Idempotent, False, None, (), @@ -1981,7 +1981,7 @@ def _callbackOnInterruptCallback(self, sig): ) Object._op_ice_id = IcePy.Operation( "ice_id", - OperationMode.Nonmutating, + OperationMode.Idempotent, False, None, (), diff --git a/slice/Ice/OperationMode.ice b/slice/Ice/OperationMode.ice index 05e5085d512..de4e0d6d225 100644 --- a/slice/Ice/OperationMode.ice +++ b/slice/Ice/OperationMode.ice @@ -32,21 +32,17 @@ module Ice /// will not violate at-most-once semantics for Normal operations. Normal, - /// Operations that use the Slice nonmutating keyword must not modify object state. For C++, - /// nonmutating operations generate const member functions in the skeleton. In addition, the Ice - /// run time will attempt to transparently recover from certain run-time errors by re-issuing a failed request - /// and propagate the failure to the application only if the second attempt fails. + /// Operations that are nonmutating must not modify object state. + /// The Ice run-time no longer makes a distinction between nonmutating operations and idempotent operations. ///

Nonmutating is deprecated; Use the idempotent keyword /// instead. - /// For C++, to retain the mapping of nonmutating operations to C++ const member - /// functions, use the ["cpp:const"] metadata directive. Nonmutating, /// Operations that use the Slice idempotent keyword can modify object state, but invoking an /// operation twice in a row must result in the same object state as invoking it once. For example, - /// x = 1 is an idempotent statement, whereas x += 1 is not. For idempotent - /// operations, the Ice run-time uses the same retry behavior as for nonmutating operations in case of a - /// potentially recoverable error. + /// x = 1 is an idempotent statement, whereas x += 1 is not. In addition, the Ice + /// run time will attempt to transparently recover from certain run-time errors by re-issuing a failed request + /// and propagate the failure to the application only if the second attempt fails. Idempotent } } diff --git a/swift/src/Ice/Proxy.swift b/swift/src/Ice/Proxy.swift index fedc3271d88..7b9061654cd 100644 --- a/swift/src/Ice/Proxy.swift +++ b/swift/src/Ice/Proxy.swift @@ -386,7 +386,7 @@ public func == (lhs: ObjectPrx?, rhs: ObjectPrx?) -> Bool { } extension ObjectPrx { - /// Returns the underdlying implementation object (Ice internal). + /// Returns the underlying implementation object (Ice internal). public var _impl: ObjectPrxI { return self as! ObjectPrxI } @@ -400,7 +400,7 @@ extension ObjectPrx { public func ice_ping(context: Context? = nil) throws { try _impl._invoke( operation: "ice_ping", - mode: OperationMode.Nonmutating, + mode: OperationMode.Idempotent, context: context) } @@ -426,7 +426,7 @@ extension ObjectPrx { ) -> Promise { return _impl._invokeAsync( operation: "ice_ping", - mode: .Nonmutating, + mode: .Idempotent, context: context, sentOn: sentOn, sentFlags: sentFlags, @@ -444,7 +444,7 @@ extension ObjectPrx { public func ice_isA(id: String, context: Context? = nil) throws -> Bool { return try _impl._invoke( operation: "ice_isA", - mode: .Nonmutating, + mode: .Idempotent, write: { ostr in ostr.write(id) }, @@ -476,7 +476,7 @@ extension ObjectPrx { ) -> Promise { return _impl._invokeAsync( operation: "ice_isA", - mode: .Nonmutating, + mode: .Idempotent, write: { ostr in ostr.write(id) }, @@ -495,7 +495,7 @@ extension ObjectPrx { public func ice_id(context: Context? = nil) throws -> String { return try _impl._invoke( operation: "ice_id", - mode: .Nonmutating, + mode: .Idempotent, read: { istr in try istr.read() as String }, context: context) } @@ -522,7 +522,7 @@ extension ObjectPrx { ) -> Promise { return _impl._invokeAsync( operation: "ice_id", - mode: .Nonmutating, + mode: .Idempotent, read: { istr in try istr.read() as String }, context: context, sentOn: sentOn, @@ -539,7 +539,7 @@ extension ObjectPrx { public func ice_ids(context: Context? = nil) throws -> StringSeq { return try _impl._invoke( operation: "ice_ids", - mode: .Nonmutating, + mode: .Idempotent, read: { istr in try istr.read() as StringSeq }, context: context) } @@ -566,7 +566,7 @@ extension ObjectPrx { ) -> Promise { return _impl._invokeAsync( operation: "ice_ids", - mode: .Nonmutating, + mode: .Idempotent, read: { istr in try istr.read() as StringSeq }, context: context, sentOn: sentOn, From ebc40a49b72833a0fe53da1e00f9c2cc6e4346f5 Mon Sep 17 00:00:00 2001 From: Austin Henriksen Date: Tue, 7 May 2024 11:51:39 -0400 Subject: [PATCH 3/3] Fixed C++ test header files. --- cpp/test/Ice/operations/TestAMDI.h | 8 -------- cpp/test/Ice/operations/TestI.h | 8 -------- 2 files changed, 16 deletions(-) diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h index 45a8a0c6337..e98af8fbe8b 100644 --- a/cpp/test/Ice/operations/TestAMDI.h +++ b/cpp/test/Ice/operations/TestAMDI.h @@ -12,14 +12,6 @@ class MyDerivedClassI final : public Test::MyDerivedClass public: MyDerivedClassI(); - // - // Override the Object "pseudo" operations to verify the operation mode. - // - bool ice_isA(std::string, const Ice::Current&) const; - void ice_ping(const Ice::Current&) const; - std::vector ice_ids(const Ice::Current&) const; - std::string ice_id(const Ice::Current&) const; - void shutdownAsync(std::function, std::function, const Ice::Current&) final; void supportsCompressAsync(std::function, std::function, const Ice::Current&) diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index e4d99b8a4a1..422476fe280 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -12,14 +12,6 @@ class MyDerivedClassI final : public Test::MyDerivedClass public: MyDerivedClassI(); - // - // Override the Object "pseudo" operations to verify the operation mode. - // - bool ice_isA(std::string, const Ice::Current&) const final; - void ice_ping(const Ice::Current&) const final; - std::vector ice_ids(const Ice::Current&) const final; - std::string ice_id(const Ice::Current&) const final; - void shutdown(const Ice::Current&) final; bool supportsCompress(const Ice::Current&) final;