diff options
69 files changed, 830 insertions, 39 deletions
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 6315c900650..2b65602d59b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -6740,12 +6740,17 @@ Slice::Gen::Cpp11ProxyVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocSummary(H, p); H << nl << "class " << _dllClassExport << p->name() << "Prx : public virtual " << getUnqualified("::Ice::Proxy", scope) << "<" << fixKwd(p->name() + "Prx") << ", "; - if(bases.empty() || (base && base->allOperations().empty())) + if(bases.empty() || (bases.size() == 1 && base && base->allOperations().empty())) { H << getUnqualified("::Ice::ObjectPrx", scope); } else { + if(base && base->allOperations().empty()) + { + bases.pop_front(); + } + ClassList::const_iterator q = bases.begin(); while(q != bases.end()) { @@ -7870,12 +7875,17 @@ Slice::Gen::Cpp11InterfaceVisitor::visitClassDefStart(const ClassDefPtr& p) writeDocSummary(H, p); H << nl << "class " << _dllExport << name << " : "; H.useCurrentPosAsIndent(); - if(bases.empty() || (base && base->allOperations().empty())) + if(bases.empty() || (base && bases.size() == 1 && base->allOperations().empty())) { H << "public virtual " << getUnqualified("::Ice::Object", scope); } else { + if(base && base->allOperations().empty()) + { + bases.pop_front(); + } + ClassList::const_iterator q = bases.begin(); while(q != bases.end()) { diff --git a/cpp/src/slice2matlab/Main.cpp b/cpp/src/slice2matlab/Main.cpp index 0b3de868384..353556bc814 100644 --- a/cpp/src/slice2matlab/Main.cpp +++ b/cpp/src/slice2matlab/Main.cpp @@ -1616,7 +1616,7 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) const string name = fixIdent(p->name()); const string scoped = p->scoped(); const string abs = getAbsolute(p); - const ClassList bases = p->bases(); + ClassList bases = p->bases(); const OperationList allOps = p->allOperations(); const string self = name == "obj" ? "this" : "obj"; @@ -2527,17 +2527,29 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) out.inc(); out << nl << "function obj = " << prxName << "(communicator, encoding, impl, bytes)"; out.inc(); - if(!bases.empty()) + + ClassDefPtr base; + if(!bases.empty() && !bases.front()->isInterface()) + { + base = bases.front(); + } + + if(bases.empty() || (bases.size() == 1 && base && base->allOperations().empty())) { + out << nl << "obj = obj@Ice.ObjectPrx(communicator, encoding, impl, bytes);"; + } + else + { + if(base && base->allOperations().empty()) + { + bases.pop_front(); + } + for(ClassList::const_iterator q = bases.begin(); q != bases.end(); ++q) { out << nl << "obj = obj@" << getAbsolute(*q, "", "Prx") << "(communicator, encoding, impl, bytes);"; } } - else - { - out << nl << "obj = obj@Ice.ObjectPrx(communicator, encoding, impl, bytes);"; - } out.dec(); out << nl << "end"; out.dec(); diff --git a/cpp/test/Ice/operations/AllTests.cpp b/cpp/test/Ice/operations/AllTests.cpp index b498d5c23f7..8522458a1f9 100644 --- a/cpp/test/Ice/operations/AllTests.cpp +++ b/cpp/test/Ice/operations/AllTests.cpp @@ -19,9 +19,9 @@ allTests(Test::TestHelper* helper) Test::MyDerivedClassPrxPtr derived = ICE_CHECKED_CAST(Test::MyDerivedClassPrx, cl); cout << "testing twoway operations... " << flush; - void twoways(const Ice::CommunicatorPtr&, const Test::MyClassPrxPtr&); - twoways(communicator, cl); - twoways(communicator, derived); + void twoways(const Ice::CommunicatorPtr&, Test::TestHelper*, const Test::MyClassPrxPtr&); + twoways(communicator, helper, cl); + twoways(communicator, helper, derived); derived->opDerived(); cout << "ok" << endl; diff --git a/cpp/test/Ice/operations/Collocated.cpp b/cpp/test/Ice/operations/Collocated.cpp index 3f4d00dd484..974d852ee84 100644 --- a/cpp/test/Ice/operations/Collocated.cpp +++ b/cpp/test/Ice/operations/Collocated.cpp @@ -25,6 +25,7 @@ Collocated::run(int argc, char** argv) communicator->getProperties()->setProperty("TestAdapter.AdapterId", "test"); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); Ice::ObjectPrxPtr prx = adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), Ice::stringToIdentity("test")); + adapter->add(ICE_MAKE_SHARED(BI), Ice::stringToIdentity("b")); //adapter->activate(); // Don't activate OA to ensure collocation is used. test(!prx->ice_getConnection()); diff --git a/cpp/test/Ice/operations/Server.cpp b/cpp/test/Ice/operations/Server.cpp index 450e1d3adeb..cc973f5a009 100644 --- a/cpp/test/Ice/operations/Server.cpp +++ b/cpp/test/Ice/operations/Server.cpp @@ -30,6 +30,7 @@ Server::run(int argc, char** argv) communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint()); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), Ice::stringToIdentity("test")); + adapter->add(ICE_MAKE_SHARED(BI), Ice::stringToIdentity("b")); adapter->activate(); serverReady(); communicator->waitForShutdown(); diff --git a/cpp/test/Ice/operations/ServerAMD.cpp b/cpp/test/Ice/operations/ServerAMD.cpp index 0e3194d70c9..0dcd7318aec 100644 --- a/cpp/test/Ice/operations/ServerAMD.cpp +++ b/cpp/test/Ice/operations/ServerAMD.cpp @@ -30,6 +30,7 @@ ServerAMD::run(int argc, char** argv) communicator->getProperties()->setProperty("TestAdapter.Endpoints", getTestEndpoint()); Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter("TestAdapter"); adapter->add(ICE_MAKE_SHARED(MyDerivedClassI), Ice::stringToIdentity("test")); + adapter->add(ICE_MAKE_SHARED(BI), Ice::stringToIdentity("b")); adapter->activate(); serverReady(); communicator->waitForShutdown(); diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice index 69ff785f765..e152939fbdd 100644 --- a/cpp/test/Ice/operations/Test.ice +++ b/cpp/test/Ice/operations/Test.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -434,3 +436,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/cpp/test/Ice/operations/TestAMD.ice b/cpp/test/Ice/operations/TestAMD.ice index a07b31a9547..3f009bfbcde 100644 --- a/cpp/test/Ice/operations/TestAMD.ice +++ b/cpp/test/Ice/operations/TestAMD.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -416,3 +418,26 @@ const ["cpp:type:wstring"]string wsu1 = "\u0128\u0178\u00FF\u0100\u1F00\U0001019 const ["cpp:type:wstring"]string wsu2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + ["amd"] interface Intf + { + void opIntf(); + } + + ["amd"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp index cea51a31519..3db268fc2c8 100644 --- a/cpp/test/Ice/operations/TestAMDI.cpp +++ b/cpp/test/Ice/operations/TestAMDI.cpp @@ -1040,6 +1040,22 @@ MyDerivedClassI::opMDict2Async(Test::StringStringD p1, response(OpMDict2MarshaledResult(p1, p1, current)); } +void +BI::opIntfAsync(function<void()> response, + function<void(std::exception_ptr)>, + const Ice::Current&) +{ + response(); +} + +void +BI::opBAsync(function<void()> response, + function<void(std::exception_ptr)>, + const Ice::Current&) +{ + response(); +} + #else class Thread_opVoid : public IceUtil::Thread @@ -1913,4 +1929,17 @@ MyDerivedClassI::opMDict2_async(const Test::AMD_MyClass_opMDict2Ptr& cb, cb->ice_response(p1,p1); } +void +BI::opIntf_async(const ::M::AMD_Intf_opIntfPtr& cb, + const ::Ice::Current&) +{ + cb->ice_response(); +} + +void +BI::opB_async(const ::M::AMD_B_opBPtr& cb, + const ::Ice::Current&) +{ + cb->ice_response(); +} #endif diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h index 7137dd6d785..1aa49233acf 100644 --- a/cpp/test/Ice/operations/TestAMDI.h +++ b/cpp/test/Ice/operations/TestAMDI.h @@ -689,4 +689,25 @@ private: int _opByteSOnewayCallCount; }; +#ifdef ICE_CPP11_MAPPING +class BI : public M::BDisp +{ +public: + + void opIntfAsync(std::function<void()>, std::function<void(std::exception_ptr)>, const Ice::Current&); + void opBAsync(std::function<void()>, std::function<void(std::exception_ptr)>, const Ice::Current&); +}; + +#else + +class BI : public M::B +{ +public: + + void opIntf_async(const ::M::AMD_Intf_opIntfPtr&, const ::Ice::Current& current); + void opB_async(const ::M::AMD_B_opBPtr&, const ::Ice::Current& current); +}; + +#endif + #endif diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp index 4e17266f8a7..5f5457396fc 100644 --- a/cpp/test/Ice/operations/TestI.cpp +++ b/cpp/test/Ice/operations/TestI.cpp @@ -874,6 +874,16 @@ MyDerivedClassI::opMDict2(ICE_IN(Test::StringStringD) p1, const Ice::Current& cu return OpMDict2MarshaledResult(p1, p1, current); } +void +BI::opIntf(const Ice::Current&) +{ +} + +void +BI::opB(const Ice::Current&) +{ +} + #else Test::Structure @@ -917,4 +927,13 @@ MyDerivedClassI::opMDict2(ICE_IN(Test::StringStringD) p1, Test::StringStringD& p return p1; } +void +BI::opIntf(const Ice::Current&) +{ +} + +void +BI::opB(const Ice::Current&) +{ +} #endif diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h index 6c0f204a68e..dc2d276ff12 100644 --- a/cpp/test/Ice/operations/TestI.h +++ b/cpp/test/Ice/operations/TestI.h @@ -328,4 +328,16 @@ private: int _opByteSOnewayCallCount; }; +#ifdef ICE_CPP11_MAPPING +class BI : public M::BDisp +#else +class BI : public M::B +#endif +{ +public: + + void opIntf(const Ice::Current&); + void opB(const Ice::Current&); +}; + #endif diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp index 900ea4b4a26..41779343cd3 100644 --- a/cpp/test/Ice/operations/Twoways.cpp +++ b/cpp/test/Ice/operations/Twoways.cpp @@ -57,7 +57,7 @@ private: } void -twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) +twoways(const Ice::CommunicatorPtr& communicator, Test::TestHelper* helper, const Test::MyClassPrxPtr& p) { Test::StringS literals = p->opStringLiterals(); @@ -1869,4 +1869,10 @@ twoways(const Ice::CommunicatorPtr& communicator, const Test::MyClassPrxPtr& p) p3 = p->opMDict2(p1, p2); test(p2 == p1 && p3 == p1); } + + { + M::BPrxPtr b = ICE_UNCHECKED_CAST(M::BPrx, communicator->stringToProxy("b:" + helper->getTestEndpoint())); + b->opIntf(); + b->opB(); + } } diff --git a/csharp/test/Ice/operations/Collocated.cs b/csharp/test/Ice/operations/Collocated.cs index 92738f82b57..c104a284bb5 100644 --- a/csharp/test/Ice/operations/Collocated.cs +++ b/csharp/test/Ice/operations/Collocated.cs @@ -25,6 +25,7 @@ namespace Ice communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); //adapter.activate(); // Don't activate OA to ensure collocation is used. if(prx.ice_getConnection() != null) diff --git a/csharp/test/Ice/operations/MyDerivedClassAMDI.cs b/csharp/test/Ice/operations/MyDerivedClassAMDI.cs index 38d8cfaa092..74775e46652 100644 --- a/csharp/test/Ice/operations/MyDerivedClassAMDI.cs +++ b/csharp/test/Ice/operations/MyDerivedClassAMDI.cs @@ -13,6 +13,19 @@ namespace Ice { namespace AMD { + public sealed class BI : M.BDisp_ + { + public override Task opBAsync(Ice.Current current) + { + return Task.Delay(0); + } + + public override Task opIntfAsync(Ice.Current current) + { + return Task.Delay(0); + } + } + public sealed class MyDerivedClassI : Test.MyDerivedClassDisp_ { private static void test(bool b) diff --git a/csharp/test/Ice/operations/MyDerivedClassAMDTieI.cs b/csharp/test/Ice/operations/MyDerivedClassAMDTieI.cs index e2427cc8d83..aa2f2f6a654 100644 --- a/csharp/test/Ice/operations/MyDerivedClassAMDTieI.cs +++ b/csharp/test/Ice/operations/MyDerivedClassAMDTieI.cs @@ -15,6 +15,26 @@ namespace Ice { namespace tie { + public sealed class BI : M.BTie_ + { + public BI() : base(new BTieI()) + { + } + } + + public sealed class BTieI : M.BOperations_ + { + public Task opBAsync(Ice.Current current) + { + return Task.Delay(0); + } + + public Task opIntfAsync(Ice.Current current) + { + return Task.Delay(0); + } + } + public sealed class MyDerivedClassI : Test.MyDerivedClassTie_ { public MyDerivedClassI() : base(new MyDerivedClassTieI()) diff --git a/csharp/test/Ice/operations/MyDerivedClassI.cs b/csharp/test/Ice/operations/MyDerivedClassI.cs index 9abf64fcb64..cb1eaf8d236 100644 --- a/csharp/test/Ice/operations/MyDerivedClassI.cs +++ b/csharp/test/Ice/operations/MyDerivedClassI.cs @@ -9,6 +9,17 @@ namespace Ice { namespace operations { + public sealed class BI : M.BDisp_ + { + public override void opIntf(Ice.Current current) + { + } + + public override void opB(Ice.Current current) + { + } + } + public sealed class MyDerivedClassI : Test.MyDerivedClassDisp_ { private static void test(bool b) diff --git a/csharp/test/Ice/operations/MyDerivedClassTieI.cs b/csharp/test/Ice/operations/MyDerivedClassTieI.cs index 46051d75899..071330083f9 100644 --- a/csharp/test/Ice/operations/MyDerivedClassTieI.cs +++ b/csharp/test/Ice/operations/MyDerivedClassTieI.cs @@ -11,6 +11,24 @@ namespace Ice { namespace tie { + public sealed class BI : M.BTie_ + { + public BI() : base(new BTieI()) + { + } + } + + public sealed class BTieI : M.BOperations_ + { + public void opIntf(Ice.Current current) + { + } + + public void opB(Ice.Current current) + { + } + } + public sealed class MyDerivedClassI : Test.MyDerivedClassTie_ { public MyDerivedClassI() : base(new MyDerivedClassTieI()) diff --git a/csharp/test/Ice/operations/Server.cs b/csharp/test/Ice/operations/Server.cs index 31d66961dd4..262582ba423 100644 --- a/csharp/test/Ice/operations/Server.cs +++ b/csharp/test/Ice/operations/Server.cs @@ -30,6 +30,7 @@ namespace Ice communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/csharp/test/Ice/operations/ServerAMD.cs b/csharp/test/Ice/operations/ServerAMD.cs index 5c245750c33..30d7e522172 100644 --- a/csharp/test/Ice/operations/ServerAMD.cs +++ b/csharp/test/Ice/operations/ServerAMD.cs @@ -33,6 +33,7 @@ namespace Ice communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/csharp/test/Ice/operations/ServerAMDTie.cs b/csharp/test/Ice/operations/ServerAMDTie.cs index fec2a56474b..2f61e62cef8 100644 --- a/csharp/test/Ice/operations/ServerAMDTie.cs +++ b/csharp/test/Ice/operations/ServerAMDTie.cs @@ -35,6 +35,7 @@ namespace Ice communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/csharp/test/Ice/operations/ServerTie.cs b/csharp/test/Ice/operations/ServerTie.cs index 65ab9591de9..47cf2569a09 100644 --- a/csharp/test/Ice/operations/ServerTie.cs +++ b/csharp/test/Ice/operations/ServerTie.cs @@ -32,6 +32,7 @@ namespace Ice communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/csharp/test/Ice/operations/Test.ice b/csharp/test/Ice/operations/Test.ice index 894dcaebc43..de5e9aea807 100644 --- a/csharp/test/Ice/operations/Test.ice +++ b/csharp/test/Ice/operations/Test.ice @@ -6,7 +6,8 @@ #include <Ice/Current.ice> -[["cs:typeid-namespace:Ice.operations.TypeId"]] +[["cs:typeid-namespace:Ice.operations.TypeId", + "suppress-warning:deprecated"]] // For classes with operations ["cs:namespace:Ice.operations"] module Test @@ -367,3 +368,27 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +["cs:namespace:Ice.operations"] +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + ["cs:tie"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/csharp/test/Ice/operations/TestAMD.ice b/csharp/test/Ice/operations/TestAMD.ice index 2f22d325348..c48a10b1e3f 100644 --- a/csharp/test/Ice/operations/TestAMD.ice +++ b/csharp/test/Ice/operations/TestAMD.ice @@ -6,7 +6,8 @@ #include <Ice/Current.ice> -[["cs:typeid-namespace:Ice.operations.AMD.TypeId"]] +[["cs:typeid-namespace:Ice.operations.AMD.TypeId", + "suppress-warning:deprecated"]] // For classes with operations ["cs:namespace:Ice.operations.AMD"] module Test @@ -350,3 +351,27 @@ const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198 const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +["cs:namespace:Ice.operations"] +module M +{ + class A + { + int x; + // void opA(); + } + + ["amd"] interface Intf + { + void opIntf(); + } + + ["amd", "cs:tie"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/csharp/test/Ice/operations/Twoways.cs b/csharp/test/Ice/operations/Twoways.cs index 16edd45474d..ae949f66a00 100644 --- a/csharp/test/Ice/operations/Twoways.cs +++ b/csharp/test/Ice/operations/Twoways.cs @@ -1571,6 +1571,12 @@ namespace Ice test(Ice.CollectionComparer.Equals(p2, p1) && Ice.CollectionComparer.Equals(p3, p1)); } + + { + var b = M.BPrxHelper.uncheckedCast(communicator.stringToProxy("b:" + helper.getTestEndpoint(0))); + b.opIntf(); + b.opB(); + } } } } diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDBI.java b/java-compat/test/src/main/java/test/Ice/operations/AMDBI.java new file mode 100644 index 00000000000..974c327ca63 --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDBI.java @@ -0,0 +1,27 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +package test.Ice.operations; + +import Ice.Current; +import test.Ice.operations.AMD.M.*; + +import java.util.*; + +public final class AMDBI extends B +{ + @Override + public void + opB_async(AMD_B_opB cb, Ice.Current current) + { + cb.ice_response(); + } + + @Override + public void + opIntf_async(AMD_Intf_opIntf cb, Ice.Current current) + { + cb.ice_response(); + } +} diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java index fd9408a1472..12b89821b9b 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDServer.java @@ -21,6 +21,7 @@ public class AMDServer extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new AMDBI(), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDTieBI.java b/java-compat/test/src/main/java/test/Ice/operations/AMDTieBI.java new file mode 100644 index 00000000000..2d2f09e254b --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDTieBI.java @@ -0,0 +1,27 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +package test.Ice.operations; + +import Ice.Current; +import test.Ice.operations.AMD.M.*; + +import java.util.*; + +public final class AMDTieBI implements _BOperations +{ + @Override + synchronized public void + opB_async(AMD_B_opB cb, Ice.Current current) + { + cb.ice_response(); + } + + @Override + synchronized public void + opIntf_async(AMD_Intf_opIntf cb, Ice.Current current) + { + cb.ice_response(); + } +} diff --git a/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java index 8a71c6e372a..9deb52abae0 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/AMDTieServer.java @@ -5,6 +5,7 @@ package test.Ice.operations; import test.Ice.operations.AMD.Test._MyDerivedClassTie; +import test.Ice.operations.AMD.M._BTie; public class AMDTieServer extends test.TestHelper { @@ -24,6 +25,7 @@ public class AMDTieServer extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new _MyDerivedClassTie(new AMDTieMyDerivedClassI()), Ice.Util.stringToIdentity("test")); + adapter.add(new _BTie(new AMDBI()), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/java-compat/test/src/main/java/test/Ice/operations/BI.java b/java-compat/test/src/main/java/test/Ice/operations/BI.java new file mode 100644 index 00000000000..63976a332cb --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/operations/BI.java @@ -0,0 +1,23 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +package test.Ice.operations; + +import Ice.Current; +import test.Ice.operations.M.*; + +import java.util.*; + +public final class BI extends B +{ + @Override + public void opB(Current current) + { + } + + @Override + public void opIntf(Current current) + { + } +} diff --git a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java index 020e7d6741a..86f86851407 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Collocated.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Collocated.java @@ -29,6 +29,7 @@ public class Collocated extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); //adapter.activate(); // Don't activate OA to ensure collocation is used. if(prx.ice_getConnection() != null) diff --git a/java-compat/test/src/main/java/test/Ice/operations/Server.java b/java-compat/test/src/main/java/test/Ice/operations/Server.java index 9437a860d9f..eecc4db70ba 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Server.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Server.java @@ -21,6 +21,7 @@ public class Server extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Test.ice b/java-compat/test/src/main/java/test/Ice/operations/Test.ice index 3252f9d1462..e5b6561d884 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Test.ice +++ b/java-compat/test/src/main/java/test/Ice/operations/Test.ice @@ -6,7 +6,9 @@ #include <Ice/Current.ice> -[["java:package:test.Ice.operations"]] +[["java:package:test.Ice.operations", + "suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -348,3 +350,26 @@ const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198 const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + ["java:tie"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice b/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice index 72a7071f59f..6d3bcb651ad 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice +++ b/java-compat/test/src/main/java/test/Ice/operations/TestAMD.ice @@ -6,7 +6,9 @@ #include <Ice/Current.ice> -[["java:package:test.Ice.operations.AMD"]] +[["java:package:test.Ice.operations.AMD", + "suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -348,3 +350,26 @@ const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198 const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + ["amd"] interface Intf + { + void opIntf(); + } + + ["amd", "java:tie"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/java-compat/test/src/main/java/test/Ice/operations/TieBI.java b/java-compat/test/src/main/java/test/Ice/operations/TieBI.java new file mode 100644 index 00000000000..9be0954f6fa --- /dev/null +++ b/java-compat/test/src/main/java/test/Ice/operations/TieBI.java @@ -0,0 +1,25 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +package test.Ice.operations; + +import Ice.Current; +import test.Ice.operations.M.*; + +import java.util.*; + +public final class TieBI implements _BOperations +{ + @Override + public void + opB(Ice.Current current) + { + } + + @Override + public void + opIntf(Ice.Current current) + { + } +} diff --git a/java-compat/test/src/main/java/test/Ice/operations/TieServer.java b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java index a7f0cd91207..2fc392ebf9e 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/TieServer.java +++ b/java-compat/test/src/main/java/test/Ice/operations/TieServer.java @@ -5,6 +5,7 @@ package test.Ice.operations; import test.Ice.operations.Test._MyDerivedClassTie; +import test.Ice.operations.M._BTie; public class TieServer extends test.TestHelper { @@ -24,6 +25,7 @@ public class TieServer extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new _MyDerivedClassTie(new TieMyDerivedClassI()), Ice.Util.stringToIdentity("test")); + adapter.add(new _BTie(new BI()), Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); diff --git a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java index 8fd25beff04..663d5f0d898 100644 --- a/java-compat/test/src/main/java/test/Ice/operations/Twoways.java +++ b/java-compat/test/src/main/java/test/Ice/operations/Twoways.java @@ -7,6 +7,7 @@ package test.Ice.operations; import Ice.*; import Ice.Object; import test.Ice.operations.Test.*; +import test.Ice.operations.M.*; import java.util.ArrayList; import java.util.HashMap; @@ -1592,5 +1593,11 @@ class Twoways test(c.tesT.equals("Test.MyClass1.testT")); test(c.myClass == null); test(c.myClass1.equals("Test.MyClass1.myClass1")); + + { + BPrx b = BPrxHelper.uncheckedCast(communicator.stringToProxy("b:" + helper.getTestEndpoint())); + b.opB(); + b.opIntf(); + } } } diff --git a/java/test/src/main/java/test/Ice/operations/AMDBI.java b/java/test/src/main/java/test/Ice/operations/AMDBI.java new file mode 100644 index 00000000000..3436684ee59 --- /dev/null +++ b/java/test/src/main/java/test/Ice/operations/AMDBI.java @@ -0,0 +1,29 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +package test.Ice.operations; + +import java.util.*; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.CompletableFuture; + +import com.zeroc.Ice.Current; + +import test.Ice.operations.AMD.M.*; + +public final class AMDBI implements BDisp +{ + + @Override + synchronized public CompletionStage<Void> opIntfAsync(Current current) + { + return CompletableFuture.completedFuture((Void)null); + } + + @Override + synchronized public CompletionStage<Void> opBAsync(Current current) + { + return CompletableFuture.completedFuture((Void)null); + } +} diff --git a/java/test/src/main/java/test/Ice/operations/AMDServer.java b/java/test/src/main/java/test/Ice/operations/AMDServer.java index 43c080ed485..a27b4dc0228 100644 --- a/java/test/src/main/java/test/Ice/operations/AMDServer.java +++ b/java/test/src/main/java/test/Ice/operations/AMDServer.java @@ -21,6 +21,7 @@ public class AMDServer extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new AMDMyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); + adapter.add(new AMDBI(), com.zeroc.Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/java/test/src/main/java/test/Ice/operations/BI.java b/java/test/src/main/java/test/Ice/operations/BI.java new file mode 100644 index 00000000000..37a7a6e8eff --- /dev/null +++ b/java/test/src/main/java/test/Ice/operations/BI.java @@ -0,0 +1,24 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +package test.Ice.operations; + +import java.util.*; + +import com.zeroc.Ice.Current; + +import test.Ice.operations.M.*; + +public final class BI implements BDisp +{ + @Override + public void opIntf(Current current) + { + } + + @Override + public void opB(Current current) + { + } +} diff --git a/java/test/src/main/java/test/Ice/operations/Collocated.java b/java/test/src/main/java/test/Ice/operations/Collocated.java index 4785cef7142..be56fee636c 100644 --- a/java/test/src/main/java/test/Ice/operations/Collocated.java +++ b/java/test/src/main/java/test/Ice/operations/Collocated.java @@ -30,6 +30,7 @@ public class Collocated extends test.TestHelper java.io.PrintWriter out = getWriter(); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); com.zeroc.Ice.ObjectPrx prx = adapter.add(new MyDerivedClassI(), Util.stringToIdentity("test")); + adapter.add(new BI(), Util.stringToIdentity("b")); //adapter.activate(); // Don't activate OA to ensure collocation is used. if(prx.ice_getConnection() != null) diff --git a/java/test/src/main/java/test/Ice/operations/Server.java b/java/test/src/main/java/test/Ice/operations/Server.java index baff6875521..34fb69dc1a5 100644 --- a/java/test/src/main/java/test/Ice/operations/Server.java +++ b/java/test/src/main/java/test/Ice/operations/Server.java @@ -21,6 +21,7 @@ public class Server extends test.TestHelper communicator.getProperties().setProperty("TestAdapter.Endpoints", getTestEndpoint(0)); com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter("TestAdapter"); adapter.add(new MyDerivedClassI(), com.zeroc.Ice.Util.stringToIdentity("test")); + adapter.add(new BI(), com.zeroc.Ice.Util.stringToIdentity("b")); adapter.activate(); serverReady(); communicator.waitForShutdown(); diff --git a/java/test/src/main/java/test/Ice/operations/Test.ice b/java/test/src/main/java/test/Ice/operations/Test.ice index b5c3f3aef4e..6e3b4e2d226 100644 --- a/java/test/src/main/java/test/Ice/operations/Test.ice +++ b/java/test/src/main/java/test/Ice/operations/Test.ice @@ -6,7 +6,8 @@ #include <Ice/Current.ice> -[["java:package:test.Ice.operations"]] +[["java:package:test.Ice.operations", + "suppress-warning:deprecated"]] // For classes with operations module Test { @@ -363,3 +364,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/java/test/src/main/java/test/Ice/operations/TestAMD.ice b/java/test/src/main/java/test/Ice/operations/TestAMD.ice index 6679a612d2e..fdeaece92f1 100644 --- a/java/test/src/main/java/test/Ice/operations/TestAMD.ice +++ b/java/test/src/main/java/test/Ice/operations/TestAMD.ice @@ -6,7 +6,8 @@ #include <Ice/Current.ice> -[["java:package:test.Ice.operations.AMD"]] +[["java:package:test.Ice.operations.AMD", + "suppress-warning:deprecated"]] // For classes with operations module Test { @@ -348,3 +349,26 @@ const string su1 = "\u0128\u0178\u00FF\u0100\u1F00\U00010194\U0001016A\U00010198 const string su2 = "\U00000128\U00000178\U000000FF\U00000100\U00001F00\U00010194\U0001016A\U00010198\U0001F340\U0001F341\U0001F342\U0001F343"; } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + ["amd"] interface Intf + { + void opIntf(); + } + + ["amd"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/java/test/src/main/java/test/Ice/operations/Twoways.java b/java/test/src/main/java/test/Ice/operations/Twoways.java index 80c481aab1f..7cc9765307d 100644 --- a/java/test/src/main/java/test/Ice/operations/Twoways.java +++ b/java/test/src/main/java/test/Ice/operations/Twoways.java @@ -12,7 +12,7 @@ import java.util.Map; import com.zeroc.Ice.*; import test.Ice.operations.Test.*; - +import test.Ice.operations.M.*; class Twoways { private static void test(boolean b) @@ -1525,5 +1525,11 @@ class Twoways MyClass.OpMDict2Result r = p.opMDict2(p1); test(r.p2.equals(p1) && r.returnValue.equals(p1)); } + + { + BPrx b = BPrx.uncheckedCast(communicator.stringToProxy("b:" + helper.getTestEndpoint())); + b.opB(); + b.opIntf(); + } } } diff --git a/js/test/Ice/operations/AMDBI.js b/js/test/Ice/operations/AMDBI.js new file mode 100644 index 00000000000..bed043ea383 --- /dev/null +++ b/js/test/Ice/operations/AMDBI.js @@ -0,0 +1,25 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +(function(module, require, exports) +{ + const Ice = require("ice").Ice; + const M = require("Test").M; + + class AMDBI extends M.BDisp + { + opB() + { + } + + opIntf() + { + } + } + exports.AMDBI = AMDBI; +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : + (typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) ? self.Ice._require : window.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : + (typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) ? self : window)); diff --git a/js/test/Ice/operations/BI.js b/js/test/Ice/operations/BI.js new file mode 100644 index 00000000000..a68ea03ccae --- /dev/null +++ b/js/test/Ice/operations/BI.js @@ -0,0 +1,25 @@ +// +// Copyright (c) ZeroC, Inc. All rights reserved. +// + +(function(module, require, exports) +{ + const Ice = require("ice").Ice; + const M = require("Test").M; + + class BI extends M.BDisp + { + opB() + { + } + + opIntf() + { + } + } + exports.BI = BI; +}(typeof global !== "undefined" && typeof global.process !== "undefined" ? module : undefined, + typeof global !== "undefined" && typeof global.process !== "undefined" ? require : + (typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) ? self.Ice._require : window.Ice._require, + typeof global !== "undefined" && typeof global.process !== "undefined" ? exports : + (typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope) ? self : window)); diff --git a/js/test/Ice/operations/Client.js b/js/test/Ice/operations/Client.js index 7b3e91e1b0e..d6e55f75fd5 100644 --- a/js/test/Ice/operations/Client.js +++ b/js/test/Ice/operations/Client.js @@ -6,6 +6,7 @@ { const Ice = require("ice").Ice; const Test = require("Test").Test; + const M = require("Test").M; const TestHelper = require("TestHelper").TestHelper; const Twoways = require("Twoways").Twoways; const Oneways = require("Oneways").Oneways; @@ -23,8 +24,8 @@ const cl = await Test.MyClassPrx.checkedCast(base); const derived = await Test.MyDerivedClassPrx.checkedCast(cl); - await Twoways.run(communicator, cl, Test, bidir, this); - await Twoways.run(communicator, derived, Test, bidir, this); + await Twoways.run(communicator, cl, Test, M, bidir, this); + await Twoways.run(communicator, derived, Test, M, bidir, this); out.writeLine("ok"); out.write("testing oneway operations... "); diff --git a/js/test/Ice/operations/Server.js b/js/test/Ice/operations/Server.js index 6a1a45e95d9..fc023090ba9 100644 --- a/js/test/Ice/operations/Server.js +++ b/js/test/Ice/operations/Server.js @@ -8,6 +8,7 @@ const Test = require("Test").Test; const TestHelper = require("TestHelper").TestHelper; const MyDerivedClassI = require("MyDerivedClassI").MyDerivedClassI; + const BI = require("BI").BI; class Server extends TestHelper { @@ -23,6 +24,7 @@ echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint())); const adapter = await communicator.createObjectAdapter(""); adapter.add(new MyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test")); + adapter.add(new BI(), Ice.stringToIdentity("b")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); this.serverReady(); diff --git a/js/test/Ice/operations/ServerAMD.js b/js/test/Ice/operations/ServerAMD.js index 1260960957b..6995ff1c08c 100644 --- a/js/test/Ice/operations/ServerAMD.js +++ b/js/test/Ice/operations/ServerAMD.js @@ -8,6 +8,7 @@ const Test = require("Test").Test; const TestHelper = require("TestHelper").TestHelper; const AMDMyDerivedClassI = require("AMDMyDerivedClassI").AMDMyDerivedClassI; + const AMDBI = require("AMDBI").AMDBI; class ServerAMD extends TestHelper { @@ -23,6 +24,7 @@ echo = await Test.EchoPrx.checkedCast(communicator.stringToProxy("__echo:" + this.getTestEndpoint())); const adapter = await communicator.createObjectAdapter(""); adapter.add(new AMDMyDerivedClassI(echo.ice_getEndpoints()), Ice.stringToIdentity("test")); + adapter.add(new AMDBI(), Ice.stringToIdentity("b")); await echo.setConnection(); echo.ice_getCachedConnection().setAdapter(adapter); this.serverReady(); diff --git a/js/test/Ice/operations/Test.ice b/js/test/Ice/operations/Test.ice index 2f2810c9dca..153e9bc699a 100644 --- a/js/test/Ice/operations/Test.ice +++ b/js/test/Ice/operations/Test.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -372,3 +374,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/js/test/Ice/operations/Twoways.js b/js/test/Ice/operations/Twoways.js index 4bc92fd8b40..d0822052ceb 100644 --- a/js/test/Ice/operations/Twoways.js +++ b/js/test/Ice/operations/Twoways.js @@ -7,7 +7,7 @@ const Ice = require("ice").Ice; const test = require("TestHelper").TestHelper.test; - async function run(communicator, prx, Test, bidir, helper) + async function run(communicator, prx, Test, M, bidir, helper) { const literals = await prx.opStringLiterals(); @@ -1472,6 +1472,12 @@ } await prx.opDoubleMarshaling(1278312346.0 / 13.0, ds); } + + { + const b = M.BPrx.uncheckedCast(communicator.stringToProxy("b:" + helper.getTestEndpoint())); + await b.opB(); + await b.opIntf(); + } } exports.Twoways = {run: run}; diff --git a/matlab/test/Ice/operations/AllTests.m b/matlab/test/Ice/operations/AllTests.m index 31bad98aefe..498463144f0 100644 --- a/matlab/test/Ice/operations/AllTests.m +++ b/matlab/test/Ice/operations/AllTests.m @@ -6,6 +6,7 @@ classdef AllTests methods(Static) function r = allTests(helper) import Test.*; + import M.*; communicator = helper.communicator(); ref = ['test:', helper.getTestEndpoint()]; @@ -13,9 +14,11 @@ classdef AllTests cl = MyClassPrx.checkedCast(base); derived = MyDerivedClassPrx.checkedCast(cl); + bprx = BPrx.checkedCast(communicator.stringToProxy(['b:', helper.getTestEndpoint()])); + fprintf('testing twoway operations... '); - Twoways.twoways(helper, cl); - Twoways.twoways(helper, derived); + Twoways.twoways(helper, cl, bprx); + Twoways.twoways(helper, derived, bprx); derived.opDerived(); fprintf('ok\n'); diff --git a/matlab/test/Ice/operations/Test.ice b/matlab/test/Ice/operations/Test.ice index 2c7532d8d0f..1b2a80dc974 100644 --- a/matlab/test/Ice/operations/Test.ice +++ b/matlab/test/Ice/operations/Test.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -372,3 +374,27 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +["cs:namespace:Ice.operations"] +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + ["cs:tie"] class B extends A implements Intf + { + void opB(); + } +} diff --git a/matlab/test/Ice/operations/Twoways.m b/matlab/test/Ice/operations/Twoways.m index d7fc9c0621f..1cd100462b4 100644 --- a/matlab/test/Ice/operations/Twoways.m +++ b/matlab/test/Ice/operations/Twoways.m @@ -4,7 +4,7 @@ classdef Twoways methods(Static) - function twoways(helper, p) + function twoways(helper, p, bprx) import Test.*; literals = p.opStringLiterals(); @@ -1391,6 +1391,9 @@ classdef Twoways assert(strcmp(c.tesT, 'Test.MyClass1.testT')); assert(isempty(c.myClass)); assert(strcmp(c.myClass1, 'Test.MyClass1.myClass1')); + + bprx.opB(); + bprx.opIntf(); end end end diff --git a/php/test/Ice/operations/Client.php b/php/test/Ice/operations/Client.php index ff9ee9357aa..8355f2d0bbd 100644 --- a/php/test/Ice/operations/Client.php +++ b/php/test/Ice/operations/Client.php @@ -5,7 +5,7 @@ require_once('Test.php'); -function twoways($communicator, $p) +function twoways($communicator, $p, $bprx) { global $NS; @@ -1058,6 +1058,11 @@ function twoways($communicator, $p) $p3 = $p->opMDict2($p1, $p2); test($p3["test"] == "test" && $p2["test"] == "test"); } + + { + $bprx->opB(); + $bprx->opIntf(); + } } function allTests($helper) @@ -1070,10 +1075,12 @@ function allTests($helper) $cl = $base->ice_checkedCast("::Test::MyClass"); $derived = $cl->ice_checkedCast("::Test::MyDerivedClass"); + $bprx = $communicator->stringToProxy(sprintf("b:%s", $helper->getTestEndpoint()))->ice_checkedCast("::M::B"); + echo "testing twoway operations... "; flush(); - twoways($communicator, $cl); - twoways($communicator, $derived); + twoways($communicator, $cl, $bprx); + twoways($communicator, $derived, $bprx); $derived->opDerived(); echo "ok\n"; @@ -1109,7 +1116,6 @@ class Client extends TestHelper { throw $ex; } - echo "ok\n"; } # Test multiple destroy calls $communicator->destroy(); diff --git a/php/test/Ice/operations/Test.ice b/php/test/Ice/operations/Test.ice index 55c142c0556..9a66e40ab57 100644 --- a/php/test/Ice/operations/Test.ice +++ b/php/test/Ice/operations/Test.ice @@ -4,6 +4,8 @@ #pragma once +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -340,3 +342,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/python/test/Ice/operations/AllTests.py b/python/test/Ice/operations/AllTests.py index 457dbceaf96..3f9decd88f2 100644 --- a/python/test/Ice/operations/AllTests.py +++ b/python/test/Ice/operations/AllTests.py @@ -2,7 +2,7 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice, Test, Twoways, TwowaysFuture, TwowaysAMI, Oneways, OnewaysFuture, OnewaysAMI, BatchOneways, sys +import Ice, Test, M, Twoways, TwowaysFuture, TwowaysAMI, Oneways, OnewaysFuture, OnewaysAMI, BatchOneways, sys import BatchOnewaysAMI, BatchOnewaysFuture def test(b): @@ -14,11 +14,12 @@ def allTests(helper, communicator): base = communicator.stringToProxy(ref) cl = Test.MyClassPrx.checkedCast(base) derived = Test.MyDerivedClassPrx.checkedCast(cl) + bprx = M.BPrx.checkedCast(communicator.stringToProxy("b:{0}".format(helper.getTestEndpoint()))) sys.stdout.write("testing twoway operations... ") sys.stdout.flush() - Twoways.twoways(helper, cl) - Twoways.twoways(helper, derived) + Twoways.twoways(helper, cl, bprx) + Twoways.twoways(helper, derived, bprx) derived.opDerived() print("ok") diff --git a/python/test/Ice/operations/Collocated.py b/python/test/Ice/operations/Collocated.py index fc758b63767..06f23dbc30a 100755 --- a/python/test/Ice/operations/Collocated.py +++ b/python/test/Ice/operations/Collocated.py @@ -19,6 +19,7 @@ class Collocated(TestHelper): communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) adapter = communicator.createObjectAdapter("TestAdapter") prx = adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.add(TestI.BI(), Ice.stringToIdentity("b")) # adapter.activate() // Don't activate OA to ensure collocation is used. if prx.ice_getConnection(): raise RuntimeError("collocation doesn't work") diff --git a/python/test/Ice/operations/Server.py b/python/test/Ice/operations/Server.py index fcfd76a0c11..c909fd0be2d 100755 --- a/python/test/Ice/operations/Server.py +++ b/python/test/Ice/operations/Server.py @@ -24,5 +24,6 @@ class Server(TestHelper): communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(TestI.MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.add(TestI.BI(), Ice.stringToIdentity("b")) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/operations/ServerAMD.py b/python/test/Ice/operations/ServerAMD.py index b0c61270b0c..da0d55ba0bb 100755 --- a/python/test/Ice/operations/ServerAMD.py +++ b/python/test/Ice/operations/ServerAMD.py @@ -14,6 +14,7 @@ if sys.version_info >= (3, 5): else: from TestAMDI import MyDerivedClassI +from TestAMDI import BI from TestHelper import TestHelper TestHelper.loadSlice("Test.ice") @@ -35,5 +36,6 @@ class ServerAMD(TestHelper): communicator.getProperties().setProperty("TestAdapter.Endpoints", self.getTestEndpoint()) adapter = communicator.createObjectAdapter("TestAdapter") adapter.add(MyDerivedClassI(), Ice.stringToIdentity("test")) + adapter.add(BI(), Ice.stringToIdentity("b")) adapter.activate() communicator.waitForShutdown() diff --git a/python/test/Ice/operations/Test.ice b/python/test/Ice/operations/Test.ice index 4eb1f2c7d97..78caa951346 100644 --- a/python/test/Ice/operations/Test.ice +++ b/python/test/Ice/operations/Test.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -362,3 +364,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/python/test/Ice/operations/TestAMDCoroI.py b/python/test/Ice/operations/TestAMDCoroI.py index 1f337e134c8..b1bc54ff448 100755 --- a/python/test/Ice/operations/TestAMDCoroI.py +++ b/python/test/Ice/operations/TestAMDCoroI.py @@ -11,7 +11,7 @@ if not slice_dir: sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") -import Test +import Test, M def test(b): if not b: diff --git a/python/test/Ice/operations/TestAMDI.py b/python/test/Ice/operations/TestAMDI.py index 9e89185ece0..305b8e79faa 100755 --- a/python/test/Ice/operations/TestAMDI.py +++ b/python/test/Ice/operations/TestAMDI.py @@ -11,7 +11,7 @@ if not slice_dir: sys.exit(1) Ice.loadSlice("'-I" + slice_dir + "' Test.ice") -import Test +import Test, M def test(b): if not b: @@ -27,6 +27,14 @@ class FutureThread(threading.Thread): time.sleep(0.01) self.future.set_result(self.result) + +class BI(M.BDisp): + def opB(self, current=None): + return Ice.Future.completed(()) + + def opIntf(self, current=None): + return Ice.Future.completed(()) + class MyDerivedClassI(Test.MyDerivedClass): def __init__(self): self.threads = [] diff --git a/python/test/Ice/operations/TestI.py b/python/test/Ice/operations/TestI.py index fc1d3e8bb1e..287985df157 100644 --- a/python/test/Ice/operations/TestI.py +++ b/python/test/Ice/operations/TestI.py @@ -2,12 +2,22 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -import Ice, Test, sys, threading +import Ice, Test, M, sys, threading def test(b): if not b: raise RuntimeError('test assertion failed') + +class BI(M.BDisp): + + def opB(self, current=None): + pass + + def opIntf(self, current=None): + pass + + class MyDerivedClassI(Test.MyDerivedClass): def __init__(self): self.lock = threading.Lock() diff --git a/python/test/Ice/operations/Twoways.py b/python/test/Ice/operations/Twoways.py index bc138341c2c..03f0a2f479d 100644 --- a/python/test/Ice/operations/Twoways.py +++ b/python/test/Ice/operations/Twoways.py @@ -9,7 +9,7 @@ def test(b): if not b: raise RuntimeError('test assertion failed') -def twoways(helper, p): +def twoways(helper, p, bprx): communicator = helper.communicator() literals = p.opStringLiterals() @@ -1431,3 +1431,6 @@ def twoways(helper, p): p1 = { "test": "test" } (p3, p2) = p.opMDict2(p1) test(p3["test"] == "test" and p2["test"] == "test") + + bprx.opB() + bprx.opIntf() diff --git a/ruby/test/Ice/operations/AllTests.rb b/ruby/test/Ice/operations/AllTests.rb index eef08818c13..ffc8bc176cc 100644 --- a/ruby/test/Ice/operations/AllTests.rb +++ b/ruby/test/Ice/operations/AllTests.rb @@ -11,10 +11,12 @@ def allTests(helper, communicator) cl = Test::MyClassPrx::checkedCast(base) derived = Test::MyDerivedClassPrx::checkedCast(cl) + bprx = M::BPrx::checkedCast(communicator.stringToProxy("b:#{helper.getTestEndpoint()}")) + print "testing twoway operations... " STDOUT.flush - twoways(helper, communicator, cl) - twoways(helper, communicator, derived) + twoways(helper, communicator, cl, bprx) + twoways(helper, communicator, derived, bprx) derived.opDerived() puts "ok" diff --git a/ruby/test/Ice/operations/Test.ice b/ruby/test/Ice/operations/Test.ice index 2cd152f9ac2..3db80516d59 100644 --- a/ruby/test/Ice/operations/Test.ice +++ b/ruby/test/Ice/operations/Test.ice @@ -6,6 +6,8 @@ #include <Ice/Current.ice> +[["suppress-warning:deprecated"]] // For classes with operations + module Test { @@ -359,3 +361,26 @@ interface MyDerivedClass extends Test::MyClass } } + +// +// Test proxy inheritance for class with operations +// see: https://github.com/zeroc-ice/ice/issues/406 +// +module M +{ + class A + { + int x; + // void opA(); + } + + interface Intf + { + void opIntf(); + } + + class B extends A implements Intf + { + void opB(); + } +} diff --git a/ruby/test/Ice/operations/Twoways.rb b/ruby/test/Ice/operations/Twoways.rb index 73c3d30603f..66253fa80dd 100644 --- a/ruby/test/Ice/operations/Twoways.rb +++ b/ruby/test/Ice/operations/Twoways.rb @@ -3,7 +3,7 @@ # Copyright (c) ZeroC, Inc. All rights reserved. # -def twoways(helper, communicator, p) +def twoways(helper, communicator, p, bprx) literals = p.opStringLiterals(); @@ -1266,4 +1266,7 @@ def twoways(helper, communicator, p) ic.destroy() end + + bprx.opB() + bprx.opIntf() end |