diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index 1bc7f86b142..1253299ec1e 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -204,11 +204,11 @@ class FObjectReader : public Ice::Value _f = make_shared(); in->startValue(); in->startSlice(); - // Don't read af on purpose - // in.read(1, _f->af); + // Don't read fsf on purpose + // in.read(1, _f->fsf); in->endSlice(); in->startSlice(); - in->read(_f->ae); + in->read(_f->fse); in->endSlice(); in->endValue(); } @@ -644,28 +644,16 @@ allTests(Test::TestHelper* helper, bool) factory->setEnabled(false); } - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // - optional oo(make_shared(53)); - initial->sendOptionalClass(true, oo); - initial->ice_encodingVersion(Ice::Encoding_1_0)->sendOptionalClass(true, oo); - - initial->returnOptionalClass(true, oo); - test(oo); - initial->ice_encodingVersion(Ice::Encoding_1_0)->returnOptionalClass(true, oo); - test(!oo); - GPtr g = make_shared(); - g->gg1Opt = make_shared("gg1Opt"); - g->gg2 = make_shared(10); - g->gg2Opt = make_shared(20); - g->gg1 = make_shared("gg1"); + g->gg1Opt = G1{"gg1Opt"}; + g->gg2 = G2{10}; + g->gg2Opt = G2{20}; + g->gg1 = G1{"gg1"}; GPtr r = initial->opG(g); - test("gg1Opt" == r->gg1Opt.value()->a); - test(10 == r->gg2->a); - test(20 == r->gg2Opt.value()->a); - test("gg1" == r->gg1->a); + test("gg1Opt" == r->gg1Opt.value().a); + test(10 == r->gg2.a); + test(20 == r->gg2Opt.value().a); + test("gg1" == r->gg1.a); initial->opVoid(); @@ -765,15 +753,15 @@ allTests(Test::TestHelper* helper, bool) cout << "ok" << endl; - cout << "testing marshaling of objects with optional objects..." << flush; + cout << "testing marshaling of objects with optional members..." << flush; { FPtr f = make_shared(); - f->af = make_shared(); - f->ae = *f->af; + f->fsf = FixedStruct{56}; + f->fse = *f->fsf; FPtr rf = dynamic_pointer_cast(initial->pingPong(f)); - test(rf->ae == *rf->af); + test(rf->fse == *rf->fsf); factory->setEnabled(true); Ice::OutputStream out(communicator); @@ -789,7 +777,7 @@ allTests(Test::TestHelper* helper, bool) factory->setEnabled(false); rf = dynamic_cast(obj.get())->getF(); - test(rf->ae && !rf->af); + test(rf->fse.m == 56 && !rf->fsf); } cout << "ok" << endl; @@ -1294,23 +1282,23 @@ allTests(Test::TestHelper* helper, bool) { FPtr f = make_shared(); - f->af = make_shared(); - (*f->af)->requiredA = 56; - f->ae = *f->af; + f->fsf = FixedStruct(); + (*f->fsf).m = 56; + f->fse = *f->fsf; Ice::OutputStream out(communicator); out.startEncapsulation(); out.write(1, make_optional(f)); - out.write(2, make_optional(f->ae)); + out.write(2, make_optional(f->fse)); out.endEncapsulation(); out.finished(inEncaps); + optional ofs; Ice::InputStream in(communicator, out.getEncoding(), inEncaps); in.startEncapsulation(); - optional a; - in.read(2, a); + in.read(2, ofs); in.endEncapsulation(); - test(a && *a && (*a)->requiredA == 56); + test(ofs && (*ofs).m == 56); } cout << "ok" << endl; diff --git a/cpp/test/Ice/optional/Test.ice b/cpp/test/Ice/optional/Test.ice index a4b2d581855..4399663da4c 100644 --- a/cpp/test/Ice/optional/Test.ice +++ b/cpp/test/Ice/optional/Test.ice @@ -161,20 +161,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -278,10 +278,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/cpp/test/Ice/optional/TestAMD.ice b/cpp/test/Ice/optional/TestAMD.ice index fe0a1c7e98d..10b7a4e67be 100644 --- a/cpp/test/Ice/optional/TestAMD.ice +++ b/cpp/test/Ice/optional/TestAMD.ice @@ -161,20 +161,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -278,10 +278,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/cpp/test/Ice/optional/TestAMDI.cpp b/cpp/test/Ice/optional/TestAMDI.cpp index 3c4997ff02f..1b0d99515c4 100644 --- a/cpp/test/Ice/optional/TestAMDI.cpp +++ b/cpp/test/Ice/optional/TestAMDI.cpp @@ -408,27 +408,6 @@ InitialI::opClassAndUnknownOptionalAsync( response(); } -void -InitialI::sendOptionalClassAsync( - bool, - optional>, - function response, - function, - const Ice::Current&) -{ - response(); -} - -void -InitialI::returnOptionalClassAsync( - bool, - function>&)> response, - function, - const Ice::Current&) -{ - response(make_shared(53)); -} - void InitialI::opGAsync( shared_ptr g, diff --git a/cpp/test/Ice/optional/TestAMDI.h b/cpp/test/Ice/optional/TestAMDI.h index 9b17366f5ad..d4bb286ba8e 100644 --- a/cpp/test/Ice/optional/TestAMDI.h +++ b/cpp/test/Ice/optional/TestAMDI.h @@ -261,19 +261,6 @@ class InitialI final : public Test::Initial std::function, const Ice::Current&) final; - void sendOptionalClassAsync( - bool, - std::optional>, - std::function, - std::function, - const Ice::Current&) final; - - void returnOptionalClassAsync( - bool, - std::function>&)>, - std::function, - const Ice::Current&) final; - void opGAsync( std::shared_ptr, std::function&)>, diff --git a/cpp/test/Ice/optional/TestI.cpp b/cpp/test/Ice/optional/TestI.cpp index 39465b075ab..0eedee5bf3b 100644 --- a/cpp/test/Ice/optional/TestI.cpp +++ b/cpp/test/Ice/optional/TestI.cpp @@ -339,17 +339,6 @@ InitialI::opClassAndUnknownOptional(APtr, const Ice::Current&) { } -void -InitialI::sendOptionalClass(bool, optional, const Ice::Current&) -{ -} - -void -InitialI::returnOptionalClass(bool, optional& o, const Ice::Current&) -{ - o = make_shared(53); -} - GPtr InitialI::opG(GPtr g, const Ice::Current&) { diff --git a/cpp/test/Ice/optional/TestI.h b/cpp/test/Ice/optional/TestI.h index 2f6f9932b75..5a7f8564bb3 100644 --- a/cpp/test/Ice/optional/TestI.h +++ b/cpp/test/Ice/optional/TestI.h @@ -147,10 +147,6 @@ class InitialI : public Test::Initial virtual void opClassAndUnknownOptional(Test::APtr, const Ice::Current&); - virtual void sendOptionalClass(bool, std::optional, const Ice::Current&); - - virtual void returnOptionalClass(bool, std::optional&, const Ice::Current&); - virtual ::Test::GPtr opG(::Test::GPtr g, const Ice::Current&); virtual void opVoid(const Ice::Current&); diff --git a/csharp/test/Ice/optional/AllTests.cs b/csharp/test/Ice/optional/AllTests.cs index 3a678026608..5fe3bf2ded5 100644 --- a/csharp/test/Ice/optional/AllTests.cs +++ b/csharp/test/Ice/optional/AllTests.cs @@ -336,19 +336,6 @@ public class AllTests : global::Test.AllTests test(cb.obj != null && cb.obj is TestValueReader); factory.setEnabled(false); - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // - var oo = new Ice.Optional(new Test.OneOptional(53)); - initial.sendOptionalClass(true, oo); - Test.InitialPrx initial2 = (Test.InitialPrx)initial.ice_encodingVersion(Ice.Util.Encoding_1_0); - initial2.sendOptionalClass(true, oo); - - initial.returnOptionalClass(true, out oo); - test(oo.HasValue); - initial2.returnOptionalClass(true, out oo); - test(!oo.HasValue); - Test.G g = new Test.G(); g.gg1Opt = new Ice.Optional(new Test.G1("gg1Opt")); g.gg2 = new Test.G2(10); @@ -451,16 +438,16 @@ public class AllTests : global::Test.AllTests } output.WriteLine("ok"); - output.Write("testing marshaling of objects with optional objects..."); + output.Write("testing marshaling of objects with optional members..."); output.Flush(); { Test.F f = new Test.F(); - f.af = new Test.A(); - f.ae = (Test.A)f.af; + f.fsf = new Test.FixedStruct(); + f.fse = (Test.FixedStruct)f.fsf; Test.F rf = (Test.F)initial.pingPong(f); - test(rf.ae == rf.af.Value); + test(rf.fse == rf.fsf.Value); factory.setEnabled(true); os = new Ice.OutputStream(communicator); @@ -475,7 +462,7 @@ public class AllTests : global::Test.AllTests @in.endEncapsulation(); factory.setEnabled(false); rf = ((FValueReader)rocb.obj).getF(); - test(rf.ae != null && !rf.af.HasValue); + test(rf.fse != null && !rf.fsf.HasValue); } output.WriteLine("ok"); @@ -1867,27 +1854,26 @@ public class AllTests : global::Test.AllTests @in.endEncapsulation(); Test.F f = new Test.F(); - f.af = new Test.A(); - f.af.Value.requiredA = 56; - f.ae = f.af.Value; + f.fsf = new Test.FixedStruct(56); + f.fse = f.fsf.Value; os = new OutputStream(communicator); os.startEncapsulation(); os.writeOptional(1, OptionalFormat.Class); os.writeValue(f); - os.writeOptional(2, OptionalFormat.Class); - os.writeValue(f.ae); + os.writeOptional(2, OptionalFormat.VSize); + os.writeSize(4); + Test.FixedStruct.ice_write(os, f.fse); os.endEncapsulation(); inEncaps = os.finished(); @in = new InputStream(communicator, inEncaps); @in.startEncapsulation(); - test(@in.readOptional(2, OptionalFormat.Class)); - ReadValueCallbackI rocb = new ReadValueCallbackI(); - @in.readValue(rocb.invoke); + test(@in.readOptional(2, OptionalFormat.VSize)); + @in.skipSize(); + Test.FixedStruct fs1 = Test.FixedStruct.ice_read(@in); @in.endEncapsulation(); - Test.A a = (Test.A)rocb.obj; - test(a != null && a.requiredA == 56); + test(fs1 != null && fs1.m == 56); } { @@ -1978,6 +1964,7 @@ public class AllTests : global::Test.AllTests // // Use the 1.0 encoding with an exception whose only class members are optional. // + Test.InitialPrx initial2 = (Test.InitialPrx)initial.ice_encodingVersion(Ice.Util.Encoding_1_0); Ice.Optional a = new Ice.Optional(30); Ice.Optional b = new Ice.Optional("test"); Ice.Optional o = new Ice.Optional(new Test.OneOptional(53)); @@ -2333,15 +2320,13 @@ public override void read(Ice.InputStream @in) _f = new Test.F(); @in.startValue(); @in.startSlice(); - // Don't read af on purpose - //in.read(1, _f.af); + // Don't read fsf on purpose + //@in.read(1, _f.fsf); @in.endSlice(); @in.startSlice(); - ReadValueCallbackI rocb = new ReadValueCallbackI(); - @in.readValue(rocb.invoke); + _f.fse = Test.FixedStruct.ice_read(@in); @in.endSlice(); @in.endValue(); - _f.ae = (Test.A)rocb.obj; } public Test.F getF() diff --git a/csharp/test/Ice/optional/Test.ice b/csharp/test/Ice/optional/Test.ice index db35ee53afb..63ee679428d 100644 --- a/csharp/test/Ice/optional/Test.ice +++ b/csharp/test/Ice/optional/Test.ice @@ -156,20 +156,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -260,10 +260,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/csharp/test/Ice/optional/TestAMD.ice b/csharp/test/Ice/optional/TestAMD.ice index e9959750300..9384f1852f3 100644 --- a/csharp/test/Ice/optional/TestAMD.ice +++ b/csharp/test/Ice/optional/TestAMD.ice @@ -156,20 +156,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -261,10 +261,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/csharp/test/Ice/optional/TestAMDI.cs b/csharp/test/Ice/optional/TestAMDI.cs index eec672f9382..88d1ebdec26 100644 --- a/csharp/test/Ice/optional/TestAMDI.cs +++ b/csharp/test/Ice/optional/TestAMDI.cs @@ -245,18 +245,6 @@ public override Task return null; } - public override Task - sendOptionalClassAsync(bool req, Ice.Optional o, Ice.Current current) - { - return null; - } - - public override Task> - returnOptionalClassAsync(bool req, Ice.Current current) - { - return Task.FromResult(new Ice.Optional(new Test.OneOptional(53))); - } - public override Task opGAsync(Test.G g, Ice.Current current) { diff --git a/csharp/test/Ice/optional/TestI.cs b/csharp/test/Ice/optional/TestI.cs index 0a0c4a639f3..7a51af67b2b 100644 --- a/csharp/test/Ice/optional/TestI.cs +++ b/csharp/test/Ice/optional/TestI.cs @@ -305,19 +305,6 @@ public override void opClassAndUnknownOptional(Test.A p, Ice.Current current) { } - public override void sendOptionalClass(bool req, - Ice.Optional o, - Ice.Current current) - { - } - - public override void returnOptionalClass(bool req, - out Ice.Optional o, - Ice.Current current) - { - o = new Test.OneOptional(53); - } - public override Test.G opG(Test.G g, Ice.Current current) { return g; diff --git a/java/test/src/main/java/test/Ice/optional/AMDInitialI.java b/java/test/src/main/java/test/Ice/optional/AMDInitialI.java index d2ef55801da..0188c3731bf 100644 --- a/java/test/src/main/java/test/Ice/optional/AMDInitialI.java +++ b/java/test/src/main/java/test/Ice/optional/AMDInitialI.java @@ -465,18 +465,6 @@ public CompletionStage opClassAndUnknownOptionalAsync(A p, Current current return CompletableFuture.completedFuture(null); } - @Override - public CompletionStage sendOptionalClassAsync( - boolean req, Optional o, Current current) { - return CompletableFuture.completedFuture(null); - } - - @Override - public CompletionStage> returnOptionalClassAsync( - boolean req, Current current) { - return CompletableFuture.completedFuture(Optional.of(new OneOptional(53))); - } - @Override public CompletionStage opGAsync(G g, Current current) { return CompletableFuture.completedFuture(g); diff --git a/java/test/src/main/java/test/Ice/optional/AllTests.java b/java/test/src/main/java/test/Ice/optional/AllTests.java index 6e2b9ebe773..44a242b33b8 100644 --- a/java/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java/test/src/main/java/test/Ice/optional/AllTests.java @@ -376,19 +376,6 @@ public static InitialPrx allTests(test.TestHelper helper, boolean collocated) { test(cb.value != null); factory.setEnabled(false); - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // - Optional oo = Optional.of(new OneOptional(53)); - initial.sendOptionalClass(true, oo); - InitialPrx initial2 = initial.ice_encodingVersion(com.zeroc.Ice.Util.Encoding_1_0); - initial2.sendOptionalClass(true, oo); - - oo = initial.returnOptionalClass(true); - test(oo.isPresent()); - oo = initial2.returnOptionalClass(true); - test(!oo.isPresent()); - G g = new G(); g.setGg1Opt(new G1("gg1Opt")); g.gg2 = new G2(10); @@ -493,16 +480,16 @@ public static InitialPrx allTests(test.TestHelper helper, boolean collocated) { } out.println("ok"); - out.print("testing marshaling of objects with optional objects..."); + out.print("testing marshaling of objects with optional members..."); out.flush(); { F f = new F(); - f.setAf(new A()); - f.ae = f.getAf(); + f.setFsf(new FixedStruct()); + f.fse = f.getFsf(); F rf = (F) initial.pingPong(f); - test(rf.ae == rf.getAf()); + test(rf.fse.equals(rf.getFsf())); factory.setEnabled(true); os = new OutputStream(communicator); @@ -516,7 +503,7 @@ public static InitialPrx allTests(test.TestHelper helper, boolean collocated) { in.readValue(v -> w.value = v.getF(), FObjectReader.class); in.endEncapsulation(); factory.setEnabled(false); - test(w.value.ae != null && !w.value.hasAf()); + test(w.value.fse != null && !w.value.hasFsf()); } out.println("ok"); @@ -1963,25 +1950,27 @@ public static InitialPrx allTests(test.TestHelper helper, boolean collocated) { { F f = new F(); - f.setAf(new A()); - f.getAf().requiredA = 56; - f.ae = f.getAf(); + f.setFsf(new FixedStruct()); + f.getFsf().m = 56; + f.fse = f.getFsf(); os = new OutputStream(communicator); os.startEncapsulation(); os.writeOptional(1, OptionalFormat.Class); os.writeValue(f); - os.writeOptional(2, OptionalFormat.Class); - os.writeValue(f.ae); + os.writeOptional(2, OptionalFormat.VSize); + os.writeSize(4); + FixedStruct.ice_write(os, f.fse); os.endEncapsulation(); inEncaps = os.finished(); in = new InputStream(communicator, inEncaps); in.startEncapsulation(); - final Wrapper> w = new Wrapper<>(); - in.readValue(2, v -> w.value = v, A.class); + test(in.readOptional(2, OptionalFormat.VSize)); + in.skipSize(); + FixedStruct fs1 = FixedStruct.ice_read(in); in.endEncapsulation(); - test(w.value.get() != null && w.value.get().requiredA == 56); + test(fs1 != null && fs1.m == 56); } out.println("ok"); @@ -2014,6 +2003,7 @@ public static InitialPrx allTests(test.TestHelper helper, boolean collocated) { // // Use the 1.0 encoding with an exception whose only class members are optional. // + InitialPrx initial2 = initial.ice_encodingVersion(com.zeroc.Ice.Util.Encoding_1_0); OptionalInt a = OptionalInt.of(30); Optional b = Optional.of("test"); Optional o = Optional.of(new OneOptional(53)); @@ -2255,11 +2245,11 @@ public void read(InputStream in) { _f = new F(); in.startValue(); in.startSlice(); - // Don't read af on purpose - // in.read(1, _f.af); + // Don't read fsf on purpose + // in.read(1, _f.fsf); in.endSlice(); in.startSlice(); - in.readValue(v -> _f.ae = v, A.class); + _f.fse = FixedStruct.ice_read(in); in.endSlice(); in.endValue(); } diff --git a/java/test/src/main/java/test/Ice/optional/InitialI.java b/java/test/src/main/java/test/Ice/optional/InitialI.java index 8c332002674..2a0d90e7975 100644 --- a/java/test/src/main/java/test/Ice/optional/InitialI.java +++ b/java/test/src/main/java/test/Ice/optional/InitialI.java @@ -435,14 +435,6 @@ public Initial.OpIntOneOptionalDictReqResult opIntOneOptionalDictReq( @Override public void opClassAndUnknownOptional(A p, Current current) {} - @Override - public void sendOptionalClass(boolean req, Optional o, Current current) {} - - @Override - public Optional returnOptionalClass(boolean req, Current current) { - return Optional.of(new OneOptional(53)); - } - @Override public G opG(G g, Current current) { return g; diff --git a/java/test/src/main/java/test/Ice/optional/Test.ice b/java/test/src/main/java/test/Ice/optional/Test.ice index 465a50b01ba..95ffc42a33a 100644 --- a/java/test/src/main/java/test/Ice/optional/Test.ice +++ b/java/test/src/main/java/test/Ice/optional/Test.ice @@ -158,20 +158,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -307,11 +307,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - ["java:optional"] - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/java/test/src/main/java/test/Ice/optional/TestAMD.ice b/java/test/src/main/java/test/Ice/optional/TestAMD.ice index e94daa9f0c2..f7e78cf862d 100644 --- a/java/test/src/main/java/test/Ice/optional/TestAMD.ice +++ b/java/test/src/main/java/test/Ice/optional/TestAMD.ice @@ -158,20 +158,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -309,11 +309,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - ["java:optional"] - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/js/test/Ice/optional/AMDInitialI.js b/js/test/Ice/optional/AMDInitialI.js index f4e71b7ad40..25be7a9fe93 100644 --- a/js/test/Ice/optional/AMDInitialI.js +++ b/js/test/Ice/optional/AMDInitialI.js @@ -253,15 +253,6 @@ { } - sendOptionalClass(req, current) - { - } - - returnOptionalClass(req, current) - { - return new Test.OneOptional(53); - } - opG(g, current) { return g; diff --git a/js/test/Ice/optional/Client.js b/js/test/Ice/optional/Client.js index f85929cbd0f..70721f50e45 100644 --- a/js/test/Ice/optional/Client.js +++ b/js/test/Ice/optional/Client.js @@ -253,19 +253,6 @@ test(mo9.bos === undefined); - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // - const initial2 = initial.ice_encodingVersion(Ice.Encoding_1_0); - const oo = new Test.OneOptional(53); - - await initial.sendOptionalClass(true, oo); - await initial2.sendOptionalClass(true, oo); - oo1 = await initial.returnOptionalClass(true); - test(oo1 !== undefined && oo1.a == 53); - oo1 = await initial2.returnOptionalClass(true); - test(oo1 === undefined); - let g = new Test.G(); g.gg1Opt = new Test.G1("gg1Opt"); g.gg2 = new Test.G2(new Ice.Long(0, 10)); @@ -329,12 +316,12 @@ test(b.md == 13); out.writeLine("ok"); - out.write("testing marshaling of objects with optional objects... "); + out.write("testing marshaling of objects with optional members... "); let f = new Test.F(); - f.af = new Test.A(); - f.ae = f.af; + f.fsf = new Test.FixedStruct(); + f.fse = f.fsf; f = await initial.pingPong(f); - test(f.ae === f.af); + test(f.fse.equals(f.fsf)); out.writeLine("ok"); out.write("testing optional with default values... "); diff --git a/js/test/Ice/optional/InitialI.js b/js/test/Ice/optional/InitialI.js index 1a5c83ba4cc..ac45092b47d 100644 --- a/js/test/Ice/optional/InitialI.js +++ b/js/test/Ice/optional/InitialI.js @@ -253,10 +253,6 @@ { } - sendOptionalClass(req, current) - { - } - opG(g, current) { return g; @@ -306,11 +302,6 @@ return [p1, p1]; } - returnOptionalClass(req, current) - { - return new Test.OneOptional(53); - } - supportsRequiredParams(current) { return false; diff --git a/js/test/Ice/optional/Test.ice b/js/test/Ice/optional/Test.ice index 340ef8ff2f9..15c44c0c8e0 100644 --- a/js/test/Ice/optional/Test.ice +++ b/js/test/Ice/optional/Test.ice @@ -157,20 +157,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -263,10 +263,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/js/test/typescript/Ice/optional/AMDInitialI.ts b/js/test/typescript/Ice/optional/AMDInitialI.ts index 7794c998b4b..84fae160e28 100644 --- a/js/test/typescript/Ice/optional/AMDInitialI.ts +++ b/js/test/typescript/Ice/optional/AMDInitialI.ts @@ -252,15 +252,6 @@ export class AMDInitialI extends Test.Initial { } - sendOptionalClass(req:boolean, one:Test.OneOptional, current:Ice.Current):void - { - } - - returnOptionalClass(req:boolean, current:Ice.Current):Test.OneOptional - { - return new Test.OneOptional(53); - } - opG(g:Test.G, current:Ice.Current):Test.G { return g; diff --git a/js/test/typescript/Ice/optional/Client.ts b/js/test/typescript/Ice/optional/Client.ts index 67ac4721882..2d99c7bfb2c 100644 --- a/js/test/typescript/Ice/optional/Client.ts +++ b/js/test/typescript/Ice/optional/Client.ts @@ -250,19 +250,6 @@ export class Client extends TestHelper test(mo9.bos === undefined); - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // - const initial2 = initial.ice_encodingVersion(Ice.Encoding_1_0); - const oo = new Test.OneOptional(53); - - await initial.sendOptionalClass(true, oo); - await initial2.sendOptionalClass(true, oo); - oo1 = await initial.returnOptionalClass(true); - test(oo1 !== undefined && oo1.a == 53); - oo1 = await initial2.returnOptionalClass(true); - test(oo1 === undefined); - let g = new Test.G(); g.gg1Opt = new Test.G1("gg1Opt"); g.gg2 = new Test.G2(new Ice.Long(0, 10)); @@ -326,12 +313,12 @@ export class Client extends TestHelper test(b.md == 13); out.writeLine("ok"); - out.write("testing marshaling of objects with optional objects... "); + out.write("testing marshaling of objects with optional members... "); let f = new Test.F(); - f.af = new Test.A(); - f.ae = f.af; + f.fsf = new Test.FixedStruct(); + f.fse = f.fsf; f = await initial.pingPong(f) as Test.F; - test(f.ae === f.af); + test(f.fse.equals(f.fsf)); out.writeLine("ok"); out.write("testing optional with default values... "); diff --git a/js/test/typescript/Ice/optional/InitialI.ts b/js/test/typescript/Ice/optional/InitialI.ts index 59a0cdd08fa..68aad568d42 100644 --- a/js/test/typescript/Ice/optional/InitialI.ts +++ b/js/test/typescript/Ice/optional/InitialI.ts @@ -252,15 +252,6 @@ export class InitialI extends Test.Initial { } - sendOptionalClass(req:boolean, one:Test.OneOptional, current:Ice.Current):void - { - } - - returnOptionalClass(req:boolean, current:Ice.Current):Test.OneOptional - { - return new Test.OneOptional(53); - } - opG(g:Test.G, current:Ice.Current):Test.G { return g; diff --git a/js/test/typescript/Ice/optional/Test.ice b/js/test/typescript/Ice/optional/Test.ice index fbcc13a5104..91e359cc7f4 100644 --- a/js/test/typescript/Ice/optional/Test.ice +++ b/js/test/typescript/Ice/optional/Test.ice @@ -159,20 +159,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -265,10 +265,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/matlab/test/Ice/optional/AllTests.m b/matlab/test/Ice/optional/AllTests.m index a90ed02065e..6047dfc8ea4 100644 --- a/matlab/test/Ice/optional/AllTests.m +++ b/matlab/test/Ice/optional/AllTests.m @@ -298,17 +298,6 @@ assert(mo9.bos == Ice.Unset); - % - % Use the 1.0 encoding with operations whose only class parameters are optional. - % - initial.sendOptionalClass(true, OneOptional(53)); - initial.ice_encodingVersion(Ice.EncodingVersion(1, 0)).sendOptionalClass(true, OneOptional(53)); - - r = initial.returnOptionalClass(true); - assert(r ~= Ice.Unset) - r = initial.ice_encodingVersion(Ice.EncodingVersion(1, 0)).returnOptionalClass(true); - assert(r == Ice.Unset); - g = G(); g.gg1Opt = G1('gg1Opt'); g.gg2 = G2(10); @@ -371,15 +360,15 @@ fprintf('ok\n'); - fprintf('testing marshaling of objects with optional objects... '); + fprintf('testing marshaling of objects with optional members... '); f = F(); - f.af = A(); - f.ae = f.af; + f.fsf = FixedStruct(); + f.fse = f.fsf; rf = initial.pingPong(f); - assert(rf.ae == rf.af); + assert(rf.fse == rf.fsf); fprintf('ok\n'); diff --git a/matlab/test/Ice/optional/Test.ice b/matlab/test/Ice/optional/Test.ice index 5b6ce93daca..f395b6c0289 100644 --- a/matlab/test/Ice/optional/Test.ice +++ b/matlab/test/Ice/optional/Test.ice @@ -158,20 +158,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -271,10 +271,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/php/test/Ice/optional/Client.php b/php/test/Ice/optional/Client.php index c28e136ae66..58c9cae39c1 100644 --- a/php/test/Ice/optional/Client.php +++ b/php/test/Ice/optional/Client.php @@ -293,18 +293,6 @@ function allTests($helper) test($mo9->bos == Ice\None); - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // - $oo = new Test\OneOptional(53); - $initial->sendOptionalClass(true, $oo); - $initial->ice_encodingVersion($Ice_Encoding_1_0)->sendOptionalClass(true, $oo); - - $initial->returnOptionalClass(true, $oo); - test($oo != Ice\None); - $initial->ice_encodingVersion($Ice_Encoding_1_0)->returnOptionalClass(true, $oo); - test($oo == Ice\None); - $g = new Test\G; $g->gg1Opt = new Test\G1("gg1Opt"); $g->gg2 = new Test\G2(10); @@ -376,16 +364,16 @@ function allTests($helper) echo "ok\n"; - echo "testing marshaling of objects with optional objects..."; + echo "testing marshaling of objects with optional members..."; flush(); $f = new Test\F; - $f->af = new Test\A; - $f->ae = $f->af; + $f->fsf = new Test\FixedStruct; + $f->fse = $f->fsf; $rf = $initial->pingPong($f); - test($rf->ae == $rf->af); + test($rf->fse == $rf->fsf); echo "ok\n"; diff --git a/php/test/Ice/optional/Test.ice b/php/test/Ice/optional/Test.ice index f7243c9afd3..d571918dc9f 100644 --- a/php/test/Ice/optional/Test.ice +++ b/php/test/Ice/optional/Test.ice @@ -157,20 +157,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -263,10 +263,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); ["marshaled-result"] optional(1) SmallStruct opMStruct1(); diff --git a/python/test/Ice/optional/AllTests.py b/python/test/Ice/optional/AllTests.py index 84ca51aeb6c..407aaf3b73a 100644 --- a/python/test/Ice/optional/AllTests.py +++ b/python/test/Ice/optional/AllTests.py @@ -328,19 +328,6 @@ def allTests(helper, communicator): test(mo9.bos is Ice.Unset) - # - # Use the 1.0 encoding with operations whose only class parameters are optional. - # - initial.sendOptionalClass(True, Test.OneOptional(53)) - initial.ice_encodingVersion(Ice.Encoding_1_0).sendOptionalClass( - True, Test.OneOptional(53) - ) - - r = initial.returnOptionalClass(True) - test(r != Ice.Unset) - r = initial.ice_encodingVersion(Ice.Encoding_1_0).returnOptionalClass(True) - test(r is Ice.Unset) - g = Test.G() g.gg1Opt = Test.G1("gg1Opt") g.gg2 = Test.G2(10) @@ -409,16 +396,16 @@ def allTests(helper, communicator): print("ok") - sys.stdout.write("testing marshaling of objects with optional objects...") + sys.stdout.write("testing marshaling of objects with optional members...") sys.stdout.flush() f = Test.F() - f.af = Test.A() - f.ae = f.af + f.fsf = Test.FixedStruct() + f.fse = f.fsf rf = initial.pingPong(f) - test(rf.ae == rf.af) + test(rf.fse == rf.fsf) print("ok") diff --git a/python/test/Ice/optional/Server.py b/python/test/Ice/optional/Server.py index aea542c92e1..31a16fd4199 100755 --- a/python/test/Ice/optional/Server.py +++ b/python/test/Ice/optional/Server.py @@ -130,12 +130,6 @@ def opIntOneOptionalDict(self, p1, current=None): def opClassAndUnknownOptional(self, p, current=None): pass - def sendOptionalClass(self, req, o, current=None): - pass - - def returnOptionalClass(self, req, current=None): - return Test.OneOptional(53) - def opG(self, g, current=None): return g diff --git a/python/test/Ice/optional/ServerAMD.py b/python/test/Ice/optional/ServerAMD.py index 97e66ffb706..c6d02101d05 100755 --- a/python/test/Ice/optional/ServerAMD.py +++ b/python/test/Ice/optional/ServerAMD.py @@ -136,12 +136,6 @@ def opIntOneOptionalDict(self, p1, current=None): def opClassAndUnknownOptional(self, p, current=None): return Ice.Future.completed(None) - def sendOptionalClass(self, req, o, current=None): - return Ice.Future.completed(None) - - def returnOptionalClass(self, req, current=None): - return Ice.Future.completed(Test.OneOptional(53)) - def opG(self, g, current=None): return Ice.Future.completed(g) diff --git a/python/test/Ice/optional/Test.ice b/python/test/Ice/optional/Test.ice index 85fd3f5bbb7..8781edbb972 100644 --- a/python/test/Ice/optional/Test.ice +++ b/python/test/Ice/optional/Test.ice @@ -157,20 +157,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -267,10 +267,6 @@ interface Initial void opOptionalAfterRequired(int p1, optional(1) int p2, optional(2) int p3, out int p4, out optional(3) int p5, out optional(4) int p6); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/ruby/test/Ice/optional/AllTests.rb b/ruby/test/Ice/optional/AllTests.rb index ba7a19df583..1fba65d14b1 100644 --- a/ruby/test/Ice/optional/AllTests.rb +++ b/ruby/test/Ice/optional/AllTests.rb @@ -291,17 +291,6 @@ def allTests(helper, communicator) test(mo9.bos == Ice::Unset) - # - # Use the 1.0 encoding with operations whose only class parameters are optional. - # - initial.sendOptionalClass(true, Test::OneOptional.new(53)) - initial.ice_encodingVersion(Ice::Encoding_1_0).sendOptionalClass(true, Test::OneOptional.new(53)) - - r = initial.returnOptionalClass(true) - test(r != Ice::Unset) - r = initial.ice_encodingVersion(Ice::Encoding_1_0).returnOptionalClass(true) - test(r == Ice::Unset) - g = Test::G.new g.gg1Opt = Test::G1.new("gg1Opt") g.gg2 = Test::G2.new(10) @@ -372,16 +361,16 @@ def allTests(helper, communicator) puts "ok" - print "testing marshaling of objects with optional objects..." + print "testing marshaling of objects with optional members..." STDOUT.flush f = Test::F.new - f.af = Test::A.new - f.ae = f.af + f.fsf = Test::FixedStruct.new + f.fse = f.fsf rf = initial.pingPong(f) - test(rf.ae == rf.af) + test(rf.fse == rf.fsf) puts "ok" diff --git a/ruby/test/Ice/optional/Test.ice b/ruby/test/Ice/optional/Test.ice index a726c0e28d9..ba8f107e5cc 100644 --- a/ruby/test/Ice/optional/Test.ice +++ b/ruby/test/Ice/optional/Test.ice @@ -157,20 +157,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -263,10 +263,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/swift/test/Ice/optional/AllTests.swift b/swift/test/Ice/optional/AllTests.swift index ccb661d0ef7..14badaad761 100644 --- a/swift/test/Ice/optional/AllTests.swift +++ b/swift/test/Ice/optional/AllTests.swift @@ -129,11 +129,11 @@ class FValueReader: Ice.Value { _f = F() istr.startValue() _ = try istr.startSlice() - // Don't read af on purpose - // in.read(1, _f.af); + // Don't read fsf on purpose + // in.read(1, _f.fsf); try istr.endSlice() _ = try istr.startSlice() - try istr.read(A.self) { self._f.ae = $0 } + self._f.fse = try istr.read() try istr.endSlice() _ = try istr.endValue() } @@ -546,20 +546,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { } factory.setEnabled(enabled: false) - // - // Use the 1.0 encoding with operations whose only class parameters are optional. - // do { - var oo: OneOptional? = OneOptional(a: 53) - try initial.sendOptionalClass(req: true, o: oo) - let initial2 = initial.ice_encodingVersion(Ice.Encoding_1_0) - try initial2.sendOptionalClass(req: true, o: oo) - - oo = try initial.returnOptionalClass(true) - try test(oo != nil && oo!.a == 53) - oo = try initial2.returnOptionalClass(true) - try test(oo == nil) - var g: G! = G() g.gg1Opt = G1(a: "gg1Opt") g.gg2 = G2(a: 10) @@ -567,9 +554,9 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { g.gg1 = G1(a: "gg1") g = try initial.opG(g) try test(g.gg1Opt!.a == "gg1Opt") - try test(g.gg2!.a == 10) + try test(g.gg2.a == 10) try test(g.gg2Opt!.a == 20) - try test(g.gg1!.a == "gg1") + try test(g.gg1.a == "gg1") try initial.opVoid() @@ -660,15 +647,15 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { } output.writeLine("ok") - output.write("testing marshaling of objects with optional objects...") + output.write("testing marshaling of objects with optional members...") do { let f = F() - f.af = A() - f.ae = f.af + f.fsf = FixedStruct() + f.fse = f.fsf! var rf = try initial.pingPong(f) as! F - try test(rf.ae === rf.af) + try test(rf.fse == rf.fsf) factory.setEnabled(enabled: true) let ostr = Ice.OutputStream(communicator: communicator) @@ -683,7 +670,7 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try istr.endEncapsulation() factory.setEnabled(enabled: false) rf = (v as! FValueReader).getF()! - try test(rf.ae != nil && rf.af == nil) + try test(rf.fse.m == 0 && rf.fsf == nil) } output.writeLine("ok") @@ -3080,23 +3067,22 @@ func allTests(_ helper: TestHelper) throws -> InitialPrx { try istr.endEncapsulation() let f = F() - f.af = A() - f.af!.requiredA = 56 - f.ae = f.af + f.fsf = FixedStruct() + f.fsf!.m = 56 + f.fse = f.fsf! ostr = Ice.OutputStream(communicator: communicator) ostr.startEncapsulation() ostr.write(tag: 1, value: f) - ostr.write(tag: 2, value: f.ae) + ostr.write(tag: 2, value: f.fse) ostr.endEncapsulation() inEncaps = ostr.finished() istr = Ice.InputStream(communicator: communicator, bytes: inEncaps) _ = try istr.startEncapsulation() - var a: Value? - try istr.read(tag: 2) { a = $0 } + let fs1: FixedStruct? = try istr.read(tag: 2) try istr.endEncapsulation() - try test(a != nil && (a as! A).requiredA == 56) + try test(fs1 != nil && fs1!.m == 56) } do { diff --git a/swift/test/Ice/optional/Test.ice b/swift/test/Ice/optional/Test.ice index 10a4c8fd605..1348e421a83 100644 --- a/swift/test/Ice/optional/Test.ice +++ b/swift/test/Ice/optional/Test.ice @@ -161,20 +161,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -270,10 +270,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/swift/test/Ice/optional/TestAMD.ice b/swift/test/Ice/optional/TestAMD.ice index ec40d60ad5a..57d31dee89a 100644 --- a/swift/test/Ice/optional/TestAMD.ice +++ b/swift/test/Ice/optional/TestAMD.ice @@ -159,20 +159,20 @@ class OptionalWithCustom class E { - A ae; + FixedStruct fse; } class F extends E { - optional(1) A af; + optional(1) FixedStruct fsf; } -class G1 +struct G1 { string a; } -class G2 +struct G2 { long a; } @@ -266,10 +266,6 @@ interface Initial void opClassAndUnknownOptional(A p); - void sendOptionalClass(bool req, optional(1) OneOptional o); - - void returnOptionalClass(bool req, out optional(1) OneOptional o); - G opG(G g); void opVoid(); diff --git a/swift/test/Ice/optional/TestAMDI.swift b/swift/test/Ice/optional/TestAMDI.swift index e3cf8c923ca..7e31b87ae72 100644 --- a/swift/test/Ice/optional/TestAMDI.swift +++ b/swift/test/Ice/optional/TestAMDI.swift @@ -250,14 +250,6 @@ class InitialI: Initial { return Promise.value(()) } - func sendOptionalClassAsync(req _: Bool, o _: OneOptional?, current _: Current) -> Promise { - return Promise.value(()) - } - - func returnOptionalClassAsync(req _: Bool, current _: Current) -> Promise { - return Promise.value(OneOptional(a: 53)) - } - func opGAsync(g: G?, current _: Current) -> Promise { return Promise.value(g) } diff --git a/swift/test/Ice/optional/TestI.swift b/swift/test/Ice/optional/TestI.swift index f9692386f05..d6370629154 100644 --- a/swift/test/Ice/optional/TestI.swift +++ b/swift/test/Ice/optional/TestI.swift @@ -250,12 +250,6 @@ class InitialI: Initial { func opClassAndUnknownOptional(p _: A?, current _: Ice.Current) throws {} - func sendOptionalClass(req _: Bool, o _: OneOptional?, current _: Ice.Current) throws {} - - func returnOptionalClass(req _: Bool, current _: Ice.Current) throws -> OneOptional? { - return OneOptional(a: 53) - } - func opG(g: G?, current _: Ice.Current) throws -> G? { return g }