From 054a992229a77a2dc9b899eb7acf96a390904fd7 Mon Sep 17 00:00:00 2001 From: Benoit Foucher Date: Wed, 6 Mar 2024 12:12:07 +0100 Subject: [PATCH] Fix for #1543 --- CHANGELOG-3.8.md | 5 + cpp/include/Ice/Exception.h | 3 - cpp/include/Ice/InputStream.h | 20 +- cpp/include/Ice/OutputStream.h | 6 +- cpp/include/Ice/SlicedData.h | 13 - cpp/include/Ice/Value.h | 6 +- cpp/src/Ice/Exception.cpp | 10 +- cpp/src/Ice/InputStream.cpp | 55 ++-- cpp/src/Ice/OutputStream.cpp | 2 + cpp/src/Ice/SlicedData.cpp | 20 -- cpp/src/Ice/Value.cpp | 6 +- cpp/src/slice2cpp/Gen.cpp | 48 --- cpp/src/slice2cs/Gen.cpp | 74 ----- cpp/src/slice2java/Gen.cpp | 80 ----- cpp/src/slice2js/Gen.cpp | 13 +- cpp/src/slice2php/Main.cpp | 7 +- cpp/src/slice2py/PythonUtil.cpp | 8 +- cpp/src/slice2rb/RubyUtil.cpp | 8 +- cpp/src/slice2swift/Gen.cpp | 73 ----- cpp/test/Ice/metrics/AllTests.cpp | 4 +- cpp/test/Ice/optional/AllTests.cpp | 12 +- cpp/test/Ice/optional/Test.ice | 1 - cpp/test/Ice/optional/TestAMD.ice | 1 - cpp/test/Ice/slicing/exceptions/AllTests.cpp | 257 +-------------- cpp/test/Ice/slicing/exceptions/Client.cpp | 4 +- .../Ice/slicing/exceptions/ClientPrivate.ice | 27 -- cpp/test/Ice/slicing/exceptions/Makefile.mk | 2 +- .../Ice/slicing/exceptions/ServerPrivate.ice | 15 - .../slicing/exceptions/ServerPrivateAMD.ice | 15 - cpp/test/Ice/slicing/exceptions/Test.ice | 45 +-- cpp/test/Ice/slicing/exceptions/TestAMD.ice | 45 +-- cpp/test/Ice/slicing/exceptions/TestAMDI.cpp | 161 +--------- cpp/test/Ice/slicing/exceptions/TestAMDI.h | 49 --- cpp/test/Ice/slicing/exceptions/TestI.cpp | 86 ----- cpp/test/Ice/slicing/exceptions/TestI.h | 14 - .../exceptions/msbuild/client/client.vcxproj | 49 --- .../msbuild/client/client.vcxproj.filters | 26 -- cpp/test/Ice/slicing/objects/AllTests.cpp | 231 ++++++++++---- .../Ice/slicing/objects/ClientPrivate.ice | 1 - .../Ice/slicing/objects/ServerPrivate.ice | 5 - .../Ice/slicing/objects/ServerPrivateAMD.ice | 5 - cpp/test/Ice/slicing/objects/Test.ice | 8 - cpp/test/Ice/slicing/objects/TestAMD.ice | 8 - cpp/test/Ice/slicing/objects/TestAMDI.cpp | 21 -- cpp/test/Ice/slicing/objects/TestAMDI.h | 4 - cpp/test/Ice/slicing/objects/TestI.cpp | 41 +-- cpp/test/Ice/slicing/objects/TestI.h | 3 - cpp/test/IceGrid/session/AllTests.cpp | 26 +- cpp/test/IceGrid/session/Makefile.mk | 2 +- .../IceGrid/session/PermissionsVerifier.cpp | 3 +- cpp/test/IceGrid/session/Server.cpp | 5 +- cpp/test/IceGrid/session/Test.ice | 16 - .../session/msbuild/client/client.vcxproj | 53 ---- .../msbuild/client/client.vcxproj.filters | 31 -- .../session/msbuild/server/server.vcxproj | 55 +--- .../msbuild/server/server.vcxproj.filters | 31 -- .../session/msbuild/verifier/verifier.vcxproj | 55 +--- .../msbuild/verifier/verifier.vcxproj.filters | 31 -- csharp/src/Ice/Exception.cs | 14 +- csharp/src/Ice/InputStream.cs | 87 ++--- csharp/src/Ice/OutputStream.cs | 7 +- csharp/src/Ice/UnknownSlicedValue.cs | 23 -- csharp/src/Ice/Value.cs | 10 +- csharp/test/Ice/metrics/AllTests.cs | 4 +- csharp/test/Ice/optional/AllTests.cs | 10 +- csharp/test/Ice/optional/Test.ice | 1 - csharp/test/Ice/optional/TestAMD.ice | 1 - .../test/Ice/slicing/exceptions/AllTests.cs | 237 -------------- .../Ice/slicing/exceptions/ClientPrivate.ice | 27 -- .../Ice/slicing/exceptions/ServerPrivate.ice | 15 - .../slicing/exceptions/ServerPrivateAMD.ice | 15 - csharp/test/Ice/slicing/exceptions/Test.ice | 45 +-- .../test/Ice/slicing/exceptions/TestAMD.ice | 45 +-- .../test/Ice/slicing/exceptions/TestAMDI.cs | 84 ----- csharp/test/Ice/slicing/exceptions/TestI.cs | 85 ----- .../exceptions/msbuild/client/client.csproj | 4 - csharp/test/Ice/slicing/objects/AllTests.cs | 163 +++++++--- .../Ice/slicing/objects/ClientPrivate.ice | 1 - csharp/test/Ice/slicing/objects/Test.ice | 3 - csharp/test/Ice/slicing/objects/TestAMD.ice | 3 - .../main/java/com/zeroc/Ice/InputStream.java | 85 +++-- .../src/main/java/com/zeroc/Ice/Object.java | 2 +- .../main/java/com/zeroc/Ice/OutputStream.java | 7 +- .../com/zeroc/Ice/UnknownSlicedValue.java | 29 -- .../java/com/zeroc/Ice/UserException.java | 15 +- .../src/main/java/com/zeroc/Ice/Value.java | 8 +- .../main/java/test/Ice/metrics/AllTests.java | 4 +- .../main/java/test/Ice/optional/AllTests.java | 10 +- .../src/main/java/test/Ice/optional/Test.ice | 1 - .../main/java/test/Ice/optional/TestAMD.ice | 1 - .../test/Ice/slicing/exceptions/AMDTestI.java | 168 ---------- .../test/Ice/slicing/exceptions/AllTests.java | 245 -------------- .../Ice/slicing/exceptions/ServerPrivate.ice | 60 +--- .../slicing/exceptions/ServerPrivateAMD.ice | 60 +--- .../{ClientPrivate.ice => Test.ice} | 50 --- .../test/Ice/slicing/exceptions/TestI.java | 103 ------ .../test/Ice/slicing/objects/AllTests.java | 298 ++++++++++-------- .../Ice/slicing/objects/ClientPrivate.ice | 4 - .../Ice/slicing/objects/ServerPrivate.ice | 3 - .../Ice/slicing/objects/ServerPrivateAMD.ice | 3 - js/src/Ice/Exception.d.ts | 7 - js/src/Ice/Exception.js | 43 +-- js/src/Ice/Stream.js | 24 +- js/src/Ice/UnknownSlicedValue.js | 9 +- js/src/Ice/Value.js | 49 +-- js/test/Ice/optional/Test.ice | 1 - js/test/Ice/slicing/exceptions/Client.js | 124 -------- js/test/Ice/slicing/exceptions/Test.ice | 35 +- js/test/Ice/slicing/objects/Client.js | 71 ++++- js/test/Ice/slicing/objects/Test.ice | 4 - js/test/typescript/Ice/optional/Test.ice | 1 - .../Ice/slicing/exceptions/Client.ts | 124 -------- .../Ice/slicing/exceptions/Test.ice | 45 +-- .../typescript/Ice/slicing/objects/Client.ts | 71 ++++- .../typescript/Ice/slicing/objects/Test.ice | 4 - php/lib/Ice.php | 6 +- php/lib/IceBoxLocal/Service.php | 2 +- php/lib/IceLocal/Connection.php | 4 +- php/lib/IceLocal/ImplicitContext.php | 2 +- php/lib/IceLocal/Instrumentation.php | 20 +- php/lib/IceLocal/LocalException.php | 132 ++++---- php/lib/IceLocal/Logger.php | 2 +- php/lib/IceLocal/ObjectAdapter.php | 2 +- php/lib/IceLocal/ServantLocator.php | 2 +- php/src/Init.cpp | 6 +- php/src/Operation.cpp | 7 - php/src/Types.cpp | 40 +-- php/src/Types.h | 7 +- php/test/Ice/optional/Test.ice | 1 - php/test/Ice/slicing/exceptions/Client.php | 83 ----- php/test/Ice/slicing/exceptions/Test.ice | 45 +-- php/test/Ice/slicing/objects/Client.php | 88 +++++- .../Ice/slicing/objects/ClientPrivate.ice | 1 - php/test/Ice/slicing/objects/Test.ice | 3 - python/modules/IcePy/Operation.cpp | 8 - python/modules/IcePy/Types.cpp | 55 +--- python/modules/IcePy/Types.h | 7 +- python/python/Ice/Communicator_local.py | 2 +- python/python/Ice/Connection_local.py | 11 +- python/python/Ice/Endpoint_local.py | 8 +- python/python/Ice/ImplicitContext_local.py | 2 +- python/python/Ice/Instrumentation_local.py | 11 +- python/python/Ice/LocalException_local.py | 70 +--- python/python/Ice/Logger_local.py | 2 +- python/python/Ice/ObjectAdapter_local.py | 2 +- python/python/Ice/Plugin_local.py | 4 +- python/python/Ice/Properties_local.py | 2 +- python/python/Ice/ServantLocator_local.py | 2 +- python/python/Ice/ValueFactory_local.py | 4 +- python/python/Ice/__init__.py | 6 +- python/test/Ice/optional/Test.ice | 1 - .../test/Ice/slicing/exceptions/AllTests.py | 172 +--------- .../Ice/slicing/exceptions/ClientPrivate.ice | 27 -- python/test/Ice/slicing/exceptions/Server.py | 55 ---- .../test/Ice/slicing/exceptions/ServerAMD.py | 97 ------ .../Ice/slicing/exceptions/ServerPrivate.ice | 15 - python/test/Ice/slicing/exceptions/Test.ice | 45 +-- python/test/Ice/slicing/objects/AllTests.py | 178 +++++++---- .../Ice/slicing/objects/ClientPrivate.ice | 1 - python/test/Ice/slicing/objects/Server.py | 11 - python/test/Ice/slicing/objects/ServerAMD.py | 11 - .../Ice/slicing/objects/ServerPrivate.ice | 5 - python/test/Ice/slicing/objects/Test.ice | 8 - ruby/ruby/Ice.rb | 4 +- ruby/ruby/IceLocal/Connection.rb | 10 +- ruby/ruby/IceLocal/Endpoint.rb | 12 +- ruby/ruby/IceLocal/LocalException.rb | 132 ++++---- ruby/src/IceRuby/Operation.cpp | 8 - ruby/src/IceRuby/Types.cpp | 49 +-- ruby/src/IceRuby/Types.h | 7 +- ruby/test/Ice/optional/Test.ice | 1 - ruby/test/Ice/slicing/exceptions/AllTests.rb | 70 ---- ruby/test/Ice/slicing/exceptions/Test.ice | 45 +-- ruby/test/Ice/slicing/objects/AllTests.rb | 73 ++++- .../Ice/slicing/objects/ClientPrivate.ice | 1 - ruby/test/Ice/slicing/objects/Test.ice | 3 - scripts/tests/Ice/slicing/objects.py | 1 - slice/Glacier2/PermissionsVerifier.ice | 1 - slice/Glacier2/Session.ice | 1 - swift/Rakefile | 2 - swift/src/Ice/Exception.swift | 12 +- swift/src/Ice/InputStream.swift | 71 ++--- swift/src/Ice/OutputStream.swift | 8 +- swift/src/Ice/UnknownSlicedValue.swift | 19 -- swift/src/Ice/Value.swift | 8 +- swift/test/Ice/optional/AllTests.swift | 10 +- swift/test/Ice/optional/Test.ice | 1 - swift/test/Ice/optional/TestAMD.ice | 1 - .../Ice/slicing/exceptions/AllTests.swift | 155 --------- .../Ice/slicing/exceptions/ClientPrivate.ice | 29 -- .../Ice/slicing/exceptions/ServerPrivate.ice | 15 - .../slicing/exceptions/ServerPrivateAMD.ice | 15 - swift/test/Ice/slicing/exceptions/Test.ice | 46 +-- swift/test/Ice/slicing/exceptions/TestAMD.ice | 46 +-- .../Ice/slicing/exceptions/TestAMDI.swift | 84 ----- swift/test/Ice/slicing/exceptions/TestI.swift | 66 ---- swift/test/Ice/slicing/objects/AllTests.swift | 169 ++++++++-- .../Ice/slicing/objects/ClientPrivate.ice | 1 - .../Ice/slicing/objects/ServerPrivate.ice | 5 - .../Ice/slicing/objects/ServerPrivateAMD.ice | 5 - swift/test/Ice/slicing/objects/Test.ice | 8 - swift/test/Ice/slicing/objects/TestAMD.ice | 8 - swift/test/Ice/slicing/objects/TestAMDI.swift | 11 - swift/test/Ice/slicing/objects/TestI.swift | 14 - 204 files changed, 1539 insertions(+), 5520 deletions(-) delete mode 100644 cpp/test/Ice/slicing/exceptions/ClientPrivate.ice delete mode 100644 cpp/test/IceGrid/session/Test.ice delete mode 100644 csharp/test/Ice/slicing/exceptions/ClientPrivate.ice rename java/test/src/main/java/test/Ice/slicing/exceptions/{ClientPrivate.ice => Test.ice} (54%) delete mode 100644 python/test/Ice/slicing/exceptions/ClientPrivate.ice delete mode 100644 swift/test/Ice/slicing/exceptions/ClientPrivate.ice diff --git a/CHANGELOG-3.8.md b/CHANGELOG-3.8.md index 6cda618e3a2..fd3fe06e0e6 100644 --- a/CHANGELOG-3.8.md +++ b/CHANGELOG-3.8.md @@ -12,6 +12,11 @@ These are the changes since the Ice 3.7.10 release in [CHANGELOG-3.7.md](./CHANG ## Slice Language Changes +- Removed support for the `["preserve-slice"]` metadata. Slice classes encoded in the Sliced-format are now always + full-preserved. + +- Exceptions are now always encoded in the Sliced-format and no longer support preservation of unknown type slices. + - Removed local Slice. `local` is no longer a Slice keyword. - Slice classes can no longer define operations or implement interfaces, and `implements` is no longer a Slice keyword. diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h index 81460b6a290..d8ce9a75c0e 100644 --- a/cpp/include/Ice/Exception.h +++ b/cpp/include/Ice/Exception.h @@ -10,7 +10,6 @@ #include #include #include -#include namespace Ice { @@ -64,8 +63,6 @@ class ICE_API UserException : public IceUtil::Exception */ std::unique_ptr ice_clone() const; - virtual Ice::SlicedDataPtr ice_getSlicedData() const; - /** * Obtains the Slice type ID of this exception. * @return The fully-scoped type ID. diff --git a/cpp/include/Ice/InputStream.h b/cpp/include/Ice/InputStream.h index 6795a97aa65..e20e9c68dd5 100644 --- a/cpp/include/Ice/InputStream.h +++ b/cpp/include/Ice/InputStream.h @@ -312,14 +312,12 @@ class ICE_API InputStream : public IceInternal::Buffer /** * Marks the end of a class instance. * - * @param preserve Pass true and the stream will preserve the unknown slices of the instance, or false - * to discard the unknown slices. * @return An object that encapsulates the unknown slice data. */ - SlicedDataPtr endValue(bool preserve) + SlicedDataPtr endValue() { assert(_currentEncaps && _currentEncaps->decoder); - return _currentEncaps->decoder->endInstance(preserve); + return _currentEncaps->decoder->endInstance(); } /** @@ -333,15 +331,11 @@ class ICE_API InputStream : public IceInternal::Buffer /** * Marks the end of a user exception. - * - * @param preserve Pass true and the stream will preserve the unknown slices of the exception, or false - * to discard the unknown slices. - * @return An object that encapsulates the unknown slice data. */ - SlicedDataPtr endException(bool preserve) + void endException() { assert(_currentEncaps && _currentEncaps->decoder); - return _currentEncaps->decoder->endInstance(preserve); + _currentEncaps->decoder->endInstance(); } /** @@ -1097,7 +1091,7 @@ class ICE_API InputStream : public IceInternal::Buffer virtual void throwException(UserExceptionFactory) = 0; virtual void startInstance(SliceType) = 0; - virtual SlicedDataPtr endInstance(bool) = 0; + virtual SlicedDataPtr endInstance() = 0; virtual std::string_view startSlice() = 0; virtual void endSlice() = 0; virtual void skipSlice() = 0; @@ -1172,7 +1166,7 @@ class ICE_API InputStream : public IceInternal::Buffer virtual void throwException(UserExceptionFactory); virtual void startInstance(SliceType); - virtual SlicedDataPtr endInstance(bool); + virtual SlicedDataPtr endInstance(); virtual std::string_view startSlice(); virtual void endSlice(); virtual void skipSlice(); @@ -1207,7 +1201,7 @@ class ICE_API InputStream : public IceInternal::Buffer virtual void throwException(UserExceptionFactory); virtual void startInstance(SliceType); - virtual SlicedDataPtr endInstance(bool); + virtual SlicedDataPtr endInstance(); virtual std::string_view startSlice(); virtual void endSlice(); virtual void skipSlice(); diff --git a/cpp/include/Ice/OutputStream.h b/cpp/include/Ice/OutputStream.h index e39202764e6..85d8dda2d27 100644 --- a/cpp/include/Ice/OutputStream.h +++ b/cpp/include/Ice/OutputStream.h @@ -161,13 +161,11 @@ class ICE_API OutputStream : public IceInternal::Buffer /** * Marks the start of an exception instance. - * @param data Contains the marshaled form of unknown slices from this instance. If not nil, - * these slices will be marshaled with the instance. */ - void startException(const SlicedDataPtr& data) + void startException() { assert(_currentEncaps && _currentEncaps->encoder); - _currentEncaps->encoder->startInstance(ExceptionSlice, data); + _currentEncaps->encoder->startInstance(ExceptionSlice, nullptr); } /** diff --git a/cpp/include/Ice/SlicedData.h b/cpp/include/Ice/SlicedData.h index c82a17489b1..3a68da7a261 100644 --- a/cpp/include/Ice/SlicedData.h +++ b/cpp/include/Ice/SlicedData.h @@ -81,13 +81,6 @@ class ICE_API UnknownSlicedValue : public Value */ UnknownSlicedValue(const std::string& unknownTypeId); - /** - * Obtains the sliced data associated with this instance. - * @return The sliced data if the value has a preserved-slice base class and has been sliced during - * unmarshaling of the value, or nil otherwise. - */ - virtual SlicedDataPtr ice_getSlicedData() const override; - /** * Determine the Slice type ID associated with this instance. * @return The type ID supplied to the constructor. @@ -103,11 +96,6 @@ class ICE_API UnknownSlicedValue : public Value return std::static_pointer_cast(_iceCloneImpl()); } - /// \cond STREAM - virtual void _iceWrite(::Ice::OutputStream*) const override; - virtual void _iceRead(::Ice::InputStream*) override; - /// \endcond - protected: /// \cond INTERNAL @@ -117,7 +105,6 @@ class ICE_API UnknownSlicedValue : public Value private: const std::string _unknownTypeId; - SlicedDataPtr _slicedData; }; } diff --git a/cpp/include/Ice/Value.h b/cpp/include/Ice/Value.h index 6d6cae439ac..4eaf1128cb1 100644 --- a/cpp/include/Ice/Value.h +++ b/cpp/include/Ice/Value.h @@ -76,7 +76,7 @@ class ICE_API Value * @return The sliced data if the value has a preserved-slice base class and has been sliced during * unmarshaling of the value, nil otherwise. */ - virtual SlicedDataPtr ice_getSlicedData() const; + SlicedDataPtr ice_getSlicedData() const; /// \cond STREAM virtual void _iceWrite(Ice::OutputStream*) const; @@ -93,6 +93,10 @@ class ICE_API Value virtual void _iceWriteImpl(Ice::OutputStream*) const {} virtual void _iceReadImpl(Ice::InputStream*) {} /// \endcond + +private: + + ::std::shared_ptr _slicedData; }; /// \cond INTERNAL diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp index b319807dcb8..b03693f8ead 100644 --- a/cpp/src/Ice/Exception.cpp +++ b/cpp/src/Ice/Exception.cpp @@ -97,16 +97,10 @@ Ice::UserException::ice_clone() const return unique_ptr(static_cast(ice_cloneImpl())); } -Ice::SlicedDataPtr -Ice::UserException::ice_getSlicedData() const -{ - return nullptr; -} - void Ice::UserException::_write(::Ice::OutputStream* os) const { - os->startException(0); + os->startException(); _writeImpl(os); os->endException(); } @@ -116,7 +110,7 @@ Ice::UserException::_read(::Ice::InputStream* is) { is->startException(); _readImpl(is); - is->endException(false); + is->endException(); } bool diff --git a/cpp/src/Ice/InputStream.cpp b/cpp/src/Ice/InputStream.cpp index b5e8a049ab8..93d9dc1fc3a 100644 --- a/cpp/src/Ice/InputStream.cpp +++ b/cpp/src/Ice/InputStream.cpp @@ -1880,7 +1880,7 @@ Ice::InputStream::EncapsDecoder10::startInstance(SliceType) } SlicedDataPtr -Ice::InputStream::EncapsDecoder10::endInstance(bool) +Ice::InputStream::EncapsDecoder10::endInstance() { // // Read the Ice::Value slice. @@ -2182,15 +2182,11 @@ Ice::InputStream::EncapsDecoder11::startInstance(SliceType) } SlicedDataPtr -Ice::InputStream::EncapsDecoder11::endInstance(bool preserve) +Ice::InputStream::EncapsDecoder11::endInstance() { - SlicedDataPtr slicedData; - if (preserve) - { - slicedData = readSlicedData(); - } - _current->slices.clear(); + SlicedDataPtr slicedData = readSlicedData(); _current->indirectionTables.clear(); + _current->slices.clear(); _current = _current->previous; return slicedData; } @@ -2337,36 +2333,37 @@ Ice::InputStream::EncapsDecoder11::skipSlice() } // - // Preserve this slice. + // Preserve this slice if unmarshalling a value in Slice format. Exception slices are not preserved. // - SliceInfoPtr info = make_shared(); - info->typeId = _current->typeId; - info->compactId = _current->compactId; - info->hasOptionalMembers = _current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS; - info->isLastSlice = _current->sliceFlags & FLAG_IS_LAST_SLICE; - if (info->hasOptionalMembers) - { - // - // Don't include the optional member end marker. It will be re-written by - // endSlice when the sliced data is re-written. - // - vector(start, _stream->i - 1).swap(info->bytes); - } - else + if (_current->sliceType == ValueSlice) { - vector(start, _stream->i).swap(info->bytes); + SliceInfoPtr info = make_shared(); + info->typeId = _current->typeId; + info->compactId = _current->compactId; + info->hasOptionalMembers = _current->sliceFlags & FLAG_HAS_OPTIONAL_MEMBERS; + info->isLastSlice = _current->sliceFlags & FLAG_IS_LAST_SLICE; + if (info->hasOptionalMembers) + { + // + // Don't include the optional member end marker. It will be re-written by + // endSlice when the sliced data is re-written. + // + vector(start, _stream->i - 1).swap(info->bytes); + } + else + { + vector(start, _stream->i).swap(info->bytes); + } + _current->slices.push_back(info); } _current->indirectionTables.push_back(IndexList()); // // Read the indirect object table. We read the instances or their - // IDs if the instance is a reference to an already un-marhsaled + // IDs if the instance is a reference to an already un-marshaled // object. // - // The SliceInfo object sequence is initialized only if - // readSlicedData is called. - // if (_current->sliceFlags & FLAG_HAS_INDIRECTION_TABLE) { IndexList& table = _current->indirectionTables.back(); @@ -2376,8 +2373,6 @@ Ice::InputStream::EncapsDecoder11::skipSlice() *p = readInstance(_stream->readSize(), 0, 0); } } - - _current->slices.push_back(info); } bool diff --git a/cpp/src/Ice/OutputStream.cpp b/cpp/src/Ice/OutputStream.cpp index c255c59d8c5..e0a038bbaba 100644 --- a/cpp/src/Ice/OutputStream.cpp +++ b/cpp/src/Ice/OutputStream.cpp @@ -850,6 +850,8 @@ void Ice::OutputStream::writeException(const UserException& e) { initEncaps(); + // Exceptions are always encoded with the sliced format. + _currentEncaps->format = FormatType::SlicedFormat; _currentEncaps->encoder->write(e); } diff --git a/cpp/src/Ice/SlicedData.cpp b/cpp/src/Ice/SlicedData.cpp index ffb4f06c272..58ff9e9fab9 100644 --- a/cpp/src/Ice/SlicedData.cpp +++ b/cpp/src/Ice/SlicedData.cpp @@ -36,12 +36,6 @@ Ice::UnknownSlicedValue::UnknownSlicedValue(const string& unknownTypeId) : _unkn { } -SlicedDataPtr -Ice::UnknownSlicedValue::ice_getSlicedData() const -{ - return _slicedData; -} - string Ice::UnknownSlicedValue::ice_id() const { @@ -53,17 +47,3 @@ Ice::UnknownSlicedValue::_iceCloneImpl() const { return make_shared(static_cast(*this)); } - -void -Ice::UnknownSlicedValue::_iceWrite(Ice::OutputStream* ostr) const -{ - ostr->startValue(_slicedData); - ostr->endValue(); -} - -void -Ice::UnknownSlicedValue::_iceRead(Ice::InputStream* istr) -{ - istr->startValue(); - _slicedData = istr->endValue(true); -} diff --git a/cpp/src/Ice/Value.cpp b/cpp/src/Ice/Value.cpp index 9d497bf21a6..464fe63a777 100644 --- a/cpp/src/Ice/Value.cpp +++ b/cpp/src/Ice/Value.cpp @@ -25,7 +25,7 @@ Ice::Value::ice_postUnmarshal() void Ice::Value::_iceWrite(Ice::OutputStream* os) const { - os->startValue(0); + os->startValue(_slicedData); _iceWriteImpl(os); os->endValue(); } @@ -35,7 +35,7 @@ Ice::Value::_iceRead(Ice::InputStream* is) { is->startValue(); _iceReadImpl(is); - is->endValue(false); + _slicedData = is->endValue(); } string @@ -54,7 +54,7 @@ Ice::Value::ice_staticId() SlicedDataPtr Ice::Value::ice_getSlicedData() const { - return nullptr; + return _slicedData; } std::shared_ptr diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index ee8beac11fe..e19d9e9ec78 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -2254,55 +2254,7 @@ Slice::Gen::DataDefVisitor::visitExceptionEnd(const ExceptionPtr& p) string scoped = fixKwd(p->scoped()); ExceptionPtr base = p->base(); - bool basePreserved = p->inheritsMetaData("preserve-slice"); - bool preserved = p->hasMetaData("preserve-slice"); - - if(preserved && !basePreserved) - { - H << sp; - H << nl << "/**"; - H << nl << " * Obtains the SlicedData object created when an unknown exception type was marshaled"; - H << nl << " * in the sliced format and the Ice run time sliced it to a known type."; - H << nl << " * @return The SlicedData object, or nil if the exception was not sliced or was not"; - H << nl << " * marshaled in the sliced format."; - H << nl << " */"; - H << nl << _dllMemberExport << "virtual ::std::shared_ptr<" << getUnqualified("::Ice::SlicedData", scope) - << "> ice_getSlicedData() const override;"; - H << sp; - H << nl << "/// \\cond STREAM"; - H << nl << _dllMemberExport << "virtual void _write(" << getUnqualified("::Ice::OutputStream*", scope) - << ") const override;"; - H << nl << _dllMemberExport << "virtual void _read(" << getUnqualified("::Ice::InputStream*", scope) - << ") override;"; - - H << sp << nl << "::std::shared_ptr<" << getUnqualified("::Ice::SlicedData", scope) << "> _slicedData;"; - H << nl << "/// \\endcond"; - C << sp; - C << nl << "::std::shared_ptr<::Ice::SlicedData>" << nl << scoped.substr(2) << "::ice_getSlicedData() const"; - C << sb; - C << nl << "return _slicedData;"; - C << eb; - - C << sp; - C << nl << "/// \\cond STREAM"; - C << nl << "void" << nl << scoped.substr(2) << "::_write(" << getUnqualified("::Ice::OutputStream*", scope) - << " ostr) const"; - C << sb; - C << nl << "ostr->startException(_slicedData);"; - C << nl << "_writeImpl(ostr);"; - C << nl << "ostr->endException();"; - C << eb; - - C << sp << nl << "void" << nl << scoped.substr(2) << "::_read(" << getUnqualified("::Ice::InputStream*", scope) - << " istr)"; - C << sb; - C << nl << "istr->startException();"; - C << nl << "_readImpl(istr);"; - C << nl << "_slicedData = istr->endException(true);"; - C << eb; - C << nl << "/// \\endcond"; - } H << eb << ';'; // diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 6f4f43ff8ff..dd09bcac656 100644 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -722,42 +722,9 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) DataMemberList members = p->dataMembers(); DataMemberList optionalMembers = p->orderedOptionalDataMembers(); DataMemberList classMembers = p->classDataMembers(); - const bool basePreserved = p->inheritsMetaData("preserve-slice"); - const bool preserved = p->hasMetaData("preserve-slice"); _out << sp << nl << "#region Marshaling support"; - if(preserved && !basePreserved) - { - _out << sp; - emitGeneratedCodeAttribute(); - - _out << nl << "public override " << getUnqualified("Ice.SlicedData", ns) << " ice_getSlicedData()"; - _out << sb; - _out << nl << "return iceSlicedData_;"; - _out << eb; - - _out << sp; - emitGeneratedCodeAttribute(); - - _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", ns) << " ostr_)"; - _out << sb; - _out << nl << "ostr_.startValue(iceSlicedData_);"; - _out << nl << "iceWriteImpl(ostr_);"; - _out << nl << "ostr_.endValue();"; - _out << eb; - - _out << sp; - emitGeneratedCodeAttribute(); - - _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", ns) << " istr_)"; - _out << sb; - _out << nl << "istr_.startValue();"; - _out << nl << "iceReadImpl(istr_);"; - _out << nl << "iceSlicedData_ = istr_.endValue(true);"; - _out << eb; - } - _out << sp; emitGeneratedCodeAttribute(); @@ -806,11 +773,6 @@ Slice::CsVisitor::writeMarshaling(const ClassDefPtr& p) } _out << eb; - if(preserved && !basePreserved) - { - _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", ns) << " iceSlicedData_;"; - } - _out << sp << nl << "#endregion"; // Marshalling support } @@ -2555,37 +2517,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) string scoped = p->scoped(); ExceptionPtr base = p->base(); - const bool basePreserved = p->inheritsMetaData("preserve-slice"); - const bool preserved = p->hasMetaData("preserve-slice"); - - if(preserved && !basePreserved) - { - _out << sp; - emitGeneratedCodeAttribute(); - _out << nl << "public override " << getUnqualified("Ice.SlicedData", ns) << " ice_getSlicedData()"; - _out << sb; - _out << nl << "return slicedData_;"; - _out << eb; - - _out << sp; - emitGeneratedCodeAttribute(); - _out << nl << "public override void iceWrite(" << getUnqualified("Ice.OutputStream", ns) << " ostr_)"; - _out << sb; - _out << nl << "ostr_.startException(slicedData_);"; - _out << nl << "iceWriteImpl(ostr_);"; - _out << nl << "ostr_.endException();"; - _out << eb; - - _out << sp; - emitGeneratedCodeAttribute(); - _out << nl << "public override void iceRead(" << getUnqualified("Ice.InputStream", ns) << " istr_)"; - _out << sb; - _out << nl << "istr_.startException();"; - _out << nl << "iceReadImpl(istr_);"; - _out << nl << "slicedData_ = istr_.endException(true);"; - _out << eb; - } - _out << sp; emitGeneratedCodeAttribute(); _out << nl << "protected override void iceWriteImpl(" << getUnqualified("Ice.OutputStream", ns) << " ostr_)"; @@ -2646,11 +2577,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) _out << eb; } - if(preserved && !basePreserved) - { - _out << sp << nl << "protected " << getUnqualified("Ice.SlicedData", ns) << " slicedData_;"; - } - _out << sp << nl << "#endregion"; // Marshalling support _out << eb; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 1085ebb1732..1fda36d6c75 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -1460,39 +1460,6 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p) int iter; DataMemberList members = p->dataMembers(); DataMemberList optionalMembers = p->orderedOptionalDataMembers(); - bool basePreserved = p->inheritsMetaData("preserve-slice"); - bool preserved = p->hasMetaData("preserve-slice"); - - if(preserved && !basePreserved) - { - out << sp; - writeHiddenDocComment(out); - out << nl << "@Override"; - out << nl << "public " << getUnqualified("com.zeroc.Ice.SlicedData", package) << " ice_getSlicedData()"; - out << sb; - out << nl << "return _iceSlicedData;"; - out << eb; - - out << sp; - writeHiddenDocComment(out); - out << nl << "@Override"; - out << nl << "public void _iceWrite(" << getUnqualified("com.zeroc.Ice.OutputStream", package) << " ostr)"; - out << sb; - out << nl << "ostr.startValue(_iceSlicedData);"; - out << nl << "_iceWriteImpl(ostr);"; - out << nl << "ostr.endValue();"; - out << eb; - - out << sp; - writeHiddenDocComment(out); - out << nl << "@Override"; - out << nl << "public void _iceRead(" << getUnqualified("com.zeroc.Ice.InputStream", package) << " istr)"; - out << sb; - out << nl << "istr.startValue();"; - out << nl << "_iceReadImpl(istr);"; - out << nl << "_iceSlicedData = istr.endValue(true);"; - out << eb; - } out << sp; writeHiddenDocComment(out); @@ -1548,13 +1515,6 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p) out << nl << "super._iceReadImpl(istr_);"; } out << eb; - - if(preserved && !basePreserved) - { - out << sp; - writeHiddenDocComment(out); - out << nl << "protected " << getUnqualified("com.zeroc.Ice.SlicedData", package) << " _iceSlicedData;"; - } } void @@ -2910,44 +2870,11 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) string scoped = p->scoped(); string package = getPackage(p); ExceptionPtr base = p->base(); - bool basePreserved = p->inheritsMetaData("preserve-slice"); - bool preserved = p->hasMetaData("preserve-slice"); DataMemberList members = p->dataMembers(); DataMemberList optionalMembers = p->orderedOptionalDataMembers(); int iter; - if(preserved && !basePreserved) - { - out << sp; - writeHiddenDocComment(out); - out << nl << "@Override"; - out << nl << "public " << getUnqualified("com.zeroc.Ice.SlicedData", package) << " ice_getSlicedData()"; - out << sb; - out << nl << "return _slicedData;"; - out << eb; - - out << sp; - writeHiddenDocComment(out); - out << nl << "@Override"; - out << nl << "public void _write(" << getUnqualified("com.zeroc.Ice.OutputStream", package) << " ostr)"; - out << sb; - out << nl << "ostr.startException(_slicedData);"; - out << nl << "_writeImpl(ostr);"; - out << nl << "ostr.endException();"; - out << eb; - - out << sp; - writeHiddenDocComment(out); - out << nl << "@Override"; - out << nl << "public void _read(" << getUnqualified("com.zeroc.Ice.InputStream", package) << " istr)"; - out << sb; - out << nl << "istr.startException();"; - out << nl << "_readImpl(istr);"; - out << nl << "_slicedData = istr.endException(true);"; - out << eb; - } - out << sp; writeHiddenDocComment(out); out << nl << "@Override"; @@ -3015,13 +2942,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p) } } - if(preserved && !basePreserved) - { - out << sp; - writeHiddenDocComment(out); - out << nl << "protected " << getUnqualified("com.zeroc.Ice.SlicedData", package) << " _slicedData;"; - } - out << sp; writeHiddenDocComment(out); out << nl << "public static final long serialVersionUID = "; diff --git a/cpp/src/slice2js/Gen.cpp b/cpp/src/slice2js/Gen.cpp index a7589ea0800..3ba6f00851e 100644 --- a/cpp/src/slice2js/Gen.cpp +++ b/cpp/src/slice2js/Gen.cpp @@ -1368,10 +1368,8 @@ Slice::Gen::TypesVisitor::visitClassDefStart(const ClassDefPtr& p) _out << eb << ";"; _out << sp; - bool preserved = p->hasMetaData("preserve-slice") && !p->inheritsMetaData("preserve-slice"); - _out << nl << "Slice.defineValue(" << localScope << "." << name << ", \"" - << scoped << "\", " << (preserved ? "true" : "false"); + _out << nl << "Slice.defineValue(" << localScope << "." << name << ", \"" << scoped << "\""; if(p->compactId() >= 0) { _out << ", " << p->compactId(); @@ -1844,15 +1842,6 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) _out << eb << ";"; - bool basePreserved = p->inheritsMetaData("preserve-slice"); - bool preserved = p->hasMetaData("preserve-slice"); - - if(preserved && !basePreserved) - { - _out << sp; - _out << nl << "Slice.PreservedUserException(" << localScope << '.' << name << ");"; - } - return false; } diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index bdc83fa553e..328d24a546c 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -312,9 +312,8 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) } // Emit the type information. - const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); _out << nl << type << " = IcePHP_defineClass('" << scoped << "', '" << escapeName(abs) << "', " - << p->compactId() << ", " << (preserved ? "true" : "false") << ", false, "; + << p->compactId() << ", false, "; if(!base) { _out << "$Ice__t_Value"; @@ -684,9 +683,7 @@ CodeVisitor::visitExceptionStart(const ExceptionPtr& p) } // Emit the type information. - const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); - _out << sp << nl << type << " = IcePHP_defineException('" << scoped << "', '" << escapeName(abs) << "', " - << (preserved ? "true" : "false") << ", "; + _out << sp << nl << type << " = IcePHP_defineException('" << scoped << "', '" << escapeName(abs) << "', "; if(!base) { _out << "null"; diff --git a/cpp/src/slice2py/PythonUtil.cpp b/cpp/src/slice2py/PythonUtil.cpp index f78de4aced0..1432b644b2c 100644 --- a/cpp/src/slice2py/PythonUtil.cpp +++ b/cpp/src/slice2py/PythonUtil.cpp @@ -609,8 +609,7 @@ Slice::Python::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', " << valueName << ", " << p->compactId() << ", "; writeMetaData(p->getMetaData()); - const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); - _out << ", " << (preserved ? "True" : "False") << ", False, "; + _out << ", False, "; if(!base) { _out << "None"; @@ -693,7 +692,7 @@ Slice::Python::CodeVisitor::visitInterfaceDefStart(const InterfaceDefPtr& p) // TODO: remove this interface-by-value. _out << sp << nl << "_M_" << type << " = IcePy.defineValue('" << scoped << "', Ice.Value, -1, "; writeMetaData(p->getMetaData()); - _out << ", False, True, None, ())"; + _out << ", True, None, ())"; _out << sp << nl << "if " << getDictLookup(p, "", "Prx") << ':'; _out.inc(); @@ -1173,8 +1172,7 @@ Slice::Python::CodeVisitor::visitExceptionStart(const ExceptionPtr& p) string type = getAbsolute(p, "_t_"); _out << sp << nl << "_M_" << type << " = IcePy.defineException('" << scoped << "', " << name << ", "; writeMetaData(p->getMetaData()); - const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); - _out << ", " << (preserved ? "True" : "False") << ", "; + _out << ", "; if(!base) { _out << "None"; diff --git a/cpp/src/slice2rb/RubyUtil.cpp b/cpp/src/slice2rb/RubyUtil.cpp index bf4f5bc6f04..07ece58d075 100644 --- a/cpp/src/slice2rb/RubyUtil.cpp +++ b/cpp/src/slice2rb/RubyUtil.cpp @@ -342,12 +342,10 @@ Slice::Ruby::CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "end"; _classHistory.insert(scoped); // Avoid redundant declarations. - const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); - _out << sp << nl << "T_" << name << ".defineClass(" << name << ", " << p->compactId() << ", " - << (preserved ? "true" : "false") << ", false, "; + << "false, "; if(!base) { _out << "nil"; @@ -749,9 +747,7 @@ Slice::Ruby::CodeVisitor::visitExceptionStart(const ExceptionPtr& p) // // Emit the type information. // - const bool preserved = p->hasMetaData("preserve-slice") || p->inheritsMetaData("preserve-slice"); - _out << sp << nl << "T_" << name << " = ::Ice::__defineException('" << scoped << "', " << name << ", " - << (preserved ? "true" : "false") << ", "; + _out << sp << nl << "T_" << name << " = ::Ice::__defineException('" << scoped << "', " << name << ", "; if(!base) { _out << "nil"; diff --git a/cpp/src/slice2swift/Gen.cpp b/cpp/src/slice2swift/Gen.cpp index 8713893d1b8..0104d961808 100644 --- a/cpp/src/slice2swift/Gen.cpp +++ b/cpp/src/slice2swift/Gen.cpp @@ -471,14 +471,6 @@ Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) writeMembers(out, members, p); - const bool basePreserved = p->inheritsMetaData("preserve-slice"); - const bool preserved = p->hasMetaData("preserve-slice"); - - if(preserved && !basePreserved) - { - out << nl << "var _slicedData: Ice.SlicedData?"; - } - bool rootClass = !base; if(rootClass || !members.empty()) { @@ -556,35 +548,6 @@ Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p) out << eb; } - if(preserved && !basePreserved) - { - out << sp; - out << nl << "/// Returns the sliced data if the exception has a preserved-slice base class and has been"; - out << nl << "/// sliced during un-marshaling, nil is returned otherwise."; - out << nl << "///"; - out << nl << "/// - returns: `Ice.SlicedData` - The sliced data."; - out << nl << "open override func ice_getSlicedData() -> " << getUnqualified("Ice.SlicedData", swiftModule) - << "?" << sb; - out << nl << "return _slicedData"; - out << eb; - - out << sp; - out << nl << "open override func _iceRead(from istr: " << getUnqualified("Ice.InputStream", swiftModule) - << ") throws" << sb; - out << nl << "istr.startException()"; - out << nl << "try _iceReadImpl(from: istr)"; - out << nl << "_slicedData = try istr.endException(preserve: true)"; - out << eb; - - out << sp; - out << nl << "open override func _iceWrite(to ostr: " << getUnqualified("Ice.OutputStream", swiftModule) << ")" - << sb; - out << nl << "ostr.startException(data: _slicedData)"; - out << nl << "_iceWriteImpl(to: ostr)"; - out << nl << "ostr.endException()"; - out << eb; - } - out << eb; return false; } @@ -1403,14 +1366,7 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) const DataMemberList allMembers = p->allDataMembers(); const DataMemberList optionalMembers = p->orderedOptionalDataMembers(); - const bool basePreserved = p->inheritsMetaData("preserve-slice"); - const bool preserved = p->hasMetaData("preserve-slice"); - writeMembers(out, members, p); - if(preserved && !basePreserved) - { - out << nl << "var _slicedData: " << getUnqualified("Ice.SlicedData?", swiftModule); - } if(!base || !members.empty()) { @@ -1484,35 +1440,6 @@ Gen::ValueVisitor::visitClassDefStart(const ClassDefPtr& p) } out << eb; - if(preserved && !basePreserved) - { - out << sp; - out << nl << "/// Returns the sliced data if the value has a preserved-slice base class and has been sliced"; - out << nl << "/// during un-marshaling of the value, nil is returned otherwise."; - out << nl << "///"; - out << nl << "/// returns: `Ice.SlicedData?` - The sliced data or nil"; - out << nl << "open override func ice_getSlicedData() -> " << getUnqualified("Ice.SlicedData?", swiftModule) - << sb; - out << nl << "return _slicedData"; - out << eb; - - out << sp; - out << nl << "open override func _iceRead(from istr: " << getUnqualified("Ice.InputStream", swiftModule) - << ") throws" << sb; - out << nl << "istr.startValue()"; - out << nl << "try _iceReadImpl(from: istr)"; - out << nl << "_slicedData = try istr.endValue(preserve: true)"; - out << eb; - - out << sp; - out << nl << "open override func _iceWrite(to ostr: " << getUnqualified("Ice.OutputStream", swiftModule) - << ")" << sb; - out << nl << "ostr.startValue(data: _slicedData)"; - out << nl << "_iceWriteImpl(to: ostr)"; - out << nl << "ostr.endValue()"; - out << eb; - } - return true; } diff --git a/cpp/test/Ice/metrics/AllTests.cpp b/cpp/test/Ice/metrics/AllTests.cpp index 584c68caa3e..52c710170c9 100644 --- a/cpp/test/Ice/metrics/AllTests.cpp +++ b/cpp/test/Ice/metrics/AllTests.cpp @@ -857,7 +857,7 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) dm1 = dynamic_pointer_cast(map["opWithUserException"]); test(dm1->current <= 1 && dm1->total == 1 && dm1->failures == 0 && dm1->userException == 1); - test(dm1->size == 38 && dm1->replySize == 23); + test(dm1->size == 38 && dm1->replySize == 27); dm1 = dynamic_pointer_cast(map["opWithLocalException"]); test(dm1->current <= 1 && dm1->total == 1 && dm1->failures == 1 && dm1->userException == 0); @@ -1159,7 +1159,7 @@ allTests(Test::TestHelper* helper, const CommunicatorObserverIPtr& obsv) test(collocated ? (im1->collocated.size() == 1) : (im1->remotes.size() == 1)); rim1 = dynamic_pointer_cast(collocated ? im1->collocated[0] : im1->remotes[0]); test(rim1->current == 0 && rim1->total == 3 && rim1->failures == 0); - test(rim1->size == 114 && rim1->replySize == 69); + test(rim1->size == 114 && rim1->replySize == 81); test(im1->userException == 3); im1 = dynamic_pointer_cast(map["opWithLocalException"]); diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp index eb01d0ac350..779dc400ce8 100644 --- a/cpp/test/Ice/optional/AllTests.cpp +++ b/cpp/test/Ice/optional/AllTests.cpp @@ -43,7 +43,7 @@ class TestObjectReader : public Ice::Value in->startValue(); in->startSlice(); in->endSlice(); - in->endValue(false); + in->endValue(); } protected: @@ -72,7 +72,7 @@ class BObjectReader : public Ice::Value in->startSlice(); in->read(v); in->endSlice(); - in->endValue(false); + in->endValue(); } protected: @@ -104,7 +104,7 @@ class CObjectReader : public Ice::Value in->startSlice(); in->read(v); in->endSlice(); - in->endValue(false); + in->endValue(); } protected: @@ -122,7 +122,7 @@ class DObjectWriter : public Ice::Value virtual void _iceWrite(Ice::OutputStream* out) const { - out->startValue(0); + out->startValue(nullptr); // ::Test::D out->startSlice("::Test::D", -1, false); string s = "test"; @@ -189,7 +189,7 @@ class DObjectReader : public Ice::Value in->startSlice(); in->read(v); in->endSlice(); - in->endValue(false); + in->endValue(); } void check() @@ -226,7 +226,7 @@ class FObjectReader : public Ice::Value in->startSlice(); in->read(_f->ae); in->endSlice(); - in->endValue(false); + in->endValue(); } FPtr diff --git a/cpp/test/Ice/optional/Test.ice b/cpp/test/Ice/optional/Test.ice index 6c00298279a..6e5e020be36 100644 --- a/cpp/test/Ice/optional/Test.ice +++ b/cpp/test/Ice/optional/Test.ice @@ -114,7 +114,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB = 0; diff --git a/cpp/test/Ice/optional/TestAMD.ice b/cpp/test/Ice/optional/TestAMD.ice index 1d29a405869..464f231b1d6 100644 --- a/cpp/test/Ice/optional/TestAMD.ice +++ b/cpp/test/Ice/optional/TestAMD.ice @@ -114,7 +114,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB = 0; diff --git a/cpp/test/Ice/slicing/exceptions/AllTests.cpp b/cpp/test/Ice/slicing/exceptions/AllTests.cpp index 393001a937a..2d7a66c6bc9 100644 --- a/cpp/test/Ice/slicing/exceptions/AllTests.cpp +++ b/cpp/test/Ice/slicing/exceptions/AllTests.cpp @@ -4,54 +4,11 @@ #include #include -#include +#include using namespace std; using namespace Test; -class RelayI final : public Relay -{ - void knownPreservedAsBase(const ::Ice::Current&) final - { - KnownPreservedDerived ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - void knownPreservedAsKnownPreserved(const ::Ice::Current&) final - { - KnownPreservedDerived ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - void unknownPreservedAsBase(const ::Ice::Current&) final - { - Preserved2 ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = make_shared("bc", "pc"); - ex.p2 = ex.p1; - throw ex; - } - - void unknownPreservedAsKnownPreserved(const ::Ice::Current&) final - { - Preserved2 ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = make_shared("bc", "pc"); - ex.p2 = ex.p1; - throw ex; - } -}; - TestIntfPrx allTests(Test::TestHelper* helper) { @@ -588,217 +545,5 @@ allTests(Test::TestHelper* helper) } cout << "ok" << endl; - cout << "unknown most derived in compact format... " << flush; - { - try - { - testPrx->unknownMostDerived2AsBaseCompact(); - test(false); - } - catch(const Base&) - { - // - // For the 1.0 encoding, the unknown exception is sliced to Base. - // - test(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0); - } - catch(const Ice::UnknownUserException&) - { - // - // An UnknownUserException is raised for the compact format because the - // most-derived type is unknown and the exception cannot be sliced. - // - test(testPrx->ice_getEncodingVersion() != Ice::Encoding_1_0); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(...) - { - test(false); - } - } - cout << "ok" << endl; - - cout << "preserved exceptions... " << flush; - try - { - testPrx->unknownPreservedAsBase(); - test(false); - } - catch(const Base& ex) - { - if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) - { - test(!ex.ice_getSlicedData()); - } - else - { - Ice::SlicedDataPtr slicedData = ex.ice_getSlicedData(); - test(slicedData); - test(slicedData->slices.size() == 2); - test(slicedData->slices[1]->typeId == "::Test::SPreserved1"); - test(slicedData->slices[0]->typeId == "::Test::SPreserved2"); - } - } - catch(const Ice::LocalException& ex) - { - cerr << ex << endl; - test(false); - } - catch(...) - { - test(false); - } - - try - { - testPrx->unknownPreservedAsKnownPreserved(); - test(false); - } - catch(const KnownPreserved& ex) - { - test(ex.kp == "preserved"); - if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) - { - test(!ex.ice_getSlicedData()); - } - else - { - Ice::SlicedDataPtr slicedData = ex.ice_getSlicedData(); - test(slicedData); - test(slicedData->slices.size() == 2); - test(slicedData->slices[1]->typeId == "::Test::SPreserved1"); - test(slicedData->slices[0]->typeId == "::Test::SPreserved2"); - } - } - catch(const Ice::LocalException& ex) - { - cerr << ex << endl; - test(false); - } - catch(...) - { - test(false); - } - - Ice::ObjectAdapterPtr adapter = communicator->createObjectAdapter(""); - RelayPrx relay(adapter->addWithUUID(make_shared())); - adapter->activate(); - testPrx->ice_getConnection()->setAdapter(adapter); - try - { - testPrx->relayKnownPreservedAsBase(relay); - test(false); - } - catch(const KnownPreservedDerived& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(const Ice::LocalException& ex) - { - cerr << ex << endl; - test(false); - } - catch(...) - { - test(false); - } - - try - { - testPrx->relayKnownPreservedAsKnownPreserved(relay); - test(false); - } - catch(const KnownPreservedDerived& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(...) - { - test(false); - } - - try - { - testPrx->relayUnknownPreservedAsBase(relay); - test(false); - } - catch(const Preserved2& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - test(ex.p1->ice_id() == PreservedClass::ice_staticId()); - PreservedClassPtr pc = dynamic_pointer_cast(ex.p1); - test(pc->bc == "bc"); - test(pc->pc == "pc"); - test(ex.p2 == ex.p1); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(const KnownPreservedDerived& ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0); - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(...) - { - test(false); - } - - try - { - testPrx->relayUnknownPreservedAsKnownPreserved(relay); - test(false); - } - catch(const Ice::OperationNotExistException&) - { - } - catch(const Preserved2& ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - test(ex.p1->ice_id() == PreservedClass::ice_staticId()); - PreservedClassPtr pc = dynamic_pointer_cast(ex.p1); - test(pc->bc == "bc"); - test(pc->pc == "pc"); - test(ex.p2 == ex.p1); - } - catch(const KnownPreservedDerived& ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0); - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(...) - { - test(false); - } - - adapter->destroy(); - cout << "ok" << endl; - return testPrx; } diff --git a/cpp/test/Ice/slicing/exceptions/Client.cpp b/cpp/test/Ice/slicing/exceptions/Client.cpp index a26f5b0b7fe..6ec2e0e5a4a 100644 --- a/cpp/test/Ice/slicing/exceptions/Client.cpp +++ b/cpp/test/Ice/slicing/exceptions/Client.cpp @@ -21,8 +21,8 @@ Client::run(int argc, char** argv) { Ice::CommunicatorHolder communicator = initialize(argc, argv); TestIntfPrx allTests(Test::TestHelper*); - TestIntfPrx Test = allTests(this); - Test->shutdown(); + TestIntfPrx prx = allTests(this); + prx->shutdown(); } DEFINE_TEST(Client) diff --git a/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice b/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice deleted file mode 100644 index 552e9b14337..00000000000 --- a/cpp/test/Ice/slicing/exceptions/ClientPrivate.ice +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -module Test -{ - -class PreservedClass extends BaseClass -{ - string pc; -} - -exception Preserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception Preserved2 extends Preserved1 -{ - BaseClass p2; -} - -} diff --git a/cpp/test/Ice/slicing/exceptions/Makefile.mk b/cpp/test/Ice/slicing/exceptions/Makefile.mk index 746e565c5a8..cfabb2f1835 100644 --- a/cpp/test/Ice/slicing/exceptions/Makefile.mk +++ b/cpp/test/Ice/slicing/exceptions/Makefile.mk @@ -3,7 +3,7 @@ # $(test)_sliceflags := -I$(test) -$(test)_client_sources = $(test-client-sources) ClientPrivate.ice +$(test)_client_sources = $(test-client-sources) $(test)_server_sources = $(test-server-sources) ServerPrivate.ice $(test)_serveramd_sources = $(test-serveramd-sources) ServerPrivateAMD.ice diff --git a/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice b/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice index 843b57a6a0f..772989b9748 100644 --- a/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice +++ b/cpp/test/Ice/slicing/exceptions/ServerPrivate.ice @@ -29,19 +29,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice b/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice index 1acbe0b6442..6492ad616cc 100644 --- a/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice +++ b/cpp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice @@ -29,19 +29,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/cpp/test/Ice/slicing/exceptions/Test.ice b/cpp/test/Ice/slicing/exceptions/Test.ice index a16c2319ea7..92cd9ecf6a6 100644 --- a/cpp/test/Ice/slicing/exceptions/Test.ice +++ b/cpp/test/Ice/slicing/exceptions/Test.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/cpp/test/Ice/slicing/exceptions/TestAMD.ice b/cpp/test/Ice/slicing/exceptions/TestAMD.ice index 1fb00655b11..d4629f3ff4f 100644 --- a/cpp/test/Ice/slicing/exceptions/TestAMD.ice +++ b/cpp/test/Ice/slicing/exceptions/TestAMD.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["amd", "format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp b/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp index d95b3e8b7b5..fbb485383de 100644 --- a/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp +++ b/cpp/test/Ice/slicing/exceptions/TestAMDI.cpp @@ -233,166 +233,7 @@ TestI::unknownMostDerived2AsBaseAsync(function, function, function error, - const Current&) -{ - try - { - UnknownMostDerived2 umd2; - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - throw umd2; - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::knownPreservedAsBaseAsync(function, function error, const Current&) -{ - try - { - KnownPreservedDerived ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::knownPreservedAsKnownPreservedAsync(function, function error, - const Current&) -{ - try - { - KnownPreservedDerived ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::relayKnownPreservedAsBaseAsync(optional r, - function, function error, - const Current& c) -{ - try - { - RelayPrx p(c.con->createProxy(r->ice_getIdentity())); - p->knownPreservedAsBase(); - test(false); - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::relayKnownPreservedAsKnownPreservedAsync(optional r, - function, function error, - const Current& c) -{ - try - { - RelayPrx p(c.con->createProxy(r->ice_getIdentity())); - p->knownPreservedAsKnownPreserved(); - test(false); - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::unknownPreservedAsBaseAsync(function, function error, const Current&) -{ - try - { - SPreserved2 ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = make_shared("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::unknownPreservedAsKnownPreservedAsync(function, function error, - const Current&) -{ - try - { - SPreserved2 ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = make_shared("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::relayUnknownPreservedAsBaseAsync(optional r, - function, function error, - const Current& c) -{ - try - { - RelayPrx p(c.con->createProxy(r->ice_getIdentity())); - p->unknownPreservedAsBase(); - test(false); - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::relayUnknownPreservedAsKnownPreservedAsync(optional r, - function, function error, - const Current& c) -{ - try - { - RelayPrx p(c.con->createProxy(r->ice_getIdentity())); - p->unknownPreservedAsKnownPreserved(); - test(false); - } - catch(...) - { - error(current_exception()); - } -} - -void -TestI::shutdownAsync(function response, function, const Current& current) +TestI::shutdownAsync(function response, function, const ::Ice::Current& current) { current.adapter->getCommunicator()->shutdown(); response(); diff --git a/cpp/test/Ice/slicing/exceptions/TestAMDI.h b/cpp/test/Ice/slicing/exceptions/TestAMDI.h index e7ccf477e76..4fafd82c249 100644 --- a/cpp/test/Ice/slicing/exceptions/TestAMDI.h +++ b/cpp/test/Ice/slicing/exceptions/TestAMDI.h @@ -78,55 +78,6 @@ class TestI final : public Test::TestIntf std::function, const ::Ice::Current&) final; - void unknownMostDerived2AsBaseCompactAsync( - std::function, - std::function, - const ::Ice::Current&) final; - - void knownPreservedAsBaseAsync( - std::function, - std::function, - const ::Ice::Current&) final; - - void knownPreservedAsKnownPreservedAsync( - std::function, - std::function, - const ::Ice::Current&) final; - - void relayKnownPreservedAsBaseAsync( - std::optional, - std::function, - std::function, - const ::Ice::Current&) final; - - void relayKnownPreservedAsKnownPreservedAsync( - std::optional, - std::function, - std::function, - const ::Ice::Current&) final; - - void unknownPreservedAsBaseAsync( - std::function, - std::function, - const ::Ice::Current&) final; - - void unknownPreservedAsKnownPreservedAsync( - std::function, - std::function, - const ::Ice::Current&) final; - - void relayUnknownPreservedAsBaseAsync( - std::optional, - std::function, - std::function, - const ::Ice::Current&) final; - - void relayUnknownPreservedAsKnownPreservedAsync( - std::optional, - std::function, - std::function, - const ::Ice::Current&) final; - void shutdownAsync( std::function, std::function, diff --git a/cpp/test/Ice/slicing/exceptions/TestI.cpp b/cpp/test/Ice/slicing/exceptions/TestI.cpp index b82c83896d9..4207ab5680b 100644 --- a/cpp/test/Ice/slicing/exceptions/TestI.cpp +++ b/cpp/test/Ice/slicing/exceptions/TestI.cpp @@ -137,92 +137,6 @@ TestI::unknownMostDerived2AsBase(const Current&) throw umd2; } -void -TestI::unknownMostDerived2AsBaseCompact(const Current&) -{ - UnknownMostDerived2 umd2; - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - throw umd2; -} - -void -TestI::knownPreservedAsBase(const Current&) -{ - KnownPreservedDerived ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; -} - -void -TestI::knownPreservedAsKnownPreserved(const Current&) -{ - KnownPreservedDerived ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; -} - -void -TestI::relayKnownPreservedAsBase(optional r, const Current& c) -{ - RelayPrx p(c.con->createProxy(r->ice_getIdentity())); - p->knownPreservedAsBase(); - test(false); -} - -void -TestI::relayKnownPreservedAsKnownPreserved(optional r, const Current& c) -{ - RelayPrx p(c.con->createProxy(r->ice_getIdentity())); - p->knownPreservedAsKnownPreserved(); - test(false); -} - -void -TestI::unknownPreservedAsBase(const Current&) -{ - SPreserved2 ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = make_shared("bc", "spc"); - ex.p2 = ex.p1; - throw ex; -} - -void -TestI::unknownPreservedAsKnownPreserved(const Current&) -{ - SPreserved2 ex; - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = make_shared("bc", "spc"); - ex.p2 = ex.p1; - throw ex; -} - -void -TestI::relayUnknownPreservedAsBase(optional r, const Current& c) -{ - RelayPrx p = r->ice_fixed(c.con); - p->unknownPreservedAsBase(); - test(false); -} - -void -TestI::relayUnknownPreservedAsKnownPreserved(optional r, const Current& c) -{ - RelayPrx p = r->ice_fixed(c.con); - p->unknownPreservedAsKnownPreserved(); - test(false); -} - void TestI::shutdown(const Current& current) { diff --git a/cpp/test/Ice/slicing/exceptions/TestI.h b/cpp/test/Ice/slicing/exceptions/TestI.h index d88dc196bcb..ad74cb24dc8 100644 --- a/cpp/test/Ice/slicing/exceptions/TestI.h +++ b/cpp/test/Ice/slicing/exceptions/TestI.h @@ -29,20 +29,6 @@ class TestI final : public Test::TestIntf void unknownMostDerived1AsKnownIntermediate(const Ice::Current&) final; void unknownMostDerived2AsBase(const Ice::Current&) final; - void unknownMostDerived2AsBaseCompact(const Ice::Current&) final; - - void knownPreservedAsBase(const Ice::Current&) final; - void knownPreservedAsKnownPreserved(const Ice::Current&) final; - - void relayKnownPreservedAsBase(std::optional, const Ice::Current&) final; - void relayKnownPreservedAsKnownPreserved(std::optional, const Ice::Current&) final; - - void unknownPreservedAsBase(const Ice::Current&) final; - void unknownPreservedAsKnownPreserved(const Ice::Current&) final; - - void relayUnknownPreservedAsBase(std::optional, const Ice::Current&) final; - void relayUnknownPreservedAsKnownPreserved(std::optional, const Ice::Current&) final; - void shutdown(const Ice::Current&) final; }; diff --git a/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj b/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj index 9728d695842..3bbd8fc4de6 100644 --- a/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj +++ b/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj @@ -71,54 +71,29 @@ - - - true - true - true - ..\..\ClientPrivate.ice - true true true ..\..\Test.ice - - true - true - true - ..\..\ClientPrivate.ice - true true true ..\..\Test.ice - - true - true - true - ..\..\ClientPrivate.ice - true true true ..\..\Test.ice - - true - true - true - ..\..\ClientPrivate.ice - true true @@ -127,48 +102,24 @@ - - true - true - true - ..\..\ClientPrivate.ice - true true true ..\..\Test.ice - - true - true - true - ..\..\ClientPrivate.ice - true true true ..\..\Test.ice - - true - true - true - ..\..\ClientPrivate.ice - true true true ..\..\Test.ice - - true - true - true - ..\..\ClientPrivate.ice - true true diff --git a/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj.filters b/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj.filters index b6444c6edb5..2f94c8ad88a 100644 --- a/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj.filters +++ b/cpp/test/Ice/slicing/exceptions/msbuild/client/client.vcxproj.filters @@ -7,27 +7,16 @@ Source Files - - Source Files\x64\Debug Source Files\x64\Debug - - Source Files\Win32\Debug - Source Files\Win32\Debug - - Source Files\x64\Release - Source Files\x64\Release - - Source Files\Win32\Release - Source Files\Win32\Release @@ -81,27 +70,15 @@ - - Header Files\x64\Debug - Header Files\x64\Debug - - Header Files\Win32\Debug - Header Files\Win32\Debug - - Header Files\x64\Release - Header Files\x64\Release - - Header Files\Win32\Release - Header Files\Win32\Release @@ -110,9 +87,6 @@ - - Slice Files - Slice Files diff --git a/cpp/test/Ice/slicing/objects/AllTests.cpp b/cpp/test/Ice/slicing/objects/AllTests.cpp index 0ae614f177c..de9dfbf5e31 100644 --- a/cpp/test/Ice/slicing/objects/AllTests.cpp +++ b/cpp/test/Ice/slicing/objects/AllTests.cpp @@ -47,16 +47,26 @@ void breakCycles(shared_ptr o) if(dynamic_pointer_cast(o)) { auto d3 = dynamic_pointer_cast(o); + auto tmp = d3->pd3; d3->pd3 = nullptr; + if(tmp != d3) + { + breakCycles(tmp); + } } if(dynamic_pointer_cast(o)) { auto b = dynamic_pointer_cast(o); - if(b->pb) + auto tmp = b->pb; + b->pb = nullptr; + if (tmp != b) { - b->pb->pb = nullptr; + breakCycles(tmp); + } + if(b->ice_getSlicedData()) + { + b->ice_getSlicedData()->clear(); } - b->pb = nullptr; } if(dynamic_pointer_cast(o)) { @@ -328,7 +338,10 @@ class Callback : public CallbackBase test(d1); test(d1->sd1 == "D1.sd1"); test(d1->pd1 == b2); + breakCycles(b2); + breakCycles(d1); + called(); } @@ -354,18 +367,20 @@ class Callback : public CallbackBase } void - response_returnTest1(const BPtr& r, const BPtr& p1, const BPtr&) + response_returnTest1(const BPtr& r, const BPtr& p1, const BPtr& p2) { test(r == p1); breakCycles(r); + breakCycles(p2); called(); } void - response_returnTest2(const BPtr& r, const BPtr& p1, const BPtr&) + response_returnTest2(const BPtr& r, const BPtr& p1, const BPtr& p2) { test(r == p1); breakCycles(r); + breakCycles(p2); called(); } @@ -515,8 +530,6 @@ class Callback : public CallbackBase test(!p2); test(r->pi == 3); called(); - - breakCycles(r); } void @@ -624,25 +637,6 @@ class Callback : public CallbackBase }; using CallbackPtr = std::shared_ptr; -class PNodeI : public virtual PNode -{ -public: - - PNodeI() - { - ++counter; - } - - virtual ~PNodeI() - { - --counter; - } - - static int counter; -}; - -int PNodeI::counter = 0; - void testUOO(const TestIntfPrx& testPrx) { @@ -1208,6 +1202,7 @@ allTests(Test::TestHelper* helper) test(d1->pd1 == b2); breakCycles(b2); + breakCycles(d1); } catch(...) { @@ -1239,6 +1234,7 @@ allTests(Test::TestHelper* helper) test(d1->pd1 == b2); breakCycles(b2); + breakCycles(d1); } catch(...) { @@ -1354,7 +1350,6 @@ allTests(Test::TestHelper* helper) test(r == p1); breakCycles(r); - breakCycles(p1); breakCycles(p2); } catch(...) @@ -1392,7 +1387,6 @@ allTests(Test::TestHelper* helper) test(r == p1); breakCycles(r); - breakCycles(p1); breakCycles(p2); } catch(...) @@ -1448,10 +1442,18 @@ allTests(Test::TestHelper* helper) BPtr b2 = b1->pb; test(b2); test(b2->sb == "D3.sb"); - test(b2->ice_id() == "::Test::B"); // Sliced by server test(b2->pb == b1); D3Ptr p3 = dynamic_pointer_cast(b2); - test(!p3); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p3); + } + else + { + test(p3); + test(p3->pd3 == p1); + test(p3->sd3 == "D3.sd3"); + } test(b1 != d1); test(b1 != d3); @@ -1498,10 +1500,18 @@ allTests(Test::TestHelper* helper) BPtr b2 = b1->pb; test(b2); test(b2->sb == "D3.sb"); - test(b2->ice_id() == "::Test::B"); // Sliced by server test(b2->pb == b1); D3Ptr p3 = dynamic_pointer_cast(b2); - test(!p3); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p3); + } + else + { + test(p3); + test(p3->pd3 == p1); + test(p3->sd3 == "D3.sd3"); + } test(b1 != d1); test(b1 != d3); @@ -1538,10 +1548,6 @@ allTests(Test::TestHelper* helper) test(b1); test(b1->sb == "D3.sb"); - test(b1->ice_id() == "::Test::B"); // Sliced by server - - D3Ptr p1 = dynamic_pointer_cast(b1); - test(!p1); BPtr b2 = b1->pb; test(b2); @@ -1554,6 +1560,18 @@ allTests(Test::TestHelper* helper) test(p3->sd1 == "D1.sd1"); test(p3->pd1 == b1); + D3Ptr p1 = dynamic_pointer_cast(b1); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p1); + } + else + { + test(p1); + test(p1->sd3 == "D3.sd3"); + test(p1->pd3 == b2); + } + test(b1 != d1); test(b1 != d3); test(b2 != d1); @@ -1590,10 +1608,6 @@ allTests(Test::TestHelper* helper) test(b1); test(b1->sb == "D3.sb"); - test(b1->ice_id() == "::Test::B"); // Sliced by server - D3Ptr p1 = dynamic_pointer_cast(b1); - test(!p1); - BPtr b2 = b1->pb; test(b2); test(b2->sb == "D1.sb"); @@ -1604,6 +1618,18 @@ allTests(Test::TestHelper* helper) test(p3->sd1 == "D1.sd1"); test(p3->pd1 == b1); + D3Ptr p1 = dynamic_pointer_cast(b1); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p1); + } + else + { + test(p1); + test(p1->sd3 == "D3.sd3"); + test(p1->pd3 == b2); + } + test(b1 != d1); test(b1 != d3); test(b2 != d1); @@ -1767,13 +1793,27 @@ allTests(Test::TestHelper* helper) BPtr r = testPrx->returnTest3(d3, b2); test(r); - test(r->ice_id() == "::Test::B"); - test(r->sb == "D3.sb"); - test(r->pb == r); - breakCycles(r); + D3Ptr p3 = dynamic_pointer_cast(r); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p3); + } + else + { + test(p3); + test(p3->sb == "D3.sb"); + test(p3->pb == r); + test(p3->sd3 == "D3.sd3"); + + test(p3->pd3->ice_id() == "::Test::B"); + test(p3->pd3->sb == "B.sb(1)"); + test(p3->pd3->pb == p3->pd3); + } + breakCycles(b1); breakCycles(d3); + breakCycles(r); } catch(...) { @@ -1802,9 +1842,22 @@ allTests(Test::TestHelper* helper) auto r = testPrx->returnTest3Async(d3, b2).get(); test(r); - test(r->ice_id() == "::Test::B"); - test(r->sb == "D3.sb"); - test(r->pb == r); + D3Ptr p3 = dynamic_pointer_cast(r); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p3); + } + else + { + test(p3); + test(p3->sb == "D3.sb"); + test(p3->pb == r); + test(p3->sd3 == "D3.sd3"); + + test(p3->pd3->ice_id() == "::Test::B"); + test(p3->pd3->sb == "B.sb(1)"); + test(p3->pd3->pb == p3->pd3); + } breakCycles(b1); breakCycles(d3); @@ -1841,9 +1894,19 @@ allTests(Test::TestHelper* helper) BPtr r = testPrx->returnTest3(d3, d12); test(r); - test(r->ice_id() == "::Test::B"); test(r->sb == "D3.sb"); test(r->pb == r); + D3Ptr p3 = dynamic_pointer_cast(r); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p3); + } + else + { + test(p3); + test(p3->sd3 == "D3.sd3"); + test(p3->pd3->ice_id() == "::Test::D1"); + } breakCycles(d3); breakCycles(d11); @@ -1881,9 +1944,19 @@ allTests(Test::TestHelper* helper) auto r = testPrx->returnTest3Async(d3, d12).get(); test(r); - test(r->ice_id() == "::Test::B"); test(r->sb == "D3.sb"); test(r->pb == r); + D3Ptr p3 = dynamic_pointer_cast(r); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p3); + } + else + { + test(p3); + test(p3->sd3 == "D3.sd3"); + test(p3->pd3->ice_id() == "::Test::D1"); + } breakCycles(d3); breakCycles(d11); @@ -1974,11 +2047,20 @@ allTests(Test::TestHelper* helper) test(ss1b->ice_id() == "::Test::B"); test(ss1d1->ice_id() == "::Test::D1"); - test(ss1d3->ice_id() == "::Test::B"); test(ss2b->ice_id() == "::Test::B"); test(ss2d1->ice_id() == "::Test::D1"); - test(ss2d3->ice_id() == "::Test::B"); + + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(ss1d3->ice_id() == "::Test::B"); + test(ss2d3->ice_id() == "::Test::B"); + } + else + { + test(ss1d3->ice_id() == "::Test::D3"); + test(ss2d3->ice_id() == "::Test::D3"); + } breakCycles(ss.c1); breakCycles(ss.c2); @@ -2066,11 +2148,20 @@ allTests(Test::TestHelper* helper) test(ss1b->ice_id() == "::Test::B"); test(ss1d1->ice_id() == "::Test::D1"); - test(ss1d3->ice_id() == "::Test::B"); test(ss2b->ice_id() == "::Test::B"); test(ss2d1->ice_id() == "::Test::D1"); - test(ss2d3->ice_id() == "::Test::B"); + + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(ss1d3->ice_id() == "::Test::B"); + test(ss2d3->ice_id() == "::Test::B"); + } + else + { + test(ss1d3->ice_id() == "::Test::D3"); + test(ss2d3->ice_id() == "::Test::D3"); + } breakCycles(ss.c1); breakCycles(ss.c2); @@ -2421,7 +2512,6 @@ allTests(Test::TestHelper* helper) cout << "preserved classes... " << flush; try { - // // Server knows the most-derived class PDerived. // PDerivedPtr pd = std::make_shared(); @@ -2445,15 +2535,24 @@ allTests(Test::TestHelper* helper) try { // - // Server only knows the base (non-preserved) type, so the object is sliced. + // Server only knows the base type. // PCUnknownPtr pu = std::make_shared(); pu->pi = 3; pu->pu = "preserved"; + PBasePtr r = testPrx->exchangePBase(pu); - PCUnknownPtr p2 = dynamic_pointer_cast(r); - test(!p2); test(r->pi == 3); + PCUnknownPtr p2 = dynamic_pointer_cast(r); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p2); + } + else + { + test(p2); + test(p2->pu == "preserved"); + } breakCycles(r); } @@ -2486,6 +2585,7 @@ allTests(Test::TestHelper* helper) breakCycles(r); breakCycles(pcd); + breakCycles(p2); } catch(const Ice::OperationNotExistException&) { @@ -2516,6 +2616,7 @@ allTests(Test::TestHelper* helper) breakCycles(r); breakCycles(pcd); + breakCycles(p2); } catch(const Ice::OperationNotExistException&) { @@ -2570,6 +2671,7 @@ allTests(Test::TestHelper* helper) breakCycles(r); breakCycles(pcd); + breakCycles(p3); } catch(const Ice::OperationNotExistException&) { @@ -2634,7 +2736,7 @@ allTests(Test::TestHelper* helper) { // - // Server only knows the base (non-preserved) type, so the object is sliced. + // Server only knows the base type. // PCUnknownPtr pu = std::make_shared(); pu->pi = 3; @@ -2642,10 +2744,19 @@ allTests(Test::TestHelper* helper) try { auto r = testPrx->exchangePBaseAsync(pu).get(); - auto p2 = dynamic_pointer_cast(r); - test(!p2); test(r->pi == 3); + auto p2 = dynamic_pointer_cast(r); + if(testPrx->ice_getEncodingVersion() == Ice::Encoding_1_0) + { + test(!p2); + } + else + { + test(p2); + test(p2->pu == "preserved"); + } + breakCycles(r); } catch(...) diff --git a/cpp/test/Ice/slicing/objects/ClientPrivate.ice b/cpp/test/Ice/slicing/objects/ClientPrivate.ice index cd5e1ec84ea..b2a3f882931 100644 --- a/cpp/test/Ice/slicing/objects/ClientPrivate.ice +++ b/cpp/test/Ice/slicing/objects/ClientPrivate.ice @@ -15,7 +15,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/cpp/test/Ice/slicing/objects/ServerPrivate.ice b/cpp/test/Ice/slicing/objects/ServerPrivate.ice index 10d11274b01..2bb1e6c4d3f 100644 --- a/cpp/test/Ice/slicing/objects/ServerPrivate.ice +++ b/cpp/test/Ice/slicing/objects/ServerPrivate.ice @@ -55,9 +55,4 @@ class PSUnknown2 extends Preserved PBase pb; } -exception PSUnknownException extends PreservedException -{ - PSUnknown2 p; -} - } diff --git a/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice b/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice index 9a3286c7d0d..6cf3077c106 100644 --- a/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice +++ b/cpp/test/Ice/slicing/objects/ServerPrivateAMD.ice @@ -55,9 +55,4 @@ class PSUnknown2 extends Preserved PBase pb; } -exception PSUnknownException extends PreservedException -{ - PSUnknown2 p; -} - } diff --git a/cpp/test/Ice/slicing/objects/Test.ice b/cpp/test/Ice/slicing/objects/Test.ice index b50a94d0c7a..f31217aa6d6 100644 --- a/cpp/test/Ice/slicing/objects/Test.ice +++ b/cpp/test/Ice/slicing/objects/Test.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -86,17 +85,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] -exception PreservedException -{ -} - ["format:sliced"] interface TestIntf { @@ -148,7 +141,6 @@ interface TestIntf void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - ["amd"] void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ diff --git a/cpp/test/Ice/slicing/objects/TestAMD.ice b/cpp/test/Ice/slicing/objects/TestAMD.ice index d961598b0d1..d12a57c18ff 100644 --- a/cpp/test/Ice/slicing/objects/TestAMD.ice +++ b/cpp/test/Ice/slicing/objects/TestAMD.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -81,17 +80,11 @@ class PDerived extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] -exception PreservedException -{ -} - ["amd", "format:sliced"] interface TestIntf { @@ -143,7 +136,6 @@ interface TestIntf void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ diff --git a/cpp/test/Ice/slicing/objects/TestAMDI.cpp b/cpp/test/Ice/slicing/objects/TestAMDI.cpp index dad20d2d9eb..ce086cc8d13 100644 --- a/cpp/test/Ice/slicing/objects/TestAMDI.cpp +++ b/cpp/test/Ice/slicing/objects/TestAMDI.cpp @@ -612,27 +612,6 @@ TestI::throwUnknownDerivedAsBaseAsync(function, } } -void -TestI::throwPreservedExceptionAsync(function, - function exception, - const ::Ice::Current&) -{ - try - { - PSUnknownException ue; - ue.p = make_shared(); - ue.p->pi = 5; - ue.p->ps = "preserved"; - ue.p->pb = ue.p; - ue.p->pb = nullptr; // Break the cycle. - throw ue; - } - catch(...) - { - exception(current_exception()); - } -} - void TestI::useForwardAsync(function&)> response, function, diff --git a/cpp/test/Ice/slicing/objects/TestAMDI.h b/cpp/test/Ice/slicing/objects/TestAMDI.h index c4d0cb6d573..6484526a53a 100644 --- a/cpp/test/Ice/slicing/objects/TestAMDI.h +++ b/cpp/test/Ice/slicing/objects/TestAMDI.h @@ -168,10 +168,6 @@ class TestI : public virtual ::Test::TestIntf std::function, const ::Ice::Current&); - virtual void throwPreservedExceptionAsync(std::function, - std::function, - const ::Ice::Current&); - virtual void useForwardAsync(std::function&)>, std::function, const ::Ice::Current&); diff --git a/cpp/test/Ice/slicing/objects/TestI.cpp b/cpp/test/Ice/slicing/objects/TestI.cpp index 4263ac4e2ae..9a738ea58b8 100644 --- a/cpp/test/Ice/slicing/objects/TestI.cpp +++ b/cpp/test/Ice/slicing/objects/TestI.cpp @@ -47,7 +47,12 @@ void breakCycles(Ice::ValuePtr o) if(dynamic_pointer_cast(o)) { auto d2 = dynamic_pointer_cast(o); + auto tmp = d2->pd2; d2->pd2 = nullptr; + if(tmp != d2) + { + breakCycles(tmp); + } } if(dynamic_pointer_cast(o)) { @@ -58,11 +63,16 @@ void breakCycles(Ice::ValuePtr o) if(dynamic_pointer_cast(o)) { auto b = dynamic_pointer_cast(o); - if(b->pb) + auto tmp = b->pb; + b->pb = nullptr; + if (tmp != b) { - b->pb->pb = nullptr; + breakCycles(tmp); + } + if(b->ice_getSlicedData()) + { + b->ice_getSlicedData()->clear(); } - b->pb = nullptr; } if(dynamic_pointer_cast(o)) { @@ -287,7 +297,8 @@ TestI::D2AsB(const ::Ice::Current&) d1->sd1 = "D1.sd1"; d1->pd1 = d2; d2->pb = d1; - d2->pd2 = d1; + // d2->pd2 = d1; + d2->pd2 = d2; _values.push_back(d1); return d2; } @@ -416,6 +427,7 @@ TestI::dictionaryTest(BDict bin, BDict& bout, const ::Ice::Current&) d2->pb = b->pb; d2->sd2 = "D2"; d2->pd2 = d2; + _values.push_back(b); _values.push_back(d2); bout[i * 10] = d2; } @@ -629,27 +641,6 @@ TestI::throwUnknownDerivedAsBase(const ::Ice::Current&) throw ude; } -void -TestI::throwPreservedExceptionAsync(function, - function exception, - const ::Ice::Current&) -{ - PSUnknownException ue; - ue.p = make_shared(); - ue.p->pi = 5; - ue.p->ps = "preserved"; - ue.p->pb = ue.p; - try - { - throw ue; - } - catch(...) - { - exception(current_exception()); - } - ue.p->pb = 0; // Break the cycle. -} - void TestI::useForward(ForwardPtr& f, const ::Ice::Current&) { diff --git a/cpp/test/Ice/slicing/objects/TestI.h b/cpp/test/Ice/slicing/objects/TestI.h index 8b62e0fa8d3..334b1125d70 100644 --- a/cpp/test/Ice/slicing/objects/TestI.h +++ b/cpp/test/Ice/slicing/objects/TestI.h @@ -67,9 +67,6 @@ class TestI : public virtual Test::TestIntf virtual void throwDerivedAsBase(const ::Ice::Current&); virtual void throwDerivedAsDerived(const ::Ice::Current&); virtual void throwUnknownDerivedAsBase(const ::Ice::Current&); - virtual void throwPreservedExceptionAsync(std::function, - std::function, - const ::Ice::Current&); virtual void useForward(::Test::ForwardPtr&, const ::Ice::Current&); diff --git a/cpp/test/IceGrid/session/AllTests.cpp b/cpp/test/IceGrid/session/AllTests.cpp index c8ce419fa30..1c0059f124a 100644 --- a/cpp/test/IceGrid/session/AllTests.cpp +++ b/cpp/test/IceGrid/session/AllTests.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include using namespace std; @@ -468,7 +467,6 @@ void allTests(TestHelper* helper) { auto communicator = helper->communicator(); - bool encoding10 = communicator->getProperties()->getProperty("Ice.Default.EncodingVersion") == "1.0"; RegistryPrx registry( communicator, @@ -803,13 +801,9 @@ allTests(TestHelper* helper) router->ice_connectionId("routerex")->createSession("client3", "test1", ctx); test(false); } - catch(const ExtendedPermissionDeniedException& ex) - { - test(!encoding10 && ex.reason == "reason"); - } catch(const Glacier2::PermissionDeniedException& ex) { - test(encoding10 && ex.reason == "reason"); + test(ex.reason == "reason"); } session1->ice_ping(); @@ -878,13 +872,9 @@ allTests(TestHelper* helper) adminRouter->ice_connectionId("routerex")->createSession("admin3", "test1", ctx); test(false); } - catch(const ExtendedPermissionDeniedException& ex) - { - test(!encoding10 && ex.reason == "reason"); - } catch(const Glacier2::PermissionDeniedException& ex) { - test(encoding10 && ex.reason == "reason"); + test(ex.reason == "reason"); } admSession1->ice_ping(); @@ -966,13 +956,9 @@ allTests(TestHelper* helper) router->ice_connectionId("routerex")->createSessionFromSecureConnection(ctx); test(false); } - catch(const ExtendedPermissionDeniedException& ex) - { - test(!encoding10 && ex.reason == "reason"); - } catch(const Glacier2::PermissionDeniedException& ex) { - test(encoding10 && ex.reason == "reason"); + test(ex.reason == "reason"); } try @@ -1037,13 +1023,9 @@ allTests(TestHelper* helper) adminRouter->ice_connectionId("routerex")->createSessionFromSecureConnection(ctx); test(false); } - catch(const ExtendedPermissionDeniedException& ex) - { - test(!encoding10 && ex.reason == "reason"); - } catch(const Glacier2::PermissionDeniedException& ex) { - test(encoding10 && ex.reason == "reason"); + test(ex.reason == "reason"); } auto admin1 = admSession1->getAdmin()->ice_router(adminRouter1)->ice_connectionId("admRouter11"); diff --git a/cpp/test/IceGrid/session/Makefile.mk b/cpp/test/IceGrid/session/Makefile.mk index 18d83be3380..a4c677e2046 100644 --- a/cpp/test/IceGrid/session/Makefile.mk +++ b/cpp/test/IceGrid/session/Makefile.mk @@ -8,7 +8,7 @@ $(test)_client_dependencies = IceGrid Glacier2 $(test)_server_dependencies = Glacier2 IceSSL -$(test)_verifier_sources = PermissionsVerifier.cpp Test.ice +$(test)_verifier_sources = PermissionsVerifier.cpp $(test)_verifier_dependencies = Glacier2 tests += $(test) diff --git a/cpp/test/IceGrid/session/PermissionsVerifier.cpp b/cpp/test/IceGrid/session/PermissionsVerifier.cpp index 8cd13583259..e5758b4c4c7 100644 --- a/cpp/test/IceGrid/session/PermissionsVerifier.cpp +++ b/cpp/test/IceGrid/session/PermissionsVerifier.cpp @@ -5,7 +5,6 @@ #include #include #include -#include #include using namespace std; @@ -19,7 +18,7 @@ class AdminPermissionsVerifierI final : public Glacier2::PermissionsVerifier { if(c.ctx.find("throw") != c.ctx.end()) { - throw Test::ExtendedPermissionDeniedException("reason"); + throw Glacier2::PermissionDeniedException("reason"); } return (userId == "admin1" && passwd == "test1") || (userId == "admin2" && passwd == "test2") || diff --git a/cpp/test/IceGrid/session/Server.cpp b/cpp/test/IceGrid/session/Server.cpp index a6c16354d9f..75b7f32b13b 100644 --- a/cpp/test/IceGrid/session/Server.cpp +++ b/cpp/test/IceGrid/session/Server.cpp @@ -6,7 +6,6 @@ #include #include #include -#include using namespace std; @@ -19,7 +18,7 @@ class ClientPermissionsVerifierI final : public Glacier2::PermissionsVerifier { if(current.ctx.find("throw") != current.ctx.end()) { - throw Test::ExtendedPermissionDeniedException("reason"); + throw Glacier2::PermissionDeniedException("reason"); } return (userId == "client1" && passwd == "test1") || (userId == "client2" && passwd == "test2"); } @@ -34,7 +33,7 @@ class SSLPermissionsVerifierI final : public Glacier2::SSLPermissionsVerifier { if(current.ctx.find("throw") != current.ctx.end()) { - throw Test::ExtendedPermissionDeniedException("reason"); + throw Glacier2::PermissionDeniedException("reason"); } test(info.certs.size() > 0); auto cert = IceSSL::Certificate::decode(info.certs[0]); diff --git a/cpp/test/IceGrid/session/Test.ice b/cpp/test/IceGrid/session/Test.ice deleted file mode 100644 index d33b175d978..00000000000 --- a/cpp/test/IceGrid/session/Test.ice +++ /dev/null @@ -1,16 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -module Test -{ - -exception ExtendedPermissionDeniedException extends Glacier2::PermissionDeniedException -{ -} - -} diff --git a/cpp/test/IceGrid/session/msbuild/client/client.vcxproj b/cpp/test/IceGrid/session/msbuild/client/client.vcxproj index 8b50c9352b5..19cb315672d 100644 --- a/cpp/test/IceGrid/session/msbuild/client/client.vcxproj +++ b/cpp/test/IceGrid/session/msbuild/client/client.vcxproj @@ -66,62 +66,9 @@ - - - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - diff --git a/cpp/test/IceGrid/session/msbuild/client/client.vcxproj.filters b/cpp/test/IceGrid/session/msbuild/client/client.vcxproj.filters index e34b06ba4a3..b50f1ef5d91 100644 --- a/cpp/test/IceGrid/session/msbuild/client/client.vcxproj.filters +++ b/cpp/test/IceGrid/session/msbuild/client/client.vcxproj.filters @@ -7,18 +7,6 @@ Source Files - - Source Files\x64\Debug - - - Source Files\Win32\Debug - - - Source Files\x64\Release - - - Source Files\Win32\Release - @@ -68,26 +56,7 @@ {04389040-0ed7-4155-b373-af0cea3cb329} - - - Header Files\x64\Debug - - - Header Files\Win32\Debug - - - Header Files\x64\Release - - - Header Files\Win32\Release - - - - - Slice Files - - \ No newline at end of file diff --git a/cpp/test/IceGrid/session/msbuild/server/server.vcxproj b/cpp/test/IceGrid/session/msbuild/server/server.vcxproj index b42414b6a55..fd8ad17f8a5 100644 --- a/cpp/test/IceGrid/session/msbuild/server/server.vcxproj +++ b/cpp/test/IceGrid/session/msbuild/server/server.vcxproj @@ -87,60 +87,7 @@ - - - - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - + diff --git a/cpp/test/IceGrid/session/msbuild/server/server.vcxproj.filters b/cpp/test/IceGrid/session/msbuild/server/server.vcxproj.filters index b0f4b723df6..488ab8cfe0f 100644 --- a/cpp/test/IceGrid/session/msbuild/server/server.vcxproj.filters +++ b/cpp/test/IceGrid/session/msbuild/server/server.vcxproj.filters @@ -4,18 +4,6 @@ Source Files - - Source Files\x64\Debug - - - Source Files\Win32\Debug - - - Source Files\x64\Release - - - Source Files\Win32\Release - @@ -65,26 +53,7 @@ {f3be1bed-c4b0-408f-a391-ba3b78080ca0} - - - Header Files\x64\Debug - - - Header Files\Win32\Debug - - - Header Files\x64\Release - - - Header Files\Win32\Release - - - - - Slice Files - - \ No newline at end of file diff --git a/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj b/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj index de67eb8ff6e..df507ce3a97 100644 --- a/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj +++ b/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj @@ -87,60 +87,7 @@ - - - - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - - - true - true - true - ..\..\Test.ice - + diff --git a/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj.filters b/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj.filters index 53542ddd14b..b7701f0216f 100644 --- a/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj.filters +++ b/cpp/test/IceGrid/session/msbuild/verifier/verifier.vcxproj.filters @@ -52,39 +52,8 @@ Source Files - - Source Files\x64\Debug - - - Source Files\Win32\Debug - - - Source Files\x64\Release - - - Source Files\Win32\Release - - - - - Header Files\x64\Debug - - - Header Files\Win32\Debug - - - Header Files\x64\Release - - - Header Files\Win32\Release - - - - Slice Files - - \ No newline at end of file diff --git a/csharp/src/Ice/Exception.cs b/csharp/src/Ice/Exception.cs index d5c2b05731f..393e664923b 100644 --- a/csharp/src/Ice/Exception.cs +++ b/csharp/src/Ice/Exception.cs @@ -179,19 +179,9 @@ public UserException() {} /// The inner exception. public UserException(System.Exception ex) : base(ex) {} - /// - /// Returns the sliced data if the exception has a preserved-slice base class and has been sliced during - /// un-marshaling, null is returned otherwise. - /// - /// The sliced data or null. - public virtual Ice.SlicedData ice_getSlicedData() - { - return null; - } - public virtual void iceWrite(OutputStream ostr) { - ostr.startException(null); + ostr.startException(); iceWriteImpl(ostr); ostr.endException(); } @@ -200,7 +190,7 @@ public virtual void iceRead(InputStream istr) { istr.startException(); iceReadImpl(istr); - istr.endException(false); + istr.endException(); } public virtual bool iceUsesClasses() diff --git a/csharp/src/Ice/InputStream.cs b/csharp/src/Ice/InputStream.cs index 8d8857fad82..711f92c2def 100644 --- a/csharp/src/Ice/InputStream.cs +++ b/csharp/src/Ice/InputStream.cs @@ -492,12 +492,11 @@ public void startValue() /// /// Marks the end of a class instance. /// - /// True if unknown slices should be preserved, false otherwise. /// A SlicedData object containing the preserved slices for unknown types. - public SlicedData endValue(bool preserve) + public SlicedData endValue() { Debug.Assert(_encapsStack != null && _encapsStack.decoder != null); - return _encapsStack.decoder.endInstance(preserve); + return _encapsStack.decoder.endInstance(); } /// @@ -512,12 +511,10 @@ public void startException() /// /// Marks the end of a user exception. /// - /// True if unknown slices should be preserved, false otherwise. - /// A SlicedData object containing the preserved slices for unknown types. - public SlicedData endException(bool preserve) + public void endException() { Debug.Assert(_encapsStack != null && _encapsStack.decoder != null); - return _encapsStack.decoder.endInstance(preserve); + _encapsStack.decoder.endInstance(); } /// @@ -2763,7 +2760,7 @@ internal EncapsDecoder(InputStream stream, Encaps encaps, bool sliceValues, internal abstract void throwException(UserExceptionFactory factory); internal abstract void startInstance(SliceType type); - internal abstract SlicedData endInstance(bool preserve); + internal abstract SlicedData endInstance(); internal abstract string startSlice(); internal abstract void endSlice(); internal abstract void skipSlice(); @@ -3154,7 +3151,7 @@ internal override void startInstance(SliceType sliceType) _skipFirstSlice = true; } - internal override SlicedData endInstance(bool preserve) + internal override SlicedData endInstance() { // // Read the Ice::Object slice. @@ -3480,16 +3477,15 @@ internal override void startInstance(SliceType sliceType) _current.skipFirstSlice = true; } - internal override SlicedData endInstance(bool preserve) + internal override SlicedData endInstance() { - SlicedData slicedData = null; - if(preserve) - { - slicedData = readSlicedData(); - } + SlicedData slicedData = readSlicedData(); if(_current.slices != null) { _current.slices.Clear(); + } + if(_current.indirectionTables != null) + { _current.indirectionTables.Clear(); } _current = _current.previous; @@ -3664,33 +3660,36 @@ internal override void skipSlice() } // - // Preserve this slice. + // Preserve this slice if unmarshalling a value in Slice format. Exception slices are not preserved. // - SliceInfo info = new SliceInfo(); - info.typeId = _current.typeId; - info.compactId = _current.compactId; - info.hasOptionalMembers = (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0; - info.isLastSlice = (_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0; - IceInternal.ByteBuffer b = _stream.getBuffer().b; - int end = b.position(); - int dataEnd = end; - if(info.hasOptionalMembers) + if (_current.sliceType == SliceType.ValueSlice) { - // - // Don't include the optional member end marker. It will be re-written by - // endSlice when the sliced data is re-written. - // - --dataEnd; - } - info.bytes = new byte[dataEnd - start]; - b.position(start); - b.get(info.bytes); - b.position(end); + SliceInfo info = new SliceInfo(); + info.typeId = _current.typeId; + info.compactId = _current.compactId; + info.hasOptionalMembers = (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0; + info.isLastSlice = (_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0; + IceInternal.ByteBuffer b = _stream.getBuffer().b; + int end = b.position(); + int dataEnd = end; + if(info.hasOptionalMembers) + { + // + // Don't include the optional member end marker. It will be re-written by + // endSlice when the sliced data is re-written. + // + --dataEnd; + } + info.bytes = new byte[dataEnd - start]; + b.position(start); + b.get(info.bytes); + b.position(end); - if(_current.slices == null) - { - _current.slices = new List(); - _current.indirectionTables = new List(); + if (_current.slices == null) + { + _current.slices = new List(); + } + _current.slices.Add(info); } // @@ -3698,7 +3697,13 @@ internal override void skipSlice() // IDs if the instance is a reference to an already unmarshaled // instance. // - if((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) + + if (_current.indirectionTables == null) + { + _current.indirectionTables = new List(); + } + + if ((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) { int[] indirectionTable = new int[_stream.readAndCheckSeqSize(1)]; for(int i = 0; i < indirectionTable.Length; ++i) @@ -3711,8 +3716,6 @@ internal override void skipSlice() { _current.indirectionTables.Add(null); } - - _current.slices.Add(info); } internal override bool readOptional(int readTag, OptionalFormat expectedFormat) diff --git a/csharp/src/Ice/OutputStream.cs b/csharp/src/Ice/OutputStream.cs index 7ba1bfac6a4..3584e1177e4 100644 --- a/csharp/src/Ice/OutputStream.cs +++ b/csharp/src/Ice/OutputStream.cs @@ -270,11 +270,10 @@ public void endValue() /// /// Marks the start of a user exception. /// - /// Preserved slices for this exception, or null. - public void startException(SlicedData data) + public void startException() { Debug.Assert(_encapsStack != null && _encapsStack.encoder != null); - _encapsStack.encoder.startInstance(SliceType.ExceptionSlice, data); + _encapsStack.encoder.startInstance(SliceType.ExceptionSlice, null); } /// @@ -2057,6 +2056,8 @@ public void writeValue(int tag, Value v) public void writeException(UserException v) { initEncaps(); + // Exceptions are always encoded with the sliced format. + _encapsStack.format = FormatType.SlicedFormat; _encapsStack.encoder.writeException(v); } diff --git a/csharp/src/Ice/UnknownSlicedValue.cs b/csharp/src/Ice/UnknownSlicedValue.cs index 3c0abbb867e..ea79776933d 100644 --- a/csharp/src/Ice/UnknownSlicedValue.cs +++ b/csharp/src/Ice/UnknownSlicedValue.cs @@ -18,16 +18,6 @@ public UnknownSlicedValue(string unknownTypeId) _unknownTypeId = unknownTypeId; } - /// - /// Returns the sliced data if the value has a preserved-slice base class and has been sliced during - /// un-marshaling of the value, null is returned otherwise. - /// - /// The sliced data or null. - public override SlicedData ice_getSlicedData() - { - return _slicedData; - } - /// /// Returns the Slice type ID associated with this object. /// @@ -37,19 +27,6 @@ public override string ice_id() return _unknownTypeId; } - public override void iceWrite(OutputStream ostr) - { - ostr.startValue(_slicedData); - ostr.endValue(); - } - - public override void iceRead(InputStream istr) - { - istr.startValue(); - _slicedData = istr.endValue(true); - } - private string _unknownTypeId; - private SlicedData _slicedData; } } diff --git a/csharp/src/Ice/Value.cs b/csharp/src/Ice/Value.cs index 8bd3b5afe6e..c91ae2590b1 100644 --- a/csharp/src/Ice/Value.cs +++ b/csharp/src/Ice/Value.cs @@ -50,15 +50,15 @@ public virtual void ice_postUnmarshal() /// un-marshaling of the value, null is returned otherwise. /// /// The sliced data or null. - public virtual SlicedData ice_getSlicedData() + public SlicedData ice_getSlicedData() { - return null; + return _slicedData; } [EditorBrowsable(EditorBrowsableState.Never)] public virtual void iceWrite(OutputStream ostr) { - ostr.startValue(null); + ostr.startValue(_slicedData); iceWriteImpl(ostr); ostr.endValue(); } @@ -68,7 +68,7 @@ public virtual void iceRead(InputStream istr) { istr.startValue(); iceReadImpl(istr); - istr.endValue(false); + _slicedData = istr.endValue(); } [EditorBrowsable(EditorBrowsableState.Never)] @@ -90,6 +90,8 @@ public object Clone() { return MemberwiseClone(); } + + private SlicedData _slicedData; } public class InterfaceByValue : Value diff --git a/csharp/test/Ice/metrics/AllTests.cs b/csharp/test/Ice/metrics/AllTests.cs index 5290678b4a7..cb2abdaed1e 100644 --- a/csharp/test/Ice/metrics/AllTests.cs +++ b/csharp/test/Ice/metrics/AllTests.cs @@ -949,7 +949,7 @@ public static async Task allTests(Test.TestHelper helper, Communicat dm1 = (IceMX.DispatchMetrics)map["opWithUserException"]; test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 0 && dm1.userException == 1); - test(dm1.size == 38 && dm1.replySize == 23); + test(dm1.size == 38 && dm1.replySize == 27); dm1 = (IceMX.DispatchMetrics)map["opWithLocalException"]; test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0); @@ -1130,7 +1130,7 @@ public static async Task allTests(Test.TestHelper helper, Communicat test(collocated ? im1.collocated.Length == 1 : im1.remotes.Length == 1); rim1 = (IceMX.ChildInvocationMetrics)(collocated ? im1.collocated[0] : im1.remotes[0]); test(rim1.current == 0 && rim1.total == 2 && rim1.failures == 0); - test(rim1.size == 76 && rim1.replySize == 46); + test(rim1.size == 76 && rim1.replySize == 54); test(im1.userException == 2); im1 = (IceMX.InvocationMetrics)map["opWithLocalException"]; diff --git a/csharp/test/Ice/optional/AllTests.cs b/csharp/test/Ice/optional/AllTests.cs index dbfd1ff6b8f..01ccf3318dd 100644 --- a/csharp/test/Ice/optional/AllTests.cs +++ b/csharp/test/Ice/optional/AllTests.cs @@ -2242,7 +2242,7 @@ public override void read(Ice.InputStream @in) @in.startValue(); @in.startSlice(); @in.endSlice(); - @in.endValue(false); + @in.endValue(); } } @@ -2259,7 +2259,7 @@ public override void read(Ice.InputStream @in) @in.startSlice(); @in.readInt(); @in.endSlice(); - @in.endValue(false); + @in.endValue(); } } @@ -2279,7 +2279,7 @@ public override void read(Ice.InputStream @in) @in.startSlice(); @in.readInt(); @in.endSlice(); - @in.endValue(false); + @in.endValue(); } } @@ -2340,7 +2340,7 @@ public override void read(Ice.InputStream @in) @in.startSlice(); @in.readInt(); @in.endSlice(); - @in.endValue(false); + @in.endValue(); } internal void check() @@ -2365,7 +2365,7 @@ public override void read(Ice.InputStream @in) ReadValueCallbackI rocb = new ReadValueCallbackI(); @in.readValue(rocb.invoke); @in.endSlice(); - @in.endValue(false); + @in.endValue(); _f.ae =(Test.A)rocb.obj; } diff --git a/csharp/test/Ice/optional/Test.ice b/csharp/test/Ice/optional/Test.ice index d642592f5fc..42537003a21 100644 --- a/csharp/test/Ice/optional/Test.ice +++ b/csharp/test/Ice/optional/Test.ice @@ -114,7 +114,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/csharp/test/Ice/optional/TestAMD.ice b/csharp/test/Ice/optional/TestAMD.ice index 4b503ef3e4c..031fd95e291 100644 --- a/csharp/test/Ice/optional/TestAMD.ice +++ b/csharp/test/Ice/optional/TestAMD.ice @@ -114,7 +114,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/csharp/test/Ice/slicing/exceptions/AllTests.cs b/csharp/test/Ice/slicing/exceptions/AllTests.cs index 4bae232dfa4..152f8bbf000 100644 --- a/csharp/test/Ice/slicing/exceptions/AllTests.cs +++ b/csharp/test/Ice/slicing/exceptions/AllTests.cs @@ -43,49 +43,6 @@ public virtual void called() private bool _called; } - private class RelayI : RelayDisp_ - { - public override void knownPreservedAsBase(Ice.Current current) - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - public override void knownPreservedAsKnownPreserved(Ice.Current current) - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - public override void unknownPreservedAsBase(Ice.Current current) - { - Preserved2 ex = new Preserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new PreservedClass("bc", "pc"); - ex.p2 = ex.p1; - throw ex; - } - - public override void unknownPreservedAsKnownPreserved(Ice.Current current) - { - Preserved2 ex = new Preserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new PreservedClass("bc", "pc"); - ex.p2 = ex.p1; - throw ex; - } - } - public static async Task allTests(Test.TestHelper helper, bool collocated) { Ice.Communicator communicator = helper.communicator(); @@ -595,200 +552,6 @@ public static async Task allTests(Test.TestHelper helper, bool coll } output.WriteLine("ok"); - output.Write("unknown most derived in compact format... "); - output.Flush(); - { - try - { - testPrx.unknownMostDerived2AsBaseCompact(); - test(false); - } - catch(Base) - { - // - // For the 1.0 encoding, the unknown exception is sliced to Base. - // - test(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)); - } - catch(Ice.UnknownUserException) - { - // - // A MarshalException is raised for the compact format because the - // most-derived type is unknown and the exception cannot be sliced. - // - test(!testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)); - } - catch(Ice.OperationNotExistException) - { - } - catch(Exception) - { - test(false); - } - } - output.WriteLine("ok"); - - output.Write("preserved exceptions... "); - output.Flush(); - { - try - { - testPrx.unknownPreservedAsBase(); - test(false); - } - catch(Base ex) - { - if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) - { - test(ex.ice_getSlicedData() == null); - } - else - { - Ice.SlicedData slicedData = ex.ice_getSlicedData(); - test(slicedData != null); - test(slicedData.slices.Length == 2); - test(slicedData.slices[1].typeId == "::Test::SPreserved1"); - test(slicedData.slices[0].typeId == "::Test::SPreserved2"); - } - } - - try - { - testPrx.unknownPreservedAsKnownPreserved(); - test(false); - } - catch(KnownPreserved ex) - { - test(ex.kp == "preserved"); - if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) - { - test(ex.ice_getSlicedData() == null); - } - else - { - Ice.SlicedData slicedData = ex.ice_getSlicedData(); - test(slicedData != null); - test(slicedData.slices.Length == 2); - test(slicedData.slices[1].typeId == "::Test::SPreserved1"); - test(slicedData.slices[0].typeId == "::Test::SPreserved2"); - } - } - - Ice.ObjectAdapter adapter = communicator.createObjectAdapter(""); - RelayPrx relay = RelayPrxHelper.uncheckedCast(adapter.addWithUUID(new RelayI())); - adapter.activate(); - testPrx.ice_getConnection().setAdapter(adapter); - - try - { - testPrx.relayKnownPreservedAsBase(relay); - test(false); - } - catch(KnownPreservedDerived ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(Ice.OperationNotExistException) - { - } - catch(Exception) - { - test(false); - } - - try - { - testPrx.relayKnownPreservedAsKnownPreserved(relay); - test(false); - } - catch(KnownPreservedDerived ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(Ice.OperationNotExistException) - { - } - catch(Exception) - { - test(false); - } - - try - { - testPrx.relayUnknownPreservedAsBase(relay); - test(false); - } - catch(Preserved2 ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - test(ex.p1.ice_id().Equals(PreservedClass.ice_staticId())); - PreservedClass pc = ex.p1 as PreservedClass; - test(pc.bc == "bc"); - test(pc.pc == "pc"); - test(ex.p2 == ex.p1); - } - catch(KnownPreservedDerived ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)); - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(Ice.OperationNotExistException) - { - } - catch(Exception) - { - test(false); - } - - try - { - testPrx.relayUnknownPreservedAsKnownPreserved(relay); - test(false); - } - catch(Preserved2 ex) - { - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - test(ex.p1.ice_id().Equals(PreservedClass.ice_staticId())); - PreservedClass pc = ex.p1 as PreservedClass; - test(pc.bc == "bc"); - test(pc.pc == "pc"); - test(ex.p2 == ex.p1); - } - catch(KnownPreservedDerived ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)); - test(ex.b == "base"); - test(ex.kp == "preserved"); - test(ex.kpd == "derived"); - } - catch(Ice.OperationNotExistException) - { - } - catch(Exception) - { - test(false); - } - - adapter.destroy(); - } - output.WriteLine("ok"); - return testPrx; } } diff --git a/csharp/test/Ice/slicing/exceptions/ClientPrivate.ice b/csharp/test/Ice/slicing/exceptions/ClientPrivate.ice deleted file mode 100644 index 552e9b14337..00000000000 --- a/csharp/test/Ice/slicing/exceptions/ClientPrivate.ice +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -module Test -{ - -class PreservedClass extends BaseClass -{ - string pc; -} - -exception Preserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception Preserved2 extends Preserved1 -{ - BaseClass p2; -} - -} diff --git a/csharp/test/Ice/slicing/exceptions/ServerPrivate.ice b/csharp/test/Ice/slicing/exceptions/ServerPrivate.ice index 843b57a6a0f..772989b9748 100644 --- a/csharp/test/Ice/slicing/exceptions/ServerPrivate.ice +++ b/csharp/test/Ice/slicing/exceptions/ServerPrivate.ice @@ -29,19 +29,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/csharp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice b/csharp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice index 1acbe0b6442..6492ad616cc 100644 --- a/csharp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice +++ b/csharp/test/Ice/slicing/exceptions/ServerPrivateAMD.ice @@ -29,19 +29,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/csharp/test/Ice/slicing/exceptions/Test.ice b/csharp/test/Ice/slicing/exceptions/Test.ice index a16c2319ea7..92cd9ecf6a6 100644 --- a/csharp/test/Ice/slicing/exceptions/Test.ice +++ b/csharp/test/Ice/slicing/exceptions/Test.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/csharp/test/Ice/slicing/exceptions/TestAMD.ice b/csharp/test/Ice/slicing/exceptions/TestAMD.ice index 1fb00655b11..d4629f3ff4f 100644 --- a/csharp/test/Ice/slicing/exceptions/TestAMD.ice +++ b/csharp/test/Ice/slicing/exceptions/TestAMD.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["amd", "format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/csharp/test/Ice/slicing/exceptions/TestAMDI.cs b/csharp/test/Ice/slicing/exceptions/TestAMDI.cs index 318d21efd4e..2b9e6506f6d 100644 --- a/csharp/test/Ice/slicing/exceptions/TestAMDI.cs +++ b/csharp/test/Ice/slicing/exceptions/TestAMDI.cs @@ -8,14 +8,6 @@ public sealed class TestI : TestIntfDisp_ { - private static void test(bool b) - { - if(!b) - { - throw new System.Exception(); - } - } - public override Task shutdownAsync(Ice.Current current) { current.adapter.getCommunicator().shutdown(); @@ -96,80 +88,4 @@ public override Task { throw new UnknownMostDerived2("UnknownMostDerived2.b", "UnknownMostDerived2.ui", "UnknownMostDerived2.umd2"); } - - public override Task - unknownMostDerived2AsBaseCompactAsync(Ice.Current current) - { - throw new UnknownMostDerived2("UnknownMostDerived2.b", "UnknownMostDerived2.ui", "UnknownMostDerived2.umd2"); - } - - public override Task knownPreservedAsBaseAsync(Ice.Current current) - { - throw new KnownPreservedDerived("base", "preserved", "derived"); - } - - public override Task - knownPreservedAsKnownPreservedAsync(Ice.Current current) - { - throw new KnownPreservedDerived("base", "preserved", "derived"); - } - - public override Task - relayKnownPreservedAsBaseAsync(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsBase(); - test(false); - return null; - } - - public override Task - relayKnownPreservedAsKnownPreservedAsync(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsKnownPreserved(); - test(false); - return null; - } - - public override Task unknownPreservedAsBaseAsync(Ice.Current current) - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - - public override Task - unknownPreservedAsKnownPreservedAsync(Ice.Current current) - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - - public override Task - relayUnknownPreservedAsBaseAsync(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsBase(); - test(false); - return null; - } - - public override Task - relayUnknownPreservedAsKnownPreservedAsync(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsKnownPreserved(); - test(false); - return null; - } } diff --git a/csharp/test/Ice/slicing/exceptions/TestI.cs b/csharp/test/Ice/slicing/exceptions/TestI.cs index 0dbce10d66b..df6e622f776 100644 --- a/csharp/test/Ice/slicing/exceptions/TestI.cs +++ b/csharp/test/Ice/slicing/exceptions/TestI.cs @@ -6,14 +6,6 @@ public sealed class TestI : TestIntfDisp_ { - private static void test(bool b) - { - if(!b) - { - throw new System.Exception(); - } - } - public override void shutdown(Ice.Current current) { current.adapter.getCommunicator().shutdown(); @@ -127,81 +119,4 @@ public override void unknownMostDerived2AsBase(Ice.Current current) umd2.umd2 = "UnknownMostDerived2.umd2"; throw umd2; } - - public override void unknownMostDerived2AsBaseCompact(Ice.Current current) - { - UnknownMostDerived2 umd2 = new UnknownMostDerived2(); - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - throw umd2; - } - - public override void knownPreservedAsBase(Ice.Current current) - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - public override void knownPreservedAsKnownPreserved(Ice.Current current) - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - public override void relayKnownPreservedAsBase(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsBase(); - test(false); - } - - public override void relayKnownPreservedAsKnownPreserved(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsKnownPreserved(); - test(false); - } - - public override void unknownPreservedAsBase(Ice.Current current) - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - - public override void unknownPreservedAsKnownPreserved(Ice.Current current) - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - - public override void relayUnknownPreservedAsBase(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsBase(); - test(false); - } - - public override void relayUnknownPreservedAsKnownPreserved(RelayPrx r, Ice.Current current) - { - RelayPrx p = RelayPrxHelper.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsKnownPreserved(); - test(false); - } } diff --git a/csharp/test/Ice/slicing/exceptions/msbuild/client/client.csproj b/csharp/test/Ice/slicing/exceptions/msbuild/client/client.csproj index 22eeb2489f7..c745271cc86 100644 --- a/csharp/test/Ice/slicing/exceptions/msbuild/client/client.csproj +++ b/csharp/test/Ice/slicing/exceptions/msbuild/client/client.csproj @@ -18,15 +18,11 @@ - - ../../ClientPrivate.ice - ../../Test.ice - diff --git a/csharp/test/Ice/slicing/objects/AllTests.cs b/csharp/test/Ice/slicing/objects/AllTests.cs index 067c68695bd..a2e0dc7cd77 100644 --- a/csharp/test/Ice/slicing/objects/AllTests.cs +++ b/csharp/test/Ice/slicing/objects/AllTests.cs @@ -771,16 +771,18 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) B b2 = b1.pb; test(b2 != null); test(b2.sb == "D3.sb"); - test(b2.ice_id() == "::Test::B"); // Sliced by server test(b2.pb == b1); - try + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) { - D3 p3 = (D3) b2; - test(false); - D3 tmp = p3; p3 = tmp; // Stop compiler warning about unused variable. + test(!(b2 is D3)); } - catch(InvalidCastException) + else { + test(b2 is D3); + D3 p3 = (D3)b2; + test(p3.pd3 == p1); + test(p3.sd3 == "D3.sd3"); } test(b1 != d1); @@ -823,17 +825,18 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) B b2 = b1.pb; test(b2 != null); test(b2.sb == "D3.sb"); - test(b2.ice_id() == "::Test::B"); // Sliced by server test(b2.pb == b1); - try + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) { - D3 p3 = (D3)b2; - test(false); - D3 tmp = p3; - p3 = tmp; // Stop compiler warning about unused variable. + test(!(b2 is D3)); } - catch(InvalidCastException) + else { + test(b2 is D3); + D3 p3 = (D3)b2; + test(p3.pd3 == p1); + test(p3.sd3 == "D3.sd3"); } test(b1 != d1); @@ -863,17 +866,6 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) test(b1 != null); test(b1.sb == "D3.sb"); - test(b1.ice_id() == "::Test::B"); // Sliced by server - - try - { - D3 p1 = (D3) b1; - test(false); - D3 tmp = p1; p1 = tmp; // Stop compiler warning about unused variable. - } - catch(InvalidCastException) - { - } B b2 = b1.pb; test(b2 != null); @@ -885,6 +877,18 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) test(p3.sd1 == "D1.sd1"); test(p3.pd1 == b1); + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(!(b1 is D3)); + } + else + { + test(b1 is D3); + D3 p1 = (D3)b1; + test(p1.sd3 == "D3.sd3"); + test(p1.pd3 == b2); + } + test(b1 != d1); test(b1 != d3); test(b2 != d1); @@ -916,18 +920,6 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) test(b1 != null); test(b1.sb == "D3.sb"); - test(b1.ice_id() == "::Test::B"); // Sliced by server - - try - { - D3 p1 = (D3)b1; - test(false); - D3 tmp = p1; - p1 = tmp; // Stop compiler warning about unused variable. - } - catch(InvalidCastException) - { - } B b2 = b1.pb; test(b2 != null); @@ -939,6 +931,18 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) test(p3.sd1 == "D1.sd1"); test(p3.pd1 == b1); + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(!(b1 is D3)); + } + else + { + test(b1 is D3); + D3 p1 = (D3)b1; + test(p1.sd3 == "D3.sd3"); + test(p1.pd3 == b2); + } + test(b1 != d1); test(b1 != d3); test(b2 != d1); @@ -1070,9 +1074,22 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) B ret = testPrx.returnTest3(d3, b2); test(ret != null); - test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); test(ret.pb == ret); + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(!(ret is D3)); + } + else + { + test(ret is D3); + D3 p3 = (D3)ret; + test(p3.sd3 == "D3.sd3"); + test(p3.pd3.ice_id() == "::Test::B"); + test(p3.pd3.sb == "B.sb(1)"); + test(p3.pd3.pb == p3.pd3); + } } catch(Exception ex) { @@ -1102,9 +1119,22 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) B rv = testPrx.returnTest3Async(d3, b2).Result; test(rv != null); - test(rv.ice_id() == "::Test::B"); test(rv.sb == "D3.sb"); test(rv.pb == rv); + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(!(rv is D3)); + } + else + { + test(rv is D3); + D3 p3 = (D3)rv; + test(p3.sd3 == "D3.sd3"); + test(p3.pd3.ice_id() == "::Test::B"); + test(p3.pd3.sb == "B.sb(1)"); + test(p3.pd3.pb == p3.pd3); + } } output.WriteLine("ok"); @@ -1132,7 +1162,6 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) B ret = testPrx.returnTest3(d3, d12); test(ret != null); - test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); test(ret.pb == ret); } @@ -1167,7 +1196,6 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) B rv = testPrx.returnTest3Async(d3, d12).Result; test(rv != null); - test(rv.ice_id() == "::Test::B"); test(rv.sb == "D3.sb"); test(rv.pb == rv); } @@ -1250,11 +1278,20 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) test(ss1b2.ice_id() == "::Test::B"); test(ss1d2.ice_id() == "::Test::D1"); - test(ss1d4.ice_id() == "::Test::B"); test(ss2b2.ice_id() == "::Test::B"); test(ss2d2.ice_id() == "::Test::D1"); - test(ss2d4.ice_id() == "::Test::B"); + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(ss1d4.ice_id() == "::Test::B"); + test(ss2d4.ice_id() == "::Test::B"); + } + else + { + test(ss1d4.ice_id() == "::Test::D3"); + test(ss2d4.ice_id() == "::Test::D3"); + } } catch(Exception ex) { @@ -1338,12 +1375,22 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) test(ss1b3.ice_id() == "::Test::B"); test(ss1d5.ice_id() == "::Test::D1"); - test(ss1d6.ice_id() == "::Test::B"); test(ss2b3.ice_id() == "::Test::B"); test(ss2d5.ice_id() == "::Test::D1"); - test(ss2d6.ice_id() == "::Test::B"); + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(ss1d6.ice_id() == "::Test::B"); + test(ss2d6.ice_id() == "::Test::B"); + } + else + { + test(ss1d6.ice_id() == "::Test::D3"); + test(ss2d6.ice_id() == "::Test::D3"); + } } + output.WriteLine("ok"); output.Write("dictionary slicing... "); @@ -1743,8 +1790,20 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) pu.pu = "preserved"; PBase r = testPrx.exchangePBase(pu); - test(!(r is PCUnknown)); + test(r.pi == 3); + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(!(r is PCUnknown)); + } + else + { + test(r is PCUnknown); + PCUnknown p2 = (PCUnknown)r; + test(p2 != null); + test(p2.pu == "preserved"); + } } catch(Ice.OperationNotExistException) { @@ -1909,8 +1968,20 @@ public static TestIntfPrx allTests(Test.TestHelper helper, bool collocated) pu.pu = "preserved"; PBase r = testPrx.exchangePBaseAsync(pu).Result; - test(!(r is PCUnknown)); + test(r.pi == 3); + + if(testPrx.ice_getEncodingVersion().Equals(Ice.Util.Encoding_1_0)) + { + test(!(r is PCUnknown)); + } + else + { + test(r is PCUnknown); + PCUnknown p2 = (PCUnknown)r; + test(p2 != null); + test(p2.pu == "preserved"); + } } { diff --git a/csharp/test/Ice/slicing/objects/ClientPrivate.ice b/csharp/test/Ice/slicing/objects/ClientPrivate.ice index cd5e1ec84ea..b2a3f882931 100644 --- a/csharp/test/Ice/slicing/objects/ClientPrivate.ice +++ b/csharp/test/Ice/slicing/objects/ClientPrivate.ice @@ -15,7 +15,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/csharp/test/Ice/slicing/objects/Test.ice b/csharp/test/Ice/slicing/objects/Test.ice index b50a94d0c7a..f9efdaea22c 100644 --- a/csharp/test/Ice/slicing/objects/Test.ice +++ b/csharp/test/Ice/slicing/objects/Test.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -86,13 +85,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } diff --git a/csharp/test/Ice/slicing/objects/TestAMD.ice b/csharp/test/Ice/slicing/objects/TestAMD.ice index d961598b0d1..e552c5a11f4 100644 --- a/csharp/test/Ice/slicing/objects/TestAMD.ice +++ b/csharp/test/Ice/slicing/objects/TestAMD.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -81,13 +80,11 @@ class PDerived extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java index 6e94cd2063b..f890f60b4b9 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/InputStream.java @@ -509,14 +509,12 @@ public void startValue() /** * Marks the end of a class instance. * - * @param preserve Pass true and the stream will preserve the unknown slices of the instance, or false - * to discard the unknown slices. * @return An object that encapsulates the unknown slice data. **/ - public SlicedData endValue(boolean preserve) + public SlicedData endValue() { assert(_encapsStack != null && _encapsStack.decoder != null); - return _encapsStack.decoder.endInstance(preserve); + return _encapsStack.decoder.endInstance(); } /** @@ -531,14 +529,12 @@ public void startException() /** * Marks the end of a user exception. * - * @param preserve Pass true and the stream will preserve the unknown slices of the exception, or false - * to discard the unknown slices. * @return An object that encapsulates the unknown slice data. **/ - public SlicedData endException(boolean preserve) + public SlicedData endException() { assert(_encapsStack != null && _encapsStack.decoder != null); - return _encapsStack.decoder.endInstance(preserve); + return _encapsStack.decoder.endInstance(); } /** @@ -2268,7 +2264,7 @@ abstract void throwException(UserExceptionFactory factory) throws UserException; abstract void startInstance(SliceType type); - abstract SlicedData endInstance(boolean preserve); + abstract SlicedData endInstance(); abstract String startSlice(); abstract void endSlice(); abstract void skipSlice(); @@ -2660,7 +2656,7 @@ void startInstance(SliceType sliceType) } @Override - SlicedData endInstance(boolean preserve) + SlicedData endInstance() { // // Read the Ice::Object slice. @@ -2958,16 +2954,15 @@ void startInstance(SliceType sliceType) } @Override - SlicedData endInstance(boolean preserve) + SlicedData endInstance() { - SlicedData slicedData = null; - if(preserve) - { - slicedData = readSlicedData(); - } + SlicedData slicedData = readSlicedData(); if(_current.slices != null) { _current.slices.clear(); + } + if (_current.indirectionTables != null) + { _current.indirectionTables.clear(); } _current = _current.previous; @@ -3134,44 +3129,48 @@ void skipSlice() } // - // Preserve this slice. + // Preserve this slice if unmarshalling a value in Slice format. Exception slices are not preserved. // - SliceInfo info = new SliceInfo(); - info.typeId = _current.typeId; - info.compactId = _current.compactId; - info.hasOptionalMembers = (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0; - info.isLastSlice = (_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0; - Buffer buffer = _stream.getBuffer(); - final int end = buffer.b.position(); - int dataEnd = end; - if(info.hasOptionalMembers) + if (_current.sliceType == SliceType.ValueSlice) { - // - // Don't include the optional member end marker. It will be re-written by - // endSlice when the sliced data is re-written. - // - --dataEnd; + SliceInfo info = new SliceInfo(); + info.typeId = _current.typeId; + info.compactId = _current.compactId; + info.hasOptionalMembers = (_current.sliceFlags & Protocol.FLAG_HAS_OPTIONAL_MEMBERS) != 0; + info.isLastSlice = (_current.sliceFlags & Protocol.FLAG_IS_LAST_SLICE) != 0; + Buffer buffer = _stream.getBuffer(); + final int end = buffer.b.position(); + int dataEnd = end; + if(info.hasOptionalMembers) + { + // + // Don't include the optional member end marker. It will be re-written by + // endSlice when the sliced data is re-written. + // + --dataEnd; + } + info.bytes = new byte[dataEnd - start]; + buffer.position(start); + buffer.b.get(info.bytes); + buffer.position(end); + + if(_current.slices == null) // Lazy initialization + { + _current.slices = new java.util.ArrayList<>(); + } + _current.slices.add(info); } - info.bytes = new byte[dataEnd - start]; - buffer.position(start); - buffer.b.get(info.bytes); - buffer.position(end); - if(_current.slices == null) // Lazy initialization + if(_current.indirectionTables == null) // Lazy initialization { - _current.slices = new java.util.ArrayList<>(); _current.indirectionTables = new java.util.ArrayList<>(); } // // Read the indirect instance table. We read the instances or their - // IDs if the instance is a reference to an already unmarhsaled + // IDs if the instance is a reference to an already unmarshaled // instance. // - // The SliceInfo object sequence is initialized only if - // readSlicedData is called. - // - if((_current.sliceFlags & Protocol.FLAG_HAS_INDIRECTION_TABLE) != 0) { int[] indirectionTable = new int[_stream.readAndCheckSeqSize(1)]; @@ -3185,8 +3184,6 @@ void skipSlice() { _current.indirectionTables.add(null); } - - _current.slices.add(info); } @Override diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java index 12092ad9a45..bc3ca35f821 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Object.java @@ -210,7 +210,7 @@ default void _iceRead(InputStream istr) { istr.startValue(); _iceReadImpl(istr); - istr.endValue(false); + istr.endValue(); } /** diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java index 636f65452e9..adfddf3b6ee 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/OutputStream.java @@ -320,12 +320,11 @@ public void endValue() /** * Marks the start of a user exception. * - * @param data Preserved slices for this exception, or null. **/ - public void startException(SlicedData data) + public void startException() { assert(_encapsStack != null && _encapsStack.encoder != null); - _encapsStack.encoder.startInstance(SliceType.ExceptionSlice, data); + _encapsStack.encoder.startInstance(SliceType.ExceptionSlice, null); } /** @@ -1721,6 +1720,8 @@ public void writeValue(int tag, Value v) public void writeException(UserException v) { initEncaps(); + // Exceptions are always encoded with the sliced format. + _encapsStack.format = FormatType.SlicedFormat; _encapsStack.encoder.writeException(v); } diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java index ef318ffb476..432dc4c4f2e 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UnknownSlicedValue.java @@ -19,18 +19,6 @@ public UnknownSlicedValue(String unknownTypeId) _unknownTypeId = unknownTypeId; } - /** - * Returns the sliced data if the value has a preserved-slice base class and has been sliced during - * un-marshaling of the value, null is returned otherwise. - * - * @return The sliced data or null. - **/ - @Override - public SlicedData ice_getSlicedData() - { - return _slicedData; - } - /** * Determine the Slice type ID associated with this object. * @@ -42,24 +30,7 @@ public String ice_id() return _unknownTypeId; } - /** @hidden */ - @Override - public void _iceWrite(OutputStream ostr) - { - ostr.startValue(_slicedData); - ostr.endValue(); - } - - /** @hidden */ - @Override - public void _iceRead(InputStream istr) - { - istr.startValue(); - _slicedData = istr.endValue(true); - } - private final String _unknownTypeId; - private SlicedData _slicedData; /** @hidden */ public static final long serialVersionUID = 0L; diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java b/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java index 6f69207b448..8062a4316d6 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/UserException.java @@ -59,17 +59,6 @@ public String ice_name() **/ public abstract String ice_id(); - /** - * Returns the sliced data if the exception has a preserved-slice base class and has been sliced during - * un-marshaling, null is returned otherwise. - * - * @return The sliced data or null. - **/ - public com.zeroc.Ice.SlicedData ice_getSlicedData() - { - return null; - } - /** * Returns a string representation of this exception. * @@ -95,7 +84,7 @@ public String toString() **/ public void _write(OutputStream os) { - os.startException(null); + os.startException(); _writeImpl(os); os.endException(); } @@ -108,7 +97,7 @@ public void _read(InputStream is) { is.startException(); _readImpl(is); - is.endException(false); + is.endException(); } /** diff --git a/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java b/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java index 6662a16a9d2..1f66f4ec28d 100644 --- a/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java +++ b/java/src/Ice/src/main/java/com/zeroc/Ice/Value.java @@ -65,7 +65,7 @@ public String ice_id() **/ public SlicedData ice_getSlicedData() { - return null; + return _slicedData; } public static String ice_staticId() @@ -79,7 +79,7 @@ public static String ice_staticId() **/ public void _iceWrite(OutputStream ostr) { - ostr.startValue(null); + ostr.startValue(_slicedData); _iceWriteImpl(ostr); ostr.endValue(); } @@ -92,7 +92,7 @@ public void _iceRead(InputStream istr) { istr.startValue(); _iceReadImpl(istr); - istr.endValue(false); + _slicedData = istr.endValue(); } /** @@ -113,4 +113,6 @@ protected void _iceReadImpl(InputStream istr) /** @hidden */ public static final long serialVersionUID = 0L; + + private SlicedData _slicedData; } diff --git a/java/test/src/main/java/test/Ice/metrics/AllTests.java b/java/test/src/main/java/test/Ice/metrics/AllTests.java index 139284d17c9..8aa59266cb5 100644 --- a/java/test/src/main/java/test/Ice/metrics/AllTests.java +++ b/java/test/src/main/java/test/Ice/metrics/AllTests.java @@ -850,7 +850,7 @@ static MetricsPrx allTests(test.TestHelper helper, CommunicatorObserverI obsv) dm1 = (DispatchMetrics)map.get("opWithUserException"); test(dm1.current <= 1 &dm1.total == 1 && dm1.failures == 0 && dm1.userException == 1); - test(dm1.size == 38 && dm1.replySize == 23); + test(dm1.size == 38 && dm1.replySize == 27); dm1 = (DispatchMetrics)map.get("opWithLocalException"); test(dm1.current <= 1 && dm1.total == 1 && dm1.failures == 1 && dm1.userException == 0); @@ -1080,7 +1080,7 @@ static MetricsPrx allTests(test.TestHelper helper, CommunicatorObserverI obsv) test(collocated ? im1.collocated.length == 1 : im1.remotes.length == 1); rim1 = (ChildInvocationMetrics)(collocated ? im1.collocated[0] : im1.remotes[0]); test(rim1.current == 0 && rim1.total == 3 && rim1.failures == 0); - test(rim1.size == 114 && rim1.replySize == 69); + test(rim1.size == 114 && rim1.replySize == 81); test(im1.userException == 3); im1 = (InvocationMetrics)map.get("opWithLocalException"); 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 cc68534446d..d64c2d490ea 100644 --- a/java/test/src/main/java/test/Ice/optional/AllTests.java +++ b/java/test/src/main/java/test/Ice/optional/AllTests.java @@ -2226,7 +2226,7 @@ public void read(InputStream in) in.startValue(); in.startSlice(); in.endSlice(); - in.endValue(false); + in.endValue(); } } @@ -2244,7 +2244,7 @@ public void read(InputStream in) in.startSlice(); in.readInt(); in.endSlice(); - in.endValue(false); + in.endValue(); } } @@ -2265,7 +2265,7 @@ public void read(InputStream in) in.startSlice(); in.readInt(); in.endSlice(); - in.endValue(false); + in.endValue(); } } @@ -2324,7 +2324,7 @@ public void read(InputStream in) in.startSlice(); in.readInt(); in.endSlice(); - in.endValue(false); + in.endValue(); } void check() @@ -2349,7 +2349,7 @@ public void read(InputStream in) in.startSlice(); in.readValue(v -> _f.ae = v, A.class); in.endSlice(); - in.endValue(false); + in.endValue(); } F getF() 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 b2d891234fd..b43b3bbdc5b 100644 --- a/java/test/src/main/java/test/Ice/optional/Test.ice +++ b/java/test/src/main/java/test/Ice/optional/Test.ice @@ -116,7 +116,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; 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 b30e4db9874..715d8031b22 100644 --- a/java/test/src/main/java/test/Ice/optional/TestAMD.ice +++ b/java/test/src/main/java/test/Ice/optional/TestAMD.ice @@ -116,7 +116,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java index ba0586ad580..2187cafea0b 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AMDTestI.java @@ -11,14 +11,6 @@ public final class AMDTestI implements TestIntf { - private static void test(boolean b) - { - if(!b) - { - throw new RuntimeException(); - } - } - @Override public CompletionStage shutdownAsync(com.zeroc.Ice.Current current) { @@ -187,164 +179,4 @@ public CompletionStage unknownMostDerived2AsBaseAsync(com.zeroc.Ice.Curren f.completeExceptionally(umd2); return f; } - - @Override - public CompletionStage unknownMostDerived2AsBaseCompactAsync(com.zeroc.Ice.Current current) - { - UnknownMostDerived2 umd2 = new UnknownMostDerived2(); - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(umd2); - return f; - } - - @Override - public CompletionStage knownPreservedAsBaseAsync(com.zeroc.Ice.Current current) - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - - @Override - public CompletionStage knownPreservedAsKnownPreservedAsync(com.zeroc.Ice.Current current) - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - - @Override - public CompletionStage relayKnownPreservedAsBaseAsync(RelayPrx r, com.zeroc.Ice.Current current) - { - try - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsBase(); - test(false); - return null; - } - catch(com.zeroc.Ice.UserException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - catch(com.zeroc.Ice.LocalException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - } - - @Override - public CompletionStage relayKnownPreservedAsKnownPreservedAsync(RelayPrx r, com.zeroc.Ice.Current current) - { - try - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsKnownPreserved(); - test(false); - return null; - } - catch(com.zeroc.Ice.UserException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - catch(com.zeroc.Ice.LocalException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - } - - @Override - public CompletionStage unknownPreservedAsBaseAsync(com.zeroc.Ice.Current current) - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - - @Override - public CompletionStage unknownPreservedAsKnownPreservedAsync(com.zeroc.Ice.Current current) - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - - @Override - public CompletionStage relayUnknownPreservedAsBaseAsync(RelayPrx r, com.zeroc.Ice.Current current) - { - try - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsBase(); - test(false); - return null; - } - catch(com.zeroc.Ice.UserException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - catch(com.zeroc.Ice.LocalException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - } - - @Override - public CompletionStage relayUnknownPreservedAsKnownPreservedAsync(RelayPrx r, com.zeroc.Ice.Current current) - { - try - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsKnownPreserved(); - test(false); - return null; - } - catch(com.zeroc.Ice.UserException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - catch(com.zeroc.Ice.LocalException ex) - { - CompletableFuture f = new CompletableFuture<>(); - f.completeExceptionally(ex); - return f; - } - } } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java index 8827e95c896..438fc98713e 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/AllTests.java @@ -49,57 +49,6 @@ public synchronized void called() private boolean _called; } - private static class RelayI implements Relay - { - @Override - public void knownPreservedAsBase(com.zeroc.Ice.Current current) - throws Base - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - @Override - public void knownPreservedAsKnownPreserved(com.zeroc.Ice.Current current) - throws KnownPreserved - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - @Override - public void unknownPreservedAsBase(com.zeroc.Ice.Current current) - throws Base - { - Preserved2 ex = new Preserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new PreservedClass("bc", "pc"); - ex.p2 = ex.p1; - throw ex; - } - - @Override - public void unknownPreservedAsKnownPreserved(com.zeroc.Ice.Current current) - throws KnownPreserved - { - Preserved2 ex = new Preserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new PreservedClass("bc", "pc"); - ex.p2 = ex.p1; - throw ex; - } - } - public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) { java.io.PrintWriter out = helper.getWriter(); @@ -611,200 +560,6 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) } out.println("ok"); - out.print("unknown most derived in compact format... "); - out.flush(); - { - try - { - test.unknownMostDerived2AsBaseCompact(); - test(false); - } - catch(Base ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to Base. - // - test(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0)); - } - catch(com.zeroc.Ice.UnknownUserException ex) - { - // - // An UnknownUserException is raised for the compact format because the - // most-derived type is unknown and the exception cannot be sliced. - // - test(!test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0)); - } - catch(com.zeroc.Ice.OperationNotExistException ex) - { - } - catch(Exception ex) - { - test(false); - } - } - out.println("ok"); - - out.print("preserved exceptions... "); - out.flush(); - { - try - { - test.unknownPreservedAsBase(); - test(false); - } - catch(Base ex) - { - if(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0)) - { - test(ex.ice_getSlicedData() == null); - } - else - { - com.zeroc.Ice.SlicedData slicedData = ex.ice_getSlicedData(); - test(slicedData != null); - test(slicedData.slices.length == 2); - test(slicedData.slices[1].typeId.equals("::Test::SPreserved1")); - test(slicedData.slices[0].typeId.equals("::Test::SPreserved2")); - } - } - - try - { - test.unknownPreservedAsKnownPreserved(); - test(false); - } - catch(KnownPreserved ex) - { - test(ex.kp.equals("preserved")); - if(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0)) - { - test(ex.ice_getSlicedData() == null); - } - else - { - com.zeroc.Ice.SlicedData slicedData = ex.ice_getSlicedData(); - test(slicedData != null); - test(slicedData.slices.length == 2); - test(slicedData.slices[1].typeId.equals("::Test::SPreserved1")); - test(slicedData.slices[0].typeId.equals("::Test::SPreserved2")); - } - } - - com.zeroc.Ice.ObjectAdapter adapter = communicator.createObjectAdapter(""); - RelayPrx relay = RelayPrx.uncheckedCast(adapter.addWithUUID(new RelayI())); - adapter.activate(); - test.ice_getConnection().setAdapter(adapter); - - try - { - test.relayKnownPreservedAsBase(relay); - test(false); - } - catch(KnownPreservedDerived ex) - { - test(ex.b.equals("base")); - test(ex.kp.equals("preserved")); - test(ex.kpd.equals("derived")); - } - catch(com.zeroc.Ice.OperationNotExistException ex) - { - } - catch(Exception ex) - { - test(false); - } - - try - { - test.relayKnownPreservedAsKnownPreserved(relay); - test(false); - } - catch(KnownPreservedDerived ex) - { - test(ex.b.equals("base")); - test(ex.kp.equals("preserved")); - test(ex.kpd.equals("derived")); - } - catch(com.zeroc.Ice.OperationNotExistException ex) - { - } - catch(Exception ex) - { - test(false); - } - - try - { - test.relayUnknownPreservedAsBase(relay); - test(false); - } - catch(Preserved2 ex) - { - test(ex.b.equals("base")); - test(ex.kp.equals("preserved")); - test(ex.kpd.equals("derived")); - test(ex.p1.ice_id().equals(PreservedClass.ice_staticId())); - PreservedClass pc = (PreservedClass)ex.p1; - test(pc.bc.equals("bc")); - test(pc.pc.equals("pc")); - test(ex.p2 == ex.p1); - } - catch(KnownPreservedDerived ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0)); - test(ex.b.equals("base")); - test(ex.kp.equals("preserved")); - test(ex.kpd.equals("derived")); - } - catch(com.zeroc.Ice.OperationNotExistException ex) - { - } - catch(Exception ex) - { - test(false); - } - - try - { - test.relayUnknownPreservedAsKnownPreserved(relay); - test(false); - } - catch(Preserved2 ex) - { - test(ex.b.equals("base")); - test(ex.kp.equals("preserved")); - test(ex.kpd.equals("derived")); - test(ex.p1.ice_id().equals(PreservedClass.ice_staticId())); - PreservedClass pc = (PreservedClass)ex.p1; - test(pc.bc.equals("bc")); - test(pc.pc.equals("pc")); - test(ex.p2 == ex.p1); - } - catch(KnownPreservedDerived ex) - { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - test(test.ice_getEncodingVersion().equals(com.zeroc.Ice.Util.Encoding_1_0)); - test(ex.b.equals("base")); - test(ex.kp.equals("preserved")); - test(ex.kpd.equals("derived")); - } - catch(com.zeroc.Ice.OperationNotExistException ex) - { - } - catch(Exception ex) - { - test(false); - } - - adapter.destroy(); - } - out.println("ok"); - return test; } } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice b/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice index 16436ac6c54..b7eb7e6e12a 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivate.ice @@ -33,38 +33,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -79,20 +54,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } @@ -120,19 +81,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice b/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice index 93b4f32c753..f8cde3b723e 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/ServerPrivateAMD.ice @@ -33,38 +33,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["amd", "format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -79,20 +54,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } @@ -120,19 +81,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice b/java/test/src/main/java/test/Ice/slicing/exceptions/Test.ice similarity index 54% rename from java/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice rename to java/test/src/main/java/test/Ice/slicing/exceptions/Test.ice index e61a8dd2d51..7a825a3c743 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/ClientPrivate.ice +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/Test.ice @@ -33,7 +33,6 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] exception KnownPreserved extends Base { string kp; @@ -44,22 +43,6 @@ exception KnownPreservedDerived extends KnownPreserved string kpd; } -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { @@ -79,40 +62,7 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } -// -// Types private to the client. -// - -class PreservedClass extends BaseClass -{ - string pc; -} - -exception Preserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception Preserved2 extends Preserved1 -{ - BaseClass p2; -} - } diff --git a/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java b/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java index 0dc991e71b6..160fb8b3c16 100644 --- a/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java +++ b/java/test/src/main/java/test/Ice/slicing/exceptions/TestI.java @@ -8,14 +8,6 @@ public final class TestI implements TestIntf { - private static void test(boolean b) - { - if(!b) - { - throw new RuntimeException(); - } - } - @Override public void shutdown(com.zeroc.Ice.Current current) { @@ -157,99 +149,4 @@ public void unknownMostDerived2AsBase(com.zeroc.Ice.Current current) umd2.umd2 = "UnknownMostDerived2.umd2"; throw umd2; } - - @Override - public void unknownMostDerived2AsBaseCompact(com.zeroc.Ice.Current current) - throws Base - { - UnknownMostDerived2 umd2 = new UnknownMostDerived2(); - umd2.b = "UnknownMostDerived2.b"; - umd2.ui = "UnknownMostDerived2.ui"; - umd2.umd2 = "UnknownMostDerived2.umd2"; - throw umd2; - } - - @Override - public void knownPreservedAsBase(com.zeroc.Ice.Current current) - throws Base - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - @Override - public void knownPreservedAsKnownPreserved(com.zeroc.Ice.Current current) - throws KnownPreserved - { - KnownPreservedDerived ex = new KnownPreservedDerived(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - throw ex; - } - - @Override - public void relayKnownPreservedAsBase(RelayPrx r, com.zeroc.Ice.Current current) - throws Base - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsBase(); - test(false); - } - - @Override - public void relayKnownPreservedAsKnownPreserved(RelayPrx r, com.zeroc.Ice.Current current) - throws KnownPreserved - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.knownPreservedAsKnownPreserved(); - test(false); - } - - @Override - public void unknownPreservedAsBase(com.zeroc.Ice.Current current) - throws Base - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - - @Override - public void unknownPreservedAsKnownPreserved(com.zeroc.Ice.Current current) - throws KnownPreserved - { - SPreserved2 ex = new SPreserved2(); - ex.b = "base"; - ex.kp = "preserved"; - ex.kpd = "derived"; - ex.p1 = new SPreservedClass("bc", "spc"); - ex.p2 = ex.p1; - throw ex; - } - - @Override - public void relayUnknownPreservedAsBase(RelayPrx r, com.zeroc.Ice.Current current) - throws Base - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsBase(); - test(false); - } - - @Override - public void relayUnknownPreservedAsKnownPreserved(RelayPrx r, com.zeroc.Ice.Current current) - throws KnownPreserved - { - RelayPrx p = RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())); - p.unknownPreservedAsKnownPreserved(); - test(false); - } } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java index a911be2a3e5..5b7696a0c55 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java +++ b/java/test/src/main/java/test/Ice/slicing/objects/AllTests.java @@ -835,53 +835,48 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) out.print("return value identity for input params known first... "); out.flush(); { - //try - //{ - D1 d1 = new D1(); - d1.sb = "D1.sb"; - d1.sd1 = "D1.sd1"; - D3 d3 = new D3(); - d3.pb = d1; - d3.sb = "D3.sb"; - d3.sd3 = "D3.sd3"; - d3.pd3 = d1; - d1.pb = d3; - d1.pd1 = d3; + D1 d1 = new D1(); + d1.sb = "D1.sb"; + d1.sd1 = "D1.sd1"; + D3 d3 = new D3(); + d3.pb = d1; + d3.sb = "D3.sb"; + d3.sd3 = "D3.sd3"; + d3.pd3 = d1; + d1.pb = d3; + d1.pd1 = d3; - B b1 = test.returnTest3(d1, d3); + B b1 = test.returnTest3(d1, d3); - test(b1 != null); - test(b1.sb.equals("D1.sb")); - test(b1.ice_id().equals("::Test::D1")); - D1 p1 = (D1)b1; - test(p1 != null); - test(p1.sd1.equals("D1.sd1")); - test(p1.pd1 == b1.pb); + test(b1 != null); + test(b1.sb.equals("D1.sb")); + test(b1.ice_id().equals("::Test::D1")); + D1 p1 = (D1)b1; + test(p1 != null); + test(p1.sd1.equals("D1.sd1")); + test(p1.pd1 == b1.pb); - B b2 = b1.pb; - test(b2 != null); - test(b2.sb.equals("D3.sb")); - test(b2.ice_id().equals("::Test::B")); // Sliced by server - test(b2.pb == b1); - try - { - D3 p3 = (D3)b2; - test(p3 != null); - test(false); - } - catch(ClassCastException ex) - { - } + B b2 = b1.pb; + test(b2 != null); + test(b2.sb.equals("D3.sb")); + test(b2.pb == b1); - test(b1 != d1); - test(b1 != d3); - test(b2 != d1); - test(b2 != d3); - //} - //catch(Exception ex) - //{ - //test(false); - //} + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(!(b2 instanceof D3)); + } + else + { + test(b2 instanceof D3); + D3 p3 = (D3)b2; + test(p3.pd3 == p1); + test(p3.sd3.equals("D3.sd3")); + } + + test(b1 != d1); + test(b1 != d3); + test(b2 != d1); + test(b2 != d3); } out.println("ok"); @@ -921,16 +916,18 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) B b2 = b1.pb; test(b2 != null); test(b2.sb.equals("D3.sb")); - test(b2.ice_id().equals("::Test::B")); // Sliced by server test(b2.pb == b1); - try + + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) { - D3 p3 = (D3)b2; - test(p3 != null); - test(false); + test(!(b2 instanceof D3)); } - catch(ClassCastException ex) + else { + test(b2 instanceof D3); + D3 p3 = (D3)b2; + test(p3.pd3 == p1); + test(p3.sd3.equals("D3.sd3")); } test(b1 != d1); @@ -960,17 +957,6 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) test(b1 != null); test(b1.sb.equals("D3.sb")); - test(b1.ice_id().equals("::Test::B")); // Sliced by server - - try - { - D3 p1 = (D3)b1; - test(p1 != null); - test(false); - } - catch(ClassCastException ex) - { - } B b2 = b1.pb; test(b2 != null); @@ -982,6 +968,18 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) test(p3.sd1.equals("D1.sd1")); test(p3.pd1 == b1); + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(!(b1 instanceof D3)); + } + else + { + test(b1 instanceof D3); + D3 p1 = (D3)b1; + test(p1.sd3.equals("D3.sd3")); + test(p1.pd3 == b2); + } + test(b1 != d1); test(b1 != d3); test(b2 != d1); @@ -1021,17 +1019,6 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) B b1 = w.v; test(b1 != null); test(b1.sb.equals("D3.sb")); - test(b1.ice_id().equals("::Test::B")); // Sliced by server - - try - { - D3 p1 = (D3)b1; - test(p1 != null); - test(false); - } - catch(ClassCastException ex) - { - } B b2 = b1.pb; test(b2 != null); @@ -1043,6 +1030,18 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) test(p3.sd1.equals("D1.sd1")); test(p3.pd1 == b1); + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(!(b1 instanceof D3)); + } + else + { + test(b1 instanceof D3); + D3 p1 = (D3)b1; + test(p1.sd3.equals("D3.sd3")); + test(p1.pd3 == b2); + } + test(b1 != d1); test(b1 != d3); test(b2 != d1); @@ -1155,33 +1154,25 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) out.print("param ptr slicing, instance marshaled in unknown derived as base... "); out.flush(); { - try - { - B b1 = new B(); - b1.sb = "B.sb(1)"; - b1.pb = b1; + B b1 = new B(); + b1.sb = "B.sb(1)"; + b1.pb = b1; - D3 d3 = new D3(); - d3.sb = "D3.sb"; - d3.pb = d3; - d3.sd3 = "D3.sd3"; - d3.pd3 = b1; + D3 d3 = new D3(); + d3.sb = "D3.sb"; + d3.pb = d3; + d3.sd3 = "D3.sd3"; + d3.pd3 = b1; - B b2 = new B(); - b2.sb = "B.sb(2)"; - b2.pb = b1; + B b2 = new B(); + b2.sb = "B.sb(2)"; + b2.pb = b1; - B r = test.returnTest3(d3, b2); + B r = test.returnTest3(d3, b2); - test(r != null); - test(r.ice_id().equals("::Test::B")); - test(r.sb.equals("D3.sb")); - test(r.pb == r); - } - catch(Exception ex) - { - test(false); - } + test(r != null); + test(r.sb.equals("D3.sb")); + test(r.pb == r); } out.println("ok"); @@ -1214,44 +1205,49 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) B r = w.v; test(r != null); - test(r.ice_id().equals("::Test::B")); test(r.sb.equals("D3.sb")); test(r.pb == r); + + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(!(r instanceof D3)); + } + else + { + test(r instanceof D3); + D3 p3 = (D3)r; + test(p3.sd3.equals("D3.sd3")); + test(p3.pd3.ice_id().equals("::Test::B")); + test(p3.pd3.sb.equals("B.sb(1)")); + test(p3.pd3.pb == p3.pd3); + } } out.println("ok"); out.print("param ptr slicing, instance marshaled in unknown derived as derived... "); out.flush(); { - try - { - D1 d11 = new D1(); - d11.sb = "D1.sb(1)"; - d11.pb = d11; - d11.sd1 = "D1.sd1(1)"; + D1 d11 = new D1(); + d11.sb = "D1.sb(1)"; + d11.pb = d11; + d11.sd1 = "D1.sd1(1)"; - D3 d3 = new D3(); - d3.sb = "D3.sb"; - d3.pb = d3; - d3.sd3 = "D3.sd3"; - d3.pd3 = d11; + D3 d3 = new D3(); + d3.sb = "D3.sb"; + d3.pb = d3; + d3.sd3 = "D3.sd3"; + d3.pd3 = d11; - D1 d12 = new D1(); - d12.sb = "D1.sb(2)"; - d12.pb = d12; - d12.sd1 = "D1.sd1(2)"; - d12.pd1 = d11; + D1 d12 = new D1(); + d12.sb = "D1.sb(2)"; + d12.pb = d12; + d12.sd1 = "D1.sd1(2)"; + d12.pd1 = d11; - B r = test.returnTest3(d3, d12); - test(r != null); - test(r.ice_id().equals("::Test::B")); - test(r.sb.equals("D3.sb")); - test(r.pb == r); - } - catch(Exception ex) - { - test(false); - } + B r = test.returnTest3(d3, d12); + test(r != null); + test(r.sb.equals("D3.sb")); + test(r.pb == r); } out.println("ok"); @@ -1287,7 +1283,6 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) B r = w.v; test(r != null); - test(r.ice_id().equals("::Test::B")); test(r.sb.equals("D3.sb")); test(r.pb == r); } @@ -1370,11 +1365,26 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) test(ss1b.ice_id().equals("::Test::B")); test(ss1d1.ice_id().equals("::Test::D1")); - test(ss1d3.ice_id().equals("::Test::B")); test(ss2b.ice_id().equals("::Test::B")); test(ss2d1.ice_id().equals("::Test::D1")); - test(ss2d3.ice_id().equals("::Test::B")); + + test(ss1b.ice_id().equals("::Test::B")); + test(ss1d1.ice_id().equals("::Test::D1")); + + test(ss2b.ice_id().equals("::Test::B")); + test(ss2d1.ice_id().equals("::Test::D1")); + + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(ss1d3.ice_id().equals("::Test::B")); + test(ss2d3.ice_id().equals("::Test::B")); + } + else + { + test(ss1d3.ice_id().equals("::Test::D3")); + test(ss2d3.ice_id().equals("::Test::D3")); + } } catch(Exception ex) { @@ -1465,11 +1475,20 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) test(ss1b.ice_id().equals("::Test::B")); test(ss1d1.ice_id().equals("::Test::D1")); - test(ss1d3.ice_id().equals("::Test::B")); test(ss2b.ice_id().equals("::Test::B")); test(ss2d1.ice_id().equals("::Test::D1")); - test(ss2d3.ice_id().equals("::Test::B")); + + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(ss1d3.ice_id().equals("::Test::B")); + test(ss2d3.ice_id().equals("::Test::B")); + } + else + { + test(ss1d3.ice_id().equals("::Test::D3")); + test(ss2d3.ice_id().equals("::Test::D3")); + } } out.println("ok"); @@ -1876,8 +1895,20 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) pu.pu = "preserved"; PBase r = test.exchangePBase(pu); - test(!(r instanceof PCUnknown)); + test(r.pi == 3); + + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(!(r instanceof PCUnknown)); + } + else + { + test(r instanceof PCUnknown); + PCUnknown p2 = (PCUnknown)r; + test(p2 != null); + test(p2.pu.equals("preserved")); + } } catch(com.zeroc.Ice.OperationNotExistException ex) { @@ -2067,8 +2098,17 @@ public static TestIntfPrx allTests(test.TestHelper helper, boolean collocated) } else { - test(!(result instanceof PCUnknown)); - test(result.pi == 3); + if(test.ice_getEncodingVersion().equals(Util.Encoding_1_0)) + { + test(!(result instanceof PCUnknown)); + } + else + { + test(result instanceof PCUnknown); + PCUnknown p2 = (PCUnknown)result; + test(p2 != null); + test(p2.pu.equals("preserved")); + } } cb.called(); }); diff --git a/java/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice b/java/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice index 35d92d010db..ef3c22193a1 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice +++ b/java/test/src/main/java/test/Ice/slicing/objects/ClientPrivate.ice @@ -76,7 +76,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -92,13 +91,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } @@ -171,7 +168,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice b/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice index e8a31e32f2f..cdb49926e53 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice +++ b/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivate.ice @@ -76,7 +76,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -92,13 +91,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } diff --git a/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice b/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice index 4e4e7243e8b..eab2674c041 100644 --- a/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice +++ b/java/test/src/main/java/test/Ice/slicing/objects/ServerPrivateAMD.ice @@ -76,7 +76,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -87,13 +86,11 @@ class PDerived extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } diff --git a/js/src/Ice/Exception.d.ts b/js/src/Ice/Exception.d.ts index 522f0887fd0..db9b982fd41 100644 --- a/js/src/Ice/Exception.d.ts +++ b/js/src/Ice/Exception.d.ts @@ -47,13 +47,6 @@ declare module "ice" */ abstract class UserException extends Exception { - /** - * Obtains the sliced data associated with this instance. - * @return The sliced data if the exception has a preserved-slice base class and has been sliced during - * unmarshaling of the exception, nil otherwise. - */ - ice_getSlicedData():SlicedData; - /** * Obtains the Slice type ID of this exception. * @return The fully-scoped type ID. diff --git a/js/src/Ice/Exception.js b/js/src/Ice/Exception.js index d7a652a9b4a..89542c4dbd6 100644 --- a/js/src/Ice/Exception.js +++ b/js/src/Ice/Exception.js @@ -161,14 +161,9 @@ class UserException extends Exception return "::Ice::UserException"; } - ice_getSlicedData() - { - return null; - } - _write(os) { - os.startException(null); + os.startException(); writeImpl(this, os, this._mostDerivedType()); os.endException(); } @@ -177,7 +172,7 @@ class UserException extends Exception { is.startException(); readImpl(this, is, this._mostDerivedType()); - is.endException(false); + is.endException(); } _usesClasses() @@ -240,38 +235,4 @@ const readImpl = function(obj, is, type) readImpl(obj, is, type._parent); }; -const writePreserved = function(os) -{ - // - // For Slice exceptions which are marked "preserved", the implementation of this method - // replaces the Ice.UserException.prototype._write method. - // - os.startException(this._slicedData); - writeImpl(this, os, this._mostDerivedType()); - os.endException(); -}; - -const readPreserved = function(is) -{ - // - // For Slice exceptions which are marked "preserved", the implementation of this method - // replaces the Ice.UserException.prototype._read method. - // - is.startException(); - readImpl(this, is, this._mostDerivedType()); - this._slicedData = is.endException(true); -}; - -const ice_getSlicedData = function() -{ - return this._slicedData; -}; - -Ice.Slice.PreservedUserException = function(ex) -{ - ex.prototype.ice_getSlicedData = ice_getSlicedData; - ex.prototype._write = writePreserved; - ex.prototype._read = readPreserved; -}; - module.exports.Ice = Ice; diff --git a/js/src/Ice/Stream.js b/js/src/Ice/Stream.js index a17bdadcc5a..07b8b53a89a 100644 --- a/js/src/Ice/Stream.js +++ b/js/src/Ice/Stream.js @@ -377,7 +377,7 @@ class EncapsDecoder10 extends EncapsDecoder this._skipFirstSlice = true; } - endInstance(preserve) + endInstance() { // // Read the Ice::Object slice. @@ -634,13 +634,9 @@ class EncapsDecoder11 extends EncapsDecoder this._current.skipFirstSlice = true; } - endInstance(preserve) + endInstance() { - let slicedData = null; - if(preserve) - { - slicedData = this.readSlicedData(); - } + let slicedData = this.readSlicedData(); if(this._current.slices !== null) { this._current.slices.length = 0; // Clear the array. @@ -1297,10 +1293,10 @@ class InputStream this._encapsStack.decoder.startInstance(SliceType.ValueSlice); } - endValue(preserve) + endValue() { Debug.assert(this._encapsStack !== null && this._encapsStack.decoder !== null); - return this._encapsStack.decoder.endInstance(preserve); + return this._encapsStack.decoder.endInstance(); } startException() @@ -1309,10 +1305,10 @@ class InputStream this._encapsStack.decoder.startInstance(SliceType.ExceptionSlice); } - endException(preserve) + endException() { Debug.assert(this._encapsStack !== null && this._encapsStack.decoder !== null); - return this._encapsStack.decoder.endInstance(preserve); + return this._encapsStack.decoder.endInstance(); } startEncapsulation() @@ -2917,10 +2913,10 @@ class OutputStream this._encapsStack.encoder.endInstance(); } - startException(data) + startException() { Debug.assert(this._encapsStack !== null && this._encapsStack.encoder !== null); - this._encapsStack.encoder.startInstance(SliceType.ExceptionSlice, data); + this._encapsStack.encoder.startInstance(SliceType.ExceptionSlice); } endException() @@ -3258,6 +3254,8 @@ class OutputStream writeException(e) { this.initEncaps(); + // Exceptions are always encoded with the sliced format. + this._encapsStack.format = FormatType.SlicedFormat; this._encapsStack.encoder.writeException(e); } diff --git a/js/src/Ice/UnknownSlicedValue.js b/js/src/Ice/UnknownSlicedValue.js index bc49f39a162..23536b8736d 100644 --- a/js/src/Ice/UnknownSlicedValue.js +++ b/js/src/Ice/UnknownSlicedValue.js @@ -58,11 +58,6 @@ class UnknownSlicedValue extends Ice.Value this._unknownTypeId = unknownTypeId; } - ice_getSlicedData() - { - return this._slicedData; - } - ice_id() { return this._unknownTypeId; @@ -70,14 +65,14 @@ class UnknownSlicedValue extends Ice.Value _iceWrite(os) { - os.startValue(this._slicedData); + os.startValue(this._iceSlicedData); os.endValue(); } _iceRead(is) { is.startValue(); - this._slicedData = is.endValue(true); + this._iceSlicedData = is.endValue(); } } Ice.UnknownSlicedValue = UnknownSlicedValue; diff --git a/js/src/Ice/Value.js b/js/src/Ice/Value.js index ac7866c116b..aeafc44607b 100644 --- a/js/src/Ice/Value.js +++ b/js/src/Ice/Value.js @@ -13,6 +13,11 @@ require("../Ice/OptionalFormat"); Ice.Value = class { + constructor() + { + this._iceSlicedData = null; + } + ice_preMarshal() { } @@ -23,12 +28,12 @@ Ice.Value = class ice_getSlicedData() { - return null; + return this._iceSlicedData; } _iceWrite(os) { - os.startValue(null); + os.startValue(this._iceSlicedData); writeImpl(this, os, this._iceMostDerivedType()); os.endValue(); } @@ -37,7 +42,7 @@ Ice.Value = class { is.startValue(); readImpl(this, is, this._iceMostDerivedType()); - is.endValue(false); + this._iceSlicedData = is.endValue(); } // @@ -100,7 +105,7 @@ Ice.InterfaceByValue = class extends Ice.Value is.startValue(); is.startSlice(); is.endSlice(); - is.endValue(false); + is.endValue(); } }; @@ -153,36 +158,9 @@ const readImpl = function(obj, is, type) readImpl(obj, is, Object.getPrototypeOf(type)); }; -function writePreserved(os) -{ - // - // For Slice classes which are marked "preserved", the implementation of this method - // replaces the Ice.Value.prototype._iceWrite method. - // - os.startValue(this._iceSlicedData); - writeImpl(this, os, this._iceMostDerivedType()); - os.endValue(); -} - -function readPreserved(is) -{ - // - // For Slice classes which are marked "preserved", the implementation of this method - // replaces the Ice.Value.prototype._iceRead method. - // - is.startValue(); - readImpl(this, is, this._iceMostDerivedType()); - this._iceSlicedData = is.endValue(true); -} - -function ice_getSlicedData() -{ - return this._iceSlicedData; -} - const Slice = Ice.Slice; -Slice.defineValue = function(valueType, id, preserved, compactId = 0) +Slice.defineValue = function(valueType, id, compactId = 0) { valueType.prototype.ice_id = function() { @@ -199,13 +177,6 @@ Slice.defineValue = function(valueType, id, preserved, compactId = 0) return id; }; - if(preserved) - { - valueType.prototype.ice_getSlicedData = ice_getSlicedData; - valueType.prototype._iceWrite = writePreserved; - valueType.prototype._iceRead = readPreserved; - } - if(compactId > 0) { Ice.CompactIdRegistry.set(compactId, id); diff --git a/js/test/Ice/optional/Test.ice b/js/test/Ice/optional/Test.ice index c6873c3cdca..86562a93947 100644 --- a/js/test/Ice/optional/Test.ice +++ b/js/test/Ice/optional/Test.ice @@ -115,7 +115,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/js/test/Ice/slicing/exceptions/Client.js b/js/test/Ice/slicing/exceptions/Client.js index 4fe19db952d..416cffb43a0 100644 --- a/js/test/Ice/slicing/exceptions/Client.js +++ b/js/test/Ice/slicing/exceptions/Client.js @@ -178,130 +178,6 @@ } out.writeLine("ok"); - out.write("slicing of unknown most derived, known intermediate as base... "); - try - { - await prx.unknownMostDerived1AsBase(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.KnownIntermediate, ex); - test(ex.b == "UnknownMostDerived1.b"); - test(ex.ki == "UnknownMostDerived1.ki"); - test(ex.ice_id() == "::Test::KnownIntermediate"); - } - out.writeLine("ok"); - - out.write("slicing of unknown most derived, known intermediate as intermediate... "); - try - { - await prx.unknownMostDerived1AsKnownIntermediate(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.KnownIntermediate, ex); - test(ex.b == "UnknownMostDerived1.b"); - test(ex.ki == "UnknownMostDerived1.ki"); - test(ex.ice_id() == "::Test::KnownIntermediate"); - } - out.writeLine("ok"); - - out.write("slicing of unknown most derived, unknown intermediate thrown as base... "); - try - { - await prx.unknownMostDerived2AsBase(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.Base, ex); - test(ex.b == "UnknownMostDerived2.b"); - test(ex.ice_id() == "::Test::Base"); - } - out.writeLine("ok"); - - out.write("unknown most derived in compact format... "); - try - { - await prx.unknownMostDerived2AsBaseCompact(); - test(false); - } - catch(ex) - { - if(ex instanceof Test.Base) - { - // - // For the 1.0 encoding, the unknown exception is sliced to Base. - // - test(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)); - } - else if(ex instanceof Ice.UnknownUserException) - { - // - // An UnknownUserException is raised for the compact format because the - // most-derived type is unknown and the exception cannot be sliced. - // - test(!prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)); - } - else if(ex instanceof Ice.OperationNotExistException) - { - // Ignore - } - else - { - test(false, ex); - } - } - out.writeLine("ok"); - - out.write("preserved exceptions..."); - try - { - await prx.unknownPreservedAsBase(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.Base, ex); - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(ex.ice_getSlicedData() === null); - } - else - { - const slicedData = ex.ice_getSlicedData(); - test(slicedData !== null); - test(slicedData.slices.length == 2); - test(slicedData.slices[1].typeId == "::Test::SPreserved1"); - test(slicedData.slices[0].typeId == "::Test::SPreserved2"); - } - } - - try - { - await prx.unknownPreservedAsKnownPreserved(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.KnownPreserved, ex); - test(ex.kp == "preserved"); - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(ex.ice_getSlicedData() === null); - } - else - { - const slicedData = ex.ice_getSlicedData(); - test(slicedData !== null); - test(slicedData.slices.length == 2); - test(slicedData.slices[1].typeId == "::Test::SPreserved1"); - test(slicedData.slices[0].typeId == "::Test::SPreserved2"); - } - } - out.writeLine("ok"); await prx.shutdown(); } diff --git a/js/test/Ice/slicing/exceptions/Test.ice b/js/test/Ice/slicing/exceptions/Test.ice index a16c2319ea7..5c8c0bf796a 100644 --- a/js/test/Ice/slicing/exceptions/Test.ice +++ b/js/test/Ice/slicing/exceptions/Test.ice @@ -27,7 +27,6 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] exception KnownPreserved extends Base { string kp; @@ -38,27 +37,13 @@ exception KnownPreservedDerived extends KnownPreserved string kpd; } -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +58,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/js/test/Ice/slicing/objects/Client.js b/js/test/Ice/slicing/objects/Client.js index a960f0abf0c..e22e6eda68f 100644 --- a/js/test/Ice/slicing/objects/Client.js +++ b/js/test/Ice/slicing/objects/Client.js @@ -262,10 +262,20 @@ const b2 = b1.pb; test(b2 !== null); test(b2.sb == "D3.sb"); - test(b2.ice_id() == "::Test::B"); // Sliced by server test(b2.pb == b1); - test(!(b2 instanceof Test.D3)); + const p3 = b2; + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(p3 instanceof Test.D3)); + } + else + { + test(p3 instanceof Test.D3); + test(p3.pd3 === p1); + test(p3.sd3 == "D3.sd3"); + } + test(b1 !== d1); test(b1 !== d3); test(b2 !== d1); @@ -290,8 +300,6 @@ test(b1 !== null); test(b1.sb == "D3.sb"); - test(b1.ice_id() == "::Test::B"); // Sliced by server - test(!(b1 instanceof Test.D3)); const b2 = b1.pb; test(b2 !== null); @@ -304,6 +312,18 @@ test(p3.sd1 == "D1.sd1"); test(p3.pd1 === b1); + const p1 = b1; + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(p1 instanceof Test.D3)); + } + else + { + test(p1 instanceof Test.D3); + test(p1.pd3 === b2); + test(p1.sd3 == "D3.sd3"); + } + test(b1 !== d1); test(b1 !== d3); test(b2 !== d1); @@ -363,10 +383,24 @@ b2.pb = b1; const ret = await prx.returnTest3(d3, b2); + test(ret !== null); - test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); test(ret.pb === ret); + + const p3 = ret; + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(p3 instanceof Test.D3)); + } + else + { + test(p3 instanceof Test.D3); + test(p3.sd3 == "D3.sd3"); + test(p3.pd3.ice_id() == "::Test::B"); + test(p3.pd3.sb == "B.sb(1)"); + test(p3.pd3.pb === p3.pd3); + } } out.writeLine("ok"); @@ -390,8 +424,8 @@ d12.pd1 = d11; const ret = await prx.returnTest3(d3, d12); + test(ret !== null); - test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); test(ret.pb === ret); } @@ -468,11 +502,20 @@ test(ss1b.ice_id() == "::Test::B"); test(ss1d1.ice_id() == "::Test::D1"); - test(ss1d3.ice_id() == "::Test::B"); test(ss2b.ice_id() == "::Test::B"); test(ss2d1.ice_id() == "::Test::D1"); - test(ss2d3.ice_id() == "::Test::B"); + + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(ss1d3 instanceof Test.B); + test(ss2d3 instanceof Test.B); + } + else + { + test(ss1d3 instanceof Test.D3); + test(ss2d3 instanceof Test.D3); + } } out.writeLine("ok"); @@ -640,8 +683,18 @@ const r = await prx.exchangePBase(pu); - test(!(r instanceof Test.PCUnknown)); test(r.pi == 3); + + const p2 = r; + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(p2 instanceof Test.PCUnknown)); + } + else + { + test(p2 instanceof Test.PCUnknown); + test(p2.pu == "preserved"); + } } { diff --git a/js/test/Ice/slicing/objects/Test.ice b/js/test/Ice/slicing/objects/Test.ice index 81a070673ae..635916c3064 100644 --- a/js/test/Ice/slicing/objects/Test.ice +++ b/js/test/Ice/slicing/objects/Test.ice @@ -75,7 +75,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -91,13 +90,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } @@ -170,7 +167,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/js/test/typescript/Ice/optional/Test.ice b/js/test/typescript/Ice/optional/Test.ice index f20d89ca9fc..fa5b9e2155e 100644 --- a/js/test/typescript/Ice/optional/Test.ice +++ b/js/test/typescript/Ice/optional/Test.ice @@ -117,7 +117,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/js/test/typescript/Ice/slicing/exceptions/Client.ts b/js/test/typescript/Ice/slicing/exceptions/Client.ts index e05be4ff018..9f9efb300ae 100644 --- a/js/test/typescript/Ice/slicing/exceptions/Client.ts +++ b/js/test/typescript/Ice/slicing/exceptions/Client.ts @@ -177,130 +177,6 @@ export class Client extends TestHelper } out.writeLine("ok"); - out.write("slicing of unknown most derived, known intermediate as base... "); - try - { - await prx.unknownMostDerived1AsBase(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.KnownIntermediate, ex); - test(ex.b == "UnknownMostDerived1.b"); - test(ex.ki == "UnknownMostDerived1.ki"); - test(ex.ice_id() == "::Test::KnownIntermediate"); - } - out.writeLine("ok"); - - out.write("slicing of unknown most derived, known intermediate as intermediate... "); - try - { - await prx.unknownMostDerived1AsKnownIntermediate(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.KnownIntermediate, ex); - test(ex.b == "UnknownMostDerived1.b"); - test(ex.ki == "UnknownMostDerived1.ki"); - test(ex.ice_id() == "::Test::KnownIntermediate"); - } - out.writeLine("ok"); - - out.write("slicing of unknown most derived, unknown intermediate thrown as base... "); - try - { - await prx.unknownMostDerived2AsBase(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.Base, ex); - test(ex.b == "UnknownMostDerived2.b"); - test(ex.ice_id() == "::Test::Base"); - } - out.writeLine("ok"); - - out.write("unknown most derived in compact format... "); - try - { - await prx.unknownMostDerived2AsBaseCompact(); - test(false); - } - catch(ex) - { - if(ex instanceof Test.Base) - { - // - // For the 1.0 encoding, the unknown exception is sliced to Base. - // - test(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)); - } - else if(ex instanceof Ice.UnknownUserException) - { - // - // An UnknownUserException is raised for the compact format because the - // most-derived type is unknown and the exception cannot be sliced. - // - test(!prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)); - } - else if(ex instanceof Ice.OperationNotExistException) - { - // Ignore - } - else - { - test(false, ex); - } - } - out.writeLine("ok"); - - out.write("preserved exceptions..."); - try - { - await prx.unknownPreservedAsBase(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.Base, ex); - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(ex.ice_getSlicedData() === null); - } - else - { - const slicedData = ex.ice_getSlicedData(); - test(slicedData !== null); - test(slicedData.slices.length == 2); - test(slicedData.slices[1].typeId == "::Test::SPreserved1"); - test(slicedData.slices[0].typeId == "::Test::SPreserved2"); - } - } - - try - { - await prx.unknownPreservedAsKnownPreserved(); - test(false); - } - catch(ex) - { - test(ex instanceof Test.KnownPreserved, ex); - test(ex.kp == "preserved"); - if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) - { - test(ex.ice_getSlicedData() === null); - } - else - { - const slicedData = ex.ice_getSlicedData(); - test(slicedData !== null); - test(slicedData.slices.length == 2); - test(slicedData.slices[1].typeId == "::Test::SPreserved1"); - test(slicedData.slices[0].typeId == "::Test::SPreserved2"); - } - } - out.writeLine("ok"); await prx.shutdown(); } diff --git a/js/test/typescript/Ice/slicing/exceptions/Test.ice b/js/test/typescript/Ice/slicing/exceptions/Test.ice index aa07dcd1b94..d94dddd7aef 100644 --- a/js/test/typescript/Ice/slicing/exceptions/Test.ice +++ b/js/test/typescript/Ice/slicing/exceptions/Test.ice @@ -29,38 +29,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -75,20 +50,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/js/test/typescript/Ice/slicing/objects/Client.ts b/js/test/typescript/Ice/slicing/objects/Client.ts index f1e022613a0..0d6ef5bfc5e 100644 --- a/js/test/typescript/Ice/slicing/objects/Client.ts +++ b/js/test/typescript/Ice/slicing/objects/Client.ts @@ -266,10 +266,20 @@ export class Client extends TestHelper const b2 = b1.pb; test(b2 !== null); test(b2.sb == "D3.sb"); - test(b2.ice_id() == "::Test::B"); // Sliced by server test(b2.pb == b1); - test(!(b2 instanceof Test.D3)); + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(b2 instanceof Test.D3)); + } + else + { + test(b2 instanceof Test.D3); + const p3 = b2 as Test.D3; + test(p3.pd3 === p1); + test(p3.sd3 == "D3.sd3"); + } + test(b1 !== d1); test(b1 !== d3); test(b2 !== d1); @@ -294,8 +304,6 @@ export class Client extends TestHelper test(b1 !== null); test(b1.sb == "D3.sb"); - test(b1.ice_id() == "::Test::B"); // Sliced by server - test(!(b1 instanceof Test.D3)); const b2 = b1.pb; test(b2 !== null); @@ -308,6 +316,18 @@ export class Client extends TestHelper test(p3.sd1 == "D1.sd1"); test(p3.pd1 === b1); + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(b1 instanceof Test.D3)); + } + else + { + test(b1 instanceof Test.D3); + const p1 = b1 as Test.D3; + test(p1.pd3 === b2); + test(p1.sd3 == "D3.sd3"); + } + test(b1 !== d1); test(b1 !== d3); test(b2 !== d1); @@ -367,10 +387,24 @@ export class Client extends TestHelper b2.pb = b1; const ret = await prx.returnTest3(d3, b2); + test(ret !== null); - test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); test(ret.pb === ret); + + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(ret instanceof Test.D3)); + } + else + { + test(ret instanceof Test.D3); + const p3 = ret as Test.D3; + test(p3.sd3 == "D3.sd3"); + test(p3.pd3.ice_id() == "::Test::B"); + test(p3.pd3.sb == "B.sb(1)"); + test(p3.pd3.pb === p3.pd3); + } } out.writeLine("ok"); @@ -394,8 +428,8 @@ export class Client extends TestHelper d12.pd1 = d11; const ret = await prx.returnTest3(d3, d12); + test(ret !== null); - test(ret.ice_id() == "::Test::B"); test(ret.sb == "D3.sb"); test(ret.pb === ret); } @@ -472,11 +506,20 @@ export class Client extends TestHelper test(ss1b2.ice_id() == "::Test::B"); test(ss1d2.ice_id() == "::Test::D1"); - test(ss1d4.ice_id() == "::Test::B"); test(ss2b2.ice_id() == "::Test::B"); test(ss2d2.ice_id() == "::Test::D1"); - test(ss2d4.ice_id() == "::Test::B"); + + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(ss1d4 instanceof Test.B); + test(ss2d4 instanceof Test.B); + } + else + { + test(ss1d4 instanceof Test.D3); + test(ss2d4 instanceof Test.D3); + } } out.writeLine("ok"); @@ -646,8 +689,18 @@ export class Client extends TestHelper const r = await prx.exchangePBase(pu); - test(!(r instanceof Test.PCUnknown)); test(r.pi == 3); + + if(prx.ice_getEncodingVersion().equals(Ice.Encoding_1_0)) + { + test(!(r instanceof Test.PCUnknown)); + } + else + { + test(r instanceof Test.PCUnknown); + const p2 = r as Test.PCUnknown + test(p2.pu == "preserved"); + } } { diff --git a/js/test/typescript/Ice/slicing/objects/Test.ice b/js/test/typescript/Ice/slicing/objects/Test.ice index c7417615185..a7cb2d10408 100644 --- a/js/test/typescript/Ice/slicing/objects/Test.ice +++ b/js/test/typescript/Ice/slicing/objects/Test.ice @@ -77,7 +77,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -93,13 +92,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } @@ -172,7 +169,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/php/lib/Ice.php b/php/lib/Ice.php index 213bb9ce306..ed62dbbf7ef 100644 --- a/php/lib/Ice.php +++ b/php/lib/Ice.php @@ -119,7 +119,7 @@ public static function ice_staticId() global $Ice__t_ObjectPrx; global $Ice__t_ObjectProxySeq; - $Ice__t_Value = IcePHP_defineClass('::Ice::Object', "\\Ice\\Value", -1, false, false, null, null); + $Ice__t_Value = IcePHP_defineClass('::Ice::Object', "\\Ice\\Value", -1, false, null, null); $Ice__t_ObjectSeq = IcePHP_defineSequence('::Ice::ObjectSeq', $Ice__t_Value); $Ice__t_ObjectPrx = IcePHP_defineProxy('::Ice::Object', null, null); $Ice__t_ObjectProxySeq = IcePHP_defineSequence('::Ice::ObjectProxySeq', $Ice__t_ObjectPrx); @@ -139,8 +139,8 @@ public function ice_id() } global $Ice__t_UnknownSlicedValue; - $Ice__t_UnknownSlicedValue = IcePHP_defineClass('::Ice::UnknownSlicedValue', "\\Ice\\UnknownSlicedValue", -1, true, - false, $Ice__t_Value, null); + $Ice__t_UnknownSlicedValue = IcePHP_defineClass('::Ice::UnknownSlicedValue', "\\Ice\\UnknownSlicedValue", -1, false, + $Ice__t_Value, null); interface ValueFactory { diff --git a/php/lib/IceBoxLocal/Service.php b/php/lib/IceBoxLocal/Service.php index 96d45a1b031..c24ab658016 100644 --- a/php/lib/IceBoxLocal/Service.php +++ b/php/lib/IceBoxLocal/Service.php @@ -57,6 +57,6 @@ interface Service public function start($name, $communicator, $args); public function stop(); } - $IceBox__t_Service = IcePHP_defineClass('::IceBox::Service', '\\IceBox\\Service', -1, false, true, null, null); + $IceBox__t_Service = IcePHP_defineClass('::IceBox::Service', '\\IceBox\\Service', -1, true, null, null); } ?> diff --git a/php/lib/IceLocal/Connection.php b/php/lib/IceLocal/Connection.php index 2eb092cb461..69601fd1210 100644 --- a/php/lib/IceLocal/Connection.php +++ b/php/lib/IceLocal/Connection.php @@ -50,7 +50,7 @@ interface CloseCallback { public function closed($con); } - $Ice__t_CloseCallback = IcePHP_defineClass('::Ice::CloseCallback', '\\Ice\\CloseCallback', -1, false, true, null, null); + $Ice__t_CloseCallback = IcePHP_defineClass('::Ice::CloseCallback', '\\Ice\\CloseCallback', -1, true, null, null); } namespace Ice @@ -60,7 +60,7 @@ interface HeartbeatCallback { public function heartbeat($con); } - $Ice__t_HeartbeatCallback = IcePHP_defineClass('::Ice::HeartbeatCallback', '\\Ice\\HeartbeatCallback', -1, false, true, null, null); + $Ice__t_HeartbeatCallback = IcePHP_defineClass('::Ice::HeartbeatCallback', '\\Ice\\HeartbeatCallback', -1, true, null, null); } namespace Ice diff --git a/php/lib/IceLocal/ImplicitContext.php b/php/lib/IceLocal/ImplicitContext.php index b03cb55ec14..f822e80d921 100644 --- a/php/lib/IceLocal/ImplicitContext.php +++ b/php/lib/IceLocal/ImplicitContext.php @@ -32,6 +32,6 @@ public function get($key); public function put($key, $value); public function remove($key); } - $Ice__t_ImplicitContext = IcePHP_defineClass('::Ice::ImplicitContext', '\\Ice\\ImplicitContext', -1, false, true, null, null); + $Ice__t_ImplicitContext = IcePHP_defineClass('::Ice::ImplicitContext', '\\Ice\\ImplicitContext', -1, true, null, null); } ?> diff --git a/php/lib/IceLocal/Instrumentation.php b/php/lib/IceLocal/Instrumentation.php index ba920b0ebb5..9ca371aeb42 100644 --- a/php/lib/IceLocal/Instrumentation.php +++ b/php/lib/IceLocal/Instrumentation.php @@ -30,7 +30,7 @@ public function attach(); public function detach(); public function failed($exceptionName); } - $Ice_Instrumentation__t_Observer = IcePHP_defineClass('::Ice::Instrumentation::Observer', '\\Ice\\Instrumentation\\Observer', -1, false, true, null, null); + $Ice_Instrumentation__t_Observer = IcePHP_defineClass('::Ice::Instrumentation::Observer', '\\Ice\\Instrumentation\\Observer', -1, true, null, null); } namespace Ice\Instrumentation @@ -54,7 +54,7 @@ interface ThreadObserver extends \Ice\Instrumentation\Observer { public function stateChanged($oldState, $newState); } - $Ice_Instrumentation__t_ThreadObserver = IcePHP_defineClass('::Ice::Instrumentation::ThreadObserver', '\\Ice\\Instrumentation\\ThreadObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_ThreadObserver = IcePHP_defineClass('::Ice::Instrumentation::ThreadObserver', '\\Ice\\Instrumentation\\ThreadObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -80,7 +80,7 @@ interface ConnectionObserver extends \Ice\Instrumentation\Observer public function sentBytes($num); public function receivedBytes($num); } - $Ice_Instrumentation__t_ConnectionObserver = IcePHP_defineClass('::Ice::Instrumentation::ConnectionObserver', '\\Ice\\Instrumentation\\ConnectionObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_ConnectionObserver = IcePHP_defineClass('::Ice::Instrumentation::ConnectionObserver', '\\Ice\\Instrumentation\\ConnectionObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -91,7 +91,7 @@ interface DispatchObserver extends \Ice\Instrumentation\Observer public function userException(); public function reply($size); } - $Ice_Instrumentation__t_DispatchObserver = IcePHP_defineClass('::Ice::Instrumentation::DispatchObserver', '\\Ice\\Instrumentation\\DispatchObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_DispatchObserver = IcePHP_defineClass('::Ice::Instrumentation::DispatchObserver', '\\Ice\\Instrumentation\\DispatchObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -101,7 +101,7 @@ interface ChildInvocationObserver extends \Ice\Instrumentation\Observer { public function reply($size); } - $Ice_Instrumentation__t_ChildInvocationObserver = IcePHP_defineClass('::Ice::Instrumentation::ChildInvocationObserver', '\\Ice\\Instrumentation\\ChildInvocationObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_ChildInvocationObserver = IcePHP_defineClass('::Ice::Instrumentation::ChildInvocationObserver', '\\Ice\\Instrumentation\\ChildInvocationObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -110,7 +110,7 @@ public function reply($size); interface RemoteObserver extends \Ice\Instrumentation\ChildInvocationObserver { } - $Ice_Instrumentation__t_RemoteObserver = IcePHP_defineClass('::Ice::Instrumentation::RemoteObserver', '\\Ice\\Instrumentation\\RemoteObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_RemoteObserver = IcePHP_defineClass('::Ice::Instrumentation::RemoteObserver', '\\Ice\\Instrumentation\\RemoteObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -119,7 +119,7 @@ interface RemoteObserver extends \Ice\Instrumentation\ChildInvocationObserver interface CollocatedObserver extends \Ice\Instrumentation\ChildInvocationObserver { } - $Ice_Instrumentation__t_CollocatedObserver = IcePHP_defineClass('::Ice::Instrumentation::CollocatedObserver', '\\Ice\\Instrumentation\\CollocatedObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_CollocatedObserver = IcePHP_defineClass('::Ice::Instrumentation::CollocatedObserver', '\\Ice\\Instrumentation\\CollocatedObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -132,7 +132,7 @@ public function userException(); public function getRemoteObserver($con, $endpt, $requestId, $size); public function getCollocatedObserver($adapter, $requestId, $size); } - $Ice_Instrumentation__t_InvocationObserver = IcePHP_defineClass('::Ice::Instrumentation::InvocationObserver', '\\Ice\\Instrumentation\\InvocationObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_InvocationObserver = IcePHP_defineClass('::Ice::Instrumentation::InvocationObserver', '\\Ice\\Instrumentation\\InvocationObserver', -1, true, null, null); } namespace Ice\Instrumentation @@ -143,7 +143,7 @@ interface ObserverUpdater public function updateConnectionObservers(); public function updateThreadObservers(); } - $Ice_Instrumentation__t_ObserverUpdater = IcePHP_defineClass('::Ice::Instrumentation::ObserverUpdater', '\\Ice\\Instrumentation\\ObserverUpdater', -1, false, true, null, null); + $Ice_Instrumentation__t_ObserverUpdater = IcePHP_defineClass('::Ice::Instrumentation::ObserverUpdater', '\\Ice\\Instrumentation\\ObserverUpdater', -1, true, null, null); } namespace Ice\Instrumentation @@ -159,6 +159,6 @@ public function getInvocationObserver($prx, $operation, $ctx); public function getDispatchObserver($c, $size); public function setObserverUpdater($updater); } - $Ice_Instrumentation__t_CommunicatorObserver = IcePHP_defineClass('::Ice::Instrumentation::CommunicatorObserver', '\\Ice\\Instrumentation\\CommunicatorObserver', -1, false, true, null, null); + $Ice_Instrumentation__t_CommunicatorObserver = IcePHP_defineClass('::Ice::Instrumentation::CommunicatorObserver', '\\Ice\\Instrumentation\\CommunicatorObserver', -1, true, null, null); } ?> diff --git a/php/lib/IceLocal/LocalException.php b/php/lib/IceLocal/LocalException.php index 42da01fd51c..bbf3c9b2107 100644 --- a/php/lib/IceLocal/LocalException.php +++ b/php/lib/IceLocal/LocalException.php @@ -46,7 +46,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_InitializationException = IcePHP_defineException('::Ice::InitializationException', '\\Ice\\InitializationException', false, null, array( + $Ice__t_InitializationException = IcePHP_defineException('::Ice::InitializationException', '\\Ice\\InitializationException', null, array( array('reason', $IcePHP__t_string, false, 0))); } @@ -75,7 +75,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_PluginInitializationException = IcePHP_defineException('::Ice::PluginInitializationException', '\\Ice\\PluginInitializationException', false, null, array( + $Ice__t_PluginInitializationException = IcePHP_defineException('::Ice::PluginInitializationException', '\\Ice\\PluginInitializationException', null, array( array('reason', $IcePHP__t_string, false, 0))); } @@ -100,7 +100,7 @@ public function __toString(): string } } - $Ice__t_CollocationOptimizationException = IcePHP_defineException('::Ice::CollocationOptimizationException', '\\Ice\\CollocationOptimizationException', false, null, null); + $Ice__t_CollocationOptimizationException = IcePHP_defineException('::Ice::CollocationOptimizationException', '\\Ice\\CollocationOptimizationException', null, null); } namespace Ice @@ -130,7 +130,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_AlreadyRegisteredException = IcePHP_defineException('::Ice::AlreadyRegisteredException', '\\Ice\\AlreadyRegisteredException', false, null, array( + $Ice__t_AlreadyRegisteredException = IcePHP_defineException('::Ice::AlreadyRegisteredException', '\\Ice\\AlreadyRegisteredException', null, array( array('kindOfObject', $IcePHP__t_string, false, 0), array('id', $IcePHP__t_string, false, 0))); } @@ -162,7 +162,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_NotRegisteredException = IcePHP_defineException('::Ice::NotRegisteredException', '\\Ice\\NotRegisteredException', false, null, array( + $Ice__t_NotRegisteredException = IcePHP_defineException('::Ice::NotRegisteredException', '\\Ice\\NotRegisteredException', null, array( array('kindOfObject', $IcePHP__t_string, false, 0), array('id', $IcePHP__t_string, false, 0))); } @@ -192,7 +192,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_TwowayOnlyException = IcePHP_defineException('::Ice::TwowayOnlyException', '\\Ice\\TwowayOnlyException', false, null, array( + $Ice__t_TwowayOnlyException = IcePHP_defineException('::Ice::TwowayOnlyException', '\\Ice\\TwowayOnlyException', null, array( array('operation', $IcePHP__t_string, false, 0))); } @@ -217,7 +217,7 @@ public function __toString(): string } } - $Ice__t_CloneNotImplementedException = IcePHP_defineException('::Ice::CloneNotImplementedException', '\\Ice\\CloneNotImplementedException', false, null, null); + $Ice__t_CloneNotImplementedException = IcePHP_defineException('::Ice::CloneNotImplementedException', '\\Ice\\CloneNotImplementedException', null, null); } namespace Ice @@ -245,7 +245,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_UnknownException = IcePHP_defineException('::Ice::UnknownException', '\\Ice\\UnknownException', false, null, array( + $Ice__t_UnknownException = IcePHP_defineException('::Ice::UnknownException', '\\Ice\\UnknownException', null, array( array('unknown', $IcePHP__t_string, false, 0))); } @@ -271,7 +271,7 @@ public function __toString(): string } } - $Ice__t_UnknownLocalException = IcePHP_defineException('::Ice::UnknownLocalException', '\\Ice\\UnknownLocalException', false, $Ice__t_UnknownException, null); + $Ice__t_UnknownLocalException = IcePHP_defineException('::Ice::UnknownLocalException', '\\Ice\\UnknownLocalException', $Ice__t_UnknownException, null); } namespace Ice @@ -296,7 +296,7 @@ public function __toString(): string } } - $Ice__t_UnknownUserException = IcePHP_defineException('::Ice::UnknownUserException', '\\Ice\\UnknownUserException', false, $Ice__t_UnknownException, null); + $Ice__t_UnknownUserException = IcePHP_defineException('::Ice::UnknownUserException', '\\Ice\\UnknownUserException', $Ice__t_UnknownException, null); } namespace Ice @@ -320,7 +320,7 @@ public function __toString(): string } } - $Ice__t_VersionMismatchException = IcePHP_defineException('::Ice::VersionMismatchException', '\\Ice\\VersionMismatchException', false, null, null); + $Ice__t_VersionMismatchException = IcePHP_defineException('::Ice::VersionMismatchException', '\\Ice\\VersionMismatchException', null, null); } namespace Ice @@ -344,7 +344,7 @@ public function __toString(): string } } - $Ice__t_CommunicatorDestroyedException = IcePHP_defineException('::Ice::CommunicatorDestroyedException', '\\Ice\\CommunicatorDestroyedException', false, null, null); + $Ice__t_CommunicatorDestroyedException = IcePHP_defineException('::Ice::CommunicatorDestroyedException', '\\Ice\\CommunicatorDestroyedException', null, null); } namespace Ice @@ -372,7 +372,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_ObjectAdapterDeactivatedException = IcePHP_defineException('::Ice::ObjectAdapterDeactivatedException', '\\Ice\\ObjectAdapterDeactivatedException', false, null, array( + $Ice__t_ObjectAdapterDeactivatedException = IcePHP_defineException('::Ice::ObjectAdapterDeactivatedException', '\\Ice\\ObjectAdapterDeactivatedException', null, array( array('name', $IcePHP__t_string, false, 0))); } @@ -401,7 +401,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_ObjectAdapterIdInUseException = IcePHP_defineException('::Ice::ObjectAdapterIdInUseException', '\\Ice\\ObjectAdapterIdInUseException', false, null, array( + $Ice__t_ObjectAdapterIdInUseException = IcePHP_defineException('::Ice::ObjectAdapterIdInUseException', '\\Ice\\ObjectAdapterIdInUseException', null, array( array('id', $IcePHP__t_string, false, 0))); } @@ -430,7 +430,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_NoEndpointException = IcePHP_defineException('::Ice::NoEndpointException', '\\Ice\\NoEndpointException', false, null, array( + $Ice__t_NoEndpointException = IcePHP_defineException('::Ice::NoEndpointException', '\\Ice\\NoEndpointException', null, array( array('proxy', $IcePHP__t_string, false, 0))); } @@ -459,7 +459,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_EndpointParseException = IcePHP_defineException('::Ice::EndpointParseException', '\\Ice\\EndpointParseException', false, null, array( + $Ice__t_EndpointParseException = IcePHP_defineException('::Ice::EndpointParseException', '\\Ice\\EndpointParseException', null, array( array('str', $IcePHP__t_string, false, 0))); } @@ -488,7 +488,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_EndpointSelectionTypeParseException = IcePHP_defineException('::Ice::EndpointSelectionTypeParseException', '\\Ice\\EndpointSelectionTypeParseException', false, null, array( + $Ice__t_EndpointSelectionTypeParseException = IcePHP_defineException('::Ice::EndpointSelectionTypeParseException', '\\Ice\\EndpointSelectionTypeParseException', null, array( array('str', $IcePHP__t_string, false, 0))); } @@ -517,7 +517,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_VersionParseException = IcePHP_defineException('::Ice::VersionParseException', '\\Ice\\VersionParseException', false, null, array( + $Ice__t_VersionParseException = IcePHP_defineException('::Ice::VersionParseException', '\\Ice\\VersionParseException', null, array( array('str', $IcePHP__t_string, false, 0))); } @@ -546,7 +546,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_IdentityParseException = IcePHP_defineException('::Ice::IdentityParseException', '\\Ice\\IdentityParseException', false, null, array( + $Ice__t_IdentityParseException = IcePHP_defineException('::Ice::IdentityParseException', '\\Ice\\IdentityParseException', null, array( array('str', $IcePHP__t_string, false, 0))); } @@ -575,7 +575,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_ProxyParseException = IcePHP_defineException('::Ice::ProxyParseException', '\\Ice\\ProxyParseException', false, null, array( + $Ice__t_ProxyParseException = IcePHP_defineException('::Ice::ProxyParseException', '\\Ice\\ProxyParseException', null, array( array('str', $IcePHP__t_string, false, 0))); } @@ -600,7 +600,7 @@ public function __toString(): string } } - $Ice__t_IllegalIdentityException = IcePHP_defineException('::Ice::IllegalIdentityException', '\\Ice\\IllegalIdentityException', false, null, null); + $Ice__t_IllegalIdentityException = IcePHP_defineException('::Ice::IllegalIdentityException', '\\Ice\\IllegalIdentityException', null, null); } namespace Ice @@ -628,7 +628,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_IllegalServantException = IcePHP_defineException('::Ice::IllegalServantException', '\\Ice\\IllegalServantException', false, null, array( + $Ice__t_IllegalServantException = IcePHP_defineException('::Ice::IllegalServantException', '\\Ice\\IllegalServantException', null, array( array('reason', $IcePHP__t_string, false, 0))); } @@ -662,7 +662,7 @@ public function __toString(): string global $Ice__t_Identity; global $IcePHP__t_string; - $Ice__t_RequestFailedException = IcePHP_defineException('::Ice::RequestFailedException', '\\Ice\\RequestFailedException', false, null, array( + $Ice__t_RequestFailedException = IcePHP_defineException('::Ice::RequestFailedException', '\\Ice\\RequestFailedException', null, array( array('id', $Ice__t_Identity, false, 0), array('facet', $IcePHP__t_string, false, 0), array('operation', $IcePHP__t_string, false, 0))); @@ -690,7 +690,7 @@ public function __toString(): string } } - $Ice__t_ObjectNotExistException = IcePHP_defineException('::Ice::ObjectNotExistException', '\\Ice\\ObjectNotExistException', false, $Ice__t_RequestFailedException, null); + $Ice__t_ObjectNotExistException = IcePHP_defineException('::Ice::ObjectNotExistException', '\\Ice\\ObjectNotExistException', $Ice__t_RequestFailedException, null); } namespace Ice @@ -715,7 +715,7 @@ public function __toString(): string } } - $Ice__t_FacetNotExistException = IcePHP_defineException('::Ice::FacetNotExistException', '\\Ice\\FacetNotExistException', false, $Ice__t_RequestFailedException, null); + $Ice__t_FacetNotExistException = IcePHP_defineException('::Ice::FacetNotExistException', '\\Ice\\FacetNotExistException', $Ice__t_RequestFailedException, null); } namespace Ice @@ -740,7 +740,7 @@ public function __toString(): string } } - $Ice__t_OperationNotExistException = IcePHP_defineException('::Ice::OperationNotExistException', '\\Ice\\OperationNotExistException', false, $Ice__t_RequestFailedException, null); + $Ice__t_OperationNotExistException = IcePHP_defineException('::Ice::OperationNotExistException', '\\Ice\\OperationNotExistException', $Ice__t_RequestFailedException, null); } namespace Ice @@ -768,7 +768,7 @@ public function __toString(): string } global $IcePHP__t_int; - $Ice__t_SyscallException = IcePHP_defineException('::Ice::SyscallException', '\\Ice\\SyscallException', false, null, array( + $Ice__t_SyscallException = IcePHP_defineException('::Ice::SyscallException', '\\Ice\\SyscallException', null, array( array('error', $IcePHP__t_int, false, 0))); } @@ -794,7 +794,7 @@ public function __toString(): string } } - $Ice__t_SocketException = IcePHP_defineException('::Ice::SocketException', '\\Ice\\SocketException', false, $Ice__t_SyscallException, null); + $Ice__t_SocketException = IcePHP_defineException('::Ice::SocketException', '\\Ice\\SocketException', $Ice__t_SyscallException, null); } namespace Ice @@ -823,7 +823,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_CFNetworkException = IcePHP_defineException('::Ice::CFNetworkException', '\\Ice\\CFNetworkException', false, $Ice__t_SocketException, array( + $Ice__t_CFNetworkException = IcePHP_defineException('::Ice::CFNetworkException', '\\Ice\\CFNetworkException', $Ice__t_SocketException, array( array('domain', $IcePHP__t_string, false, 0))); } @@ -853,7 +853,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_FileException = IcePHP_defineException('::Ice::FileException', '\\Ice\\FileException', false, $Ice__t_SyscallException, array( + $Ice__t_FileException = IcePHP_defineException('::Ice::FileException', '\\Ice\\FileException', $Ice__t_SyscallException, array( array('path', $IcePHP__t_string, false, 0))); } @@ -879,7 +879,7 @@ public function __toString(): string } } - $Ice__t_ConnectFailedException = IcePHP_defineException('::Ice::ConnectFailedException', '\\Ice\\ConnectFailedException', false, $Ice__t_SocketException, null); + $Ice__t_ConnectFailedException = IcePHP_defineException('::Ice::ConnectFailedException', '\\Ice\\ConnectFailedException', $Ice__t_SocketException, null); } namespace Ice @@ -904,7 +904,7 @@ public function __toString(): string } } - $Ice__t_ConnectionRefusedException = IcePHP_defineException('::Ice::ConnectionRefusedException', '\\Ice\\ConnectionRefusedException', false, $Ice__t_ConnectFailedException, null); + $Ice__t_ConnectionRefusedException = IcePHP_defineException('::Ice::ConnectionRefusedException', '\\Ice\\ConnectionRefusedException', $Ice__t_ConnectFailedException, null); } namespace Ice @@ -929,7 +929,7 @@ public function __toString(): string } } - $Ice__t_ConnectionLostException = IcePHP_defineException('::Ice::ConnectionLostException', '\\Ice\\ConnectionLostException', false, $Ice__t_SocketException, null); + $Ice__t_ConnectionLostException = IcePHP_defineException('::Ice::ConnectionLostException', '\\Ice\\ConnectionLostException', $Ice__t_SocketException, null); } namespace Ice @@ -960,7 +960,7 @@ public function __toString(): string global $IcePHP__t_int; global $IcePHP__t_string; - $Ice__t_DNSException = IcePHP_defineException('::Ice::DNSException', '\\Ice\\DNSException', false, null, array( + $Ice__t_DNSException = IcePHP_defineException('::Ice::DNSException', '\\Ice\\DNSException', null, array( array('error', $IcePHP__t_int, false, 0), array('host', $IcePHP__t_string, false, 0))); } @@ -986,7 +986,7 @@ public function __toString(): string } } - $Ice__t_OperationInterruptedException = IcePHP_defineException('::Ice::OperationInterruptedException', '\\Ice\\OperationInterruptedException', false, null, null); + $Ice__t_OperationInterruptedException = IcePHP_defineException('::Ice::OperationInterruptedException', '\\Ice\\OperationInterruptedException', null, null); } namespace Ice @@ -1010,7 +1010,7 @@ public function __toString(): string } } - $Ice__t_TimeoutException = IcePHP_defineException('::Ice::TimeoutException', '\\Ice\\TimeoutException', false, null, null); + $Ice__t_TimeoutException = IcePHP_defineException('::Ice::TimeoutException', '\\Ice\\TimeoutException', null, null); } namespace Ice @@ -1035,7 +1035,7 @@ public function __toString(): string } } - $Ice__t_ConnectTimeoutException = IcePHP_defineException('::Ice::ConnectTimeoutException', '\\Ice\\ConnectTimeoutException', false, $Ice__t_TimeoutException, null); + $Ice__t_ConnectTimeoutException = IcePHP_defineException('::Ice::ConnectTimeoutException', '\\Ice\\ConnectTimeoutException', $Ice__t_TimeoutException, null); } namespace Ice @@ -1060,7 +1060,7 @@ public function __toString(): string } } - $Ice__t_CloseTimeoutException = IcePHP_defineException('::Ice::CloseTimeoutException', '\\Ice\\CloseTimeoutException', false, $Ice__t_TimeoutException, null); + $Ice__t_CloseTimeoutException = IcePHP_defineException('::Ice::CloseTimeoutException', '\\Ice\\CloseTimeoutException', $Ice__t_TimeoutException, null); } namespace Ice @@ -1085,7 +1085,7 @@ public function __toString(): string } } - $Ice__t_ConnectionTimeoutException = IcePHP_defineException('::Ice::ConnectionTimeoutException', '\\Ice\\ConnectionTimeoutException', false, $Ice__t_TimeoutException, null); + $Ice__t_ConnectionTimeoutException = IcePHP_defineException('::Ice::ConnectionTimeoutException', '\\Ice\\ConnectionTimeoutException', $Ice__t_TimeoutException, null); } namespace Ice @@ -1110,7 +1110,7 @@ public function __toString(): string } } - $Ice__t_InvocationTimeoutException = IcePHP_defineException('::Ice::InvocationTimeoutException', '\\Ice\\InvocationTimeoutException', false, $Ice__t_TimeoutException, null); + $Ice__t_InvocationTimeoutException = IcePHP_defineException('::Ice::InvocationTimeoutException', '\\Ice\\InvocationTimeoutException', $Ice__t_TimeoutException, null); } namespace Ice @@ -1134,7 +1134,7 @@ public function __toString(): string } } - $Ice__t_InvocationCanceledException = IcePHP_defineException('::Ice::InvocationCanceledException', '\\Ice\\InvocationCanceledException', false, null, null); + $Ice__t_InvocationCanceledException = IcePHP_defineException('::Ice::InvocationCanceledException', '\\Ice\\InvocationCanceledException', null, null); } namespace Ice @@ -1162,7 +1162,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_ProtocolException = IcePHP_defineException('::Ice::ProtocolException', '\\Ice\\ProtocolException', false, null, array( + $Ice__t_ProtocolException = IcePHP_defineException('::Ice::ProtocolException', '\\Ice\\ProtocolException', null, array( array('reason', $IcePHP__t_string, false, 0))); } @@ -1192,7 +1192,7 @@ public function __toString(): string } global $Ice__t_ByteSeq; - $Ice__t_BadMagicException = IcePHP_defineException('::Ice::BadMagicException', '\\Ice\\BadMagicException', false, $Ice__t_ProtocolException, array( + $Ice__t_BadMagicException = IcePHP_defineException('::Ice::BadMagicException', '\\Ice\\BadMagicException', $Ice__t_ProtocolException, array( array('badMagic', $Ice__t_ByteSeq, false, 0))); } @@ -1224,7 +1224,7 @@ public function __toString(): string } global $Ice__t_ProtocolVersion; - $Ice__t_UnsupportedProtocolException = IcePHP_defineException('::Ice::UnsupportedProtocolException', '\\Ice\\UnsupportedProtocolException', false, $Ice__t_ProtocolException, array( + $Ice__t_UnsupportedProtocolException = IcePHP_defineException('::Ice::UnsupportedProtocolException', '\\Ice\\UnsupportedProtocolException', $Ice__t_ProtocolException, array( array('bad', $Ice__t_ProtocolVersion, false, 0), array('supported', $Ice__t_ProtocolVersion, false, 0))); } @@ -1257,7 +1257,7 @@ public function __toString(): string } global $Ice__t_EncodingVersion; - $Ice__t_UnsupportedEncodingException = IcePHP_defineException('::Ice::UnsupportedEncodingException', '\\Ice\\UnsupportedEncodingException', false, $Ice__t_ProtocolException, array( + $Ice__t_UnsupportedEncodingException = IcePHP_defineException('::Ice::UnsupportedEncodingException', '\\Ice\\UnsupportedEncodingException', $Ice__t_ProtocolException, array( array('bad', $Ice__t_EncodingVersion, false, 0), array('supported', $Ice__t_EncodingVersion, false, 0))); } @@ -1284,7 +1284,7 @@ public function __toString(): string } } - $Ice__t_UnknownMessageException = IcePHP_defineException('::Ice::UnknownMessageException', '\\Ice\\UnknownMessageException', false, $Ice__t_ProtocolException, null); + $Ice__t_UnknownMessageException = IcePHP_defineException('::Ice::UnknownMessageException', '\\Ice\\UnknownMessageException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1309,7 +1309,7 @@ public function __toString(): string } } - $Ice__t_ConnectionNotValidatedException = IcePHP_defineException('::Ice::ConnectionNotValidatedException', '\\Ice\\ConnectionNotValidatedException', false, $Ice__t_ProtocolException, null); + $Ice__t_ConnectionNotValidatedException = IcePHP_defineException('::Ice::ConnectionNotValidatedException', '\\Ice\\ConnectionNotValidatedException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1334,7 +1334,7 @@ public function __toString(): string } } - $Ice__t_UnknownRequestIdException = IcePHP_defineException('::Ice::UnknownRequestIdException', '\\Ice\\UnknownRequestIdException', false, $Ice__t_ProtocolException, null); + $Ice__t_UnknownRequestIdException = IcePHP_defineException('::Ice::UnknownRequestIdException', '\\Ice\\UnknownRequestIdException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1359,7 +1359,7 @@ public function __toString(): string } } - $Ice__t_UnknownReplyStatusException = IcePHP_defineException('::Ice::UnknownReplyStatusException', '\\Ice\\UnknownReplyStatusException', false, $Ice__t_ProtocolException, null); + $Ice__t_UnknownReplyStatusException = IcePHP_defineException('::Ice::UnknownReplyStatusException', '\\Ice\\UnknownReplyStatusException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1384,7 +1384,7 @@ public function __toString(): string } } - $Ice__t_CloseConnectionException = IcePHP_defineException('::Ice::CloseConnectionException', '\\Ice\\CloseConnectionException', false, $Ice__t_ProtocolException, null); + $Ice__t_CloseConnectionException = IcePHP_defineException('::Ice::CloseConnectionException', '\\Ice\\CloseConnectionException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1412,7 +1412,7 @@ public function __toString(): string } global $IcePHP__t_bool; - $Ice__t_ConnectionManuallyClosedException = IcePHP_defineException('::Ice::ConnectionManuallyClosedException', '\\Ice\\ConnectionManuallyClosedException', false, null, array( + $Ice__t_ConnectionManuallyClosedException = IcePHP_defineException('::Ice::ConnectionManuallyClosedException', '\\Ice\\ConnectionManuallyClosedException', null, array( array('graceful', $IcePHP__t_bool, false, 0))); } @@ -1438,7 +1438,7 @@ public function __toString(): string } } - $Ice__t_IllegalMessageSizeException = IcePHP_defineException('::Ice::IllegalMessageSizeException', '\\Ice\\IllegalMessageSizeException', false, $Ice__t_ProtocolException, null); + $Ice__t_IllegalMessageSizeException = IcePHP_defineException('::Ice::IllegalMessageSizeException', '\\Ice\\IllegalMessageSizeException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1463,7 +1463,7 @@ public function __toString(): string } } - $Ice__t_CompressionException = IcePHP_defineException('::Ice::CompressionException', '\\Ice\\CompressionException', false, $Ice__t_ProtocolException, null); + $Ice__t_CompressionException = IcePHP_defineException('::Ice::CompressionException', '\\Ice\\CompressionException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1488,7 +1488,7 @@ public function __toString(): string } } - $Ice__t_DatagramLimitException = IcePHP_defineException('::Ice::DatagramLimitException', '\\Ice\\DatagramLimitException', false, $Ice__t_ProtocolException, null); + $Ice__t_DatagramLimitException = IcePHP_defineException('::Ice::DatagramLimitException', '\\Ice\\DatagramLimitException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1513,7 +1513,7 @@ public function __toString(): string } } - $Ice__t_MarshalException = IcePHP_defineException('::Ice::MarshalException', '\\Ice\\MarshalException', false, $Ice__t_ProtocolException, null); + $Ice__t_MarshalException = IcePHP_defineException('::Ice::MarshalException', '\\Ice\\MarshalException', $Ice__t_ProtocolException, null); } namespace Ice @@ -1538,7 +1538,7 @@ public function __toString(): string } } - $Ice__t_ProxyUnmarshalException = IcePHP_defineException('::Ice::ProxyUnmarshalException', '\\Ice\\ProxyUnmarshalException', false, $Ice__t_MarshalException, null); + $Ice__t_ProxyUnmarshalException = IcePHP_defineException('::Ice::ProxyUnmarshalException', '\\Ice\\ProxyUnmarshalException', $Ice__t_MarshalException, null); } namespace Ice @@ -1563,7 +1563,7 @@ public function __toString(): string } } - $Ice__t_UnmarshalOutOfBoundsException = IcePHP_defineException('::Ice::UnmarshalOutOfBoundsException', '\\Ice\\UnmarshalOutOfBoundsException', false, $Ice__t_MarshalException, null); + $Ice__t_UnmarshalOutOfBoundsException = IcePHP_defineException('::Ice::UnmarshalOutOfBoundsException', '\\Ice\\UnmarshalOutOfBoundsException', $Ice__t_MarshalException, null); } namespace Ice @@ -1592,7 +1592,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_NoValueFactoryException = IcePHP_defineException('::Ice::NoValueFactoryException', '\\Ice\\NoValueFactoryException', false, $Ice__t_MarshalException, array( + $Ice__t_NoValueFactoryException = IcePHP_defineException('::Ice::NoValueFactoryException', '\\Ice\\NoValueFactoryException', $Ice__t_MarshalException, array( array('type', $IcePHP__t_string, false, 0))); } @@ -1624,7 +1624,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_UnexpectedObjectException = IcePHP_defineException('::Ice::UnexpectedObjectException', '\\Ice\\UnexpectedObjectException', false, $Ice__t_MarshalException, array( + $Ice__t_UnexpectedObjectException = IcePHP_defineException('::Ice::UnexpectedObjectException', '\\Ice\\UnexpectedObjectException', $Ice__t_MarshalException, array( array('type', $IcePHP__t_string, false, 0), array('expectedType', $IcePHP__t_string, false, 0))); } @@ -1651,7 +1651,7 @@ public function __toString(): string } } - $Ice__t_MemoryLimitException = IcePHP_defineException('::Ice::MemoryLimitException', '\\Ice\\MemoryLimitException', false, $Ice__t_MarshalException, null); + $Ice__t_MemoryLimitException = IcePHP_defineException('::Ice::MemoryLimitException', '\\Ice\\MemoryLimitException', $Ice__t_MarshalException, null); } namespace Ice @@ -1676,7 +1676,7 @@ public function __toString(): string } } - $Ice__t_StringConversionException = IcePHP_defineException('::Ice::StringConversionException', '\\Ice\\StringConversionException', false, $Ice__t_MarshalException, null); + $Ice__t_StringConversionException = IcePHP_defineException('::Ice::StringConversionException', '\\Ice\\StringConversionException', $Ice__t_MarshalException, null); } namespace Ice @@ -1701,7 +1701,7 @@ public function __toString(): string } } - $Ice__t_EncapsulationException = IcePHP_defineException('::Ice::EncapsulationException', '\\Ice\\EncapsulationException', false, $Ice__t_MarshalException, null); + $Ice__t_EncapsulationException = IcePHP_defineException('::Ice::EncapsulationException', '\\Ice\\EncapsulationException', $Ice__t_MarshalException, null); } namespace Ice @@ -1729,7 +1729,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_FeatureNotSupportedException = IcePHP_defineException('::Ice::FeatureNotSupportedException', '\\Ice\\FeatureNotSupportedException', false, null, array( + $Ice__t_FeatureNotSupportedException = IcePHP_defineException('::Ice::FeatureNotSupportedException', '\\Ice\\FeatureNotSupportedException', null, array( array('unsupportedFeature', $IcePHP__t_string, false, 0))); } @@ -1758,7 +1758,7 @@ public function __toString(): string } global $IcePHP__t_string; - $Ice__t_SecurityException = IcePHP_defineException('::Ice::SecurityException', '\\Ice\\SecurityException', false, null, array( + $Ice__t_SecurityException = IcePHP_defineException('::Ice::SecurityException', '\\Ice\\SecurityException', null, array( array('reason', $IcePHP__t_string, false, 0))); } @@ -1783,7 +1783,7 @@ public function __toString(): string } } - $Ice__t_FixedProxyException = IcePHP_defineException('::Ice::FixedProxyException', '\\Ice\\FixedProxyException', false, null, null); + $Ice__t_FixedProxyException = IcePHP_defineException('::Ice::FixedProxyException', '\\Ice\\FixedProxyException', null, null); } namespace Ice @@ -1807,6 +1807,6 @@ public function __toString(): string } } - $Ice__t_ResponseSentException = IcePHP_defineException('::Ice::ResponseSentException', '\\Ice\\ResponseSentException', false, null, null); + $Ice__t_ResponseSentException = IcePHP_defineException('::Ice::ResponseSentException', '\\Ice\\ResponseSentException', null, null); } ?> diff --git a/php/lib/IceLocal/Logger.php b/php/lib/IceLocal/Logger.php index dabba94faef..0089d71d200 100644 --- a/php/lib/IceLocal/Logger.php +++ b/php/lib/IceLocal/Logger.php @@ -26,6 +26,6 @@ public function error($message); public function getPrefix(); public function cloneWithPrefix($prefix); } - $Ice__t_Logger = IcePHP_defineClass('::Ice::Logger', '\\Ice\\Logger', -1, false, true, null, null); + $Ice__t_Logger = IcePHP_defineClass('::Ice::Logger', '\\Ice\\Logger', -1, true, null, null); } ?> diff --git a/php/lib/IceLocal/ObjectAdapter.php b/php/lib/IceLocal/ObjectAdapter.php index 1d82d3fae42..6cfa4550f4b 100644 --- a/php/lib/IceLocal/ObjectAdapter.php +++ b/php/lib/IceLocal/ObjectAdapter.php @@ -64,6 +64,6 @@ public function refreshPublishedEndpoints(); public function getPublishedEndpoints(); public function setPublishedEndpoints($newEndpoints); } - $Ice__t_ObjectAdapter = IcePHP_defineClass('::Ice::ObjectAdapter', '\\Ice\\ObjectAdapter', -1, false, true, null, null); + $Ice__t_ObjectAdapter = IcePHP_defineClass('::Ice::ObjectAdapter', '\\Ice\\ObjectAdapter', -1, true, null, null); } ?> diff --git a/php/lib/IceLocal/ServantLocator.php b/php/lib/IceLocal/ServantLocator.php index 71436a394b4..40e603854b7 100644 --- a/php/lib/IceLocal/ServantLocator.php +++ b/php/lib/IceLocal/ServantLocator.php @@ -29,6 +29,6 @@ public function locate($curr, $cookie); public function finished($curr, $servant, $cookie); public function deactivate($category); } - $Ice__t_ServantLocator = IcePHP_defineClass('::Ice::ServantLocator', '\\Ice\\ServantLocator', -1, false, true, null, null); + $Ice__t_ServantLocator = IcePHP_defineClass('::Ice::ServantLocator', '\\Ice\\ServantLocator', -1, true, null, null); } ?> diff --git a/php/src/Init.cpp b/php/src/Init.cpp index 3df261df58f..c5b6758712d 100644 --- a/php/src/Init.cpp +++ b/php/src/Init.cpp @@ -32,11 +32,10 @@ ZEND_BEGIN_ARG_INFO_EX(Ice_declareClass_arginfo, 1, ZEND_RETURN_VALUE, static_ca ZEND_ARG_INFO(0, id) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(Ice_defineClass_arginfo, 1, ZEND_RETURN_VALUE, static_cast(7)) +ZEND_BEGIN_ARG_INFO_EX(Ice_defineClass_arginfo, 1, ZEND_RETURN_VALUE, static_cast(6)) ZEND_ARG_INFO(0, id) ZEND_ARG_INFO(0, name) ZEND_ARG_INFO(0, compactId) - ZEND_ARG_INFO(0, preserve) ZEND_ARG_INFO(0, interface) ZEND_ARG_INFO(0, base) ZEND_ARG_INFO(0, members) @@ -53,10 +52,9 @@ ZEND_BEGIN_ARG_INFO_EX(Ice_defineEnum_arginfo, 1, ZEND_RETURN_VALUE, static_cast ZEND_ARG_INFO(0, enumerators) ZEND_END_ARG_INFO() -ZEND_BEGIN_ARG_INFO_EX(Ice_defineException_arginfo, 1, ZEND_RETURN_VALUE, static_cast(5)) +ZEND_BEGIN_ARG_INFO_EX(Ice_defineException_arginfo, 1, ZEND_RETURN_VALUE, static_cast(4)) ZEND_ARG_INFO(0, id) ZEND_ARG_INFO(0, name) - ZEND_ARG_INFO(0, preserve) ZEND_ARG_INFO(0, base) ZEND_ARG_INFO(0, members) ZEND_END_ARG_INFO() diff --git a/php/src/Operation.cpp b/php/src/Operation.cpp index 4ef9b93cc93..c0dd5557589 100644 --- a/php/src/Operation.cpp +++ b/php/src/Operation.cpp @@ -591,13 +591,6 @@ IcePHP::TypedInvocation::unmarshalException(zval* zex, const pair(name) = n; const_cast(compactId) = static_cast(compact); - const_cast(preserve) = pres; const_cast(interface) = intf; if(b) @@ -2820,13 +2819,9 @@ IcePHP::ValueWriter::ice_preMarshal() void IcePHP::ValueWriter::_iceWrite(Ice::OutputStream* os) const { - Ice::SlicedDataPtr slicedData; - - if(_info && _info->preserve) - { - // Retrieve the SlicedData object that we stored as a hidden member of the PHP object. - slicedData = StreamUtil::getSlicedDataMember(const_cast(&_object), const_cast(_map)); - } + // Retrieve the SlicedData object that we stored as a hidden member of the PHP object. + Ice::SlicedDataPtr slicedData = + StreamUtil::getSlicedDataMember(const_cast(&_object), const_cast(_map)); os->startValue(slicedData); @@ -3006,7 +3001,7 @@ IcePHP::ValueReader::_iceRead(Ice::InputStream* is) } } - _slicedData = is->endValue(_info->preserve); + _slicedData = is->endValue(); if(_slicedData) { @@ -3292,7 +3287,7 @@ IcePHP::ExceptionReader::_read(Ice::InputStream* is) _info->unmarshal(is, _communicatorInfo, const_cast(&_ex)); - const_cast(_slicedData) = is->endException(_info->preserve); + is->endException(); } bool @@ -3313,12 +3308,6 @@ IcePHP::ExceptionReader::getException() const return const_cast(&_ex); } -Ice::SlicedDataPtr -IcePHP::ExceptionReader::getSlicedData() const -{ - return _slicedData; -} - static zend_object* handleTypeInfoAlloc(zend_class_entry* ce) { @@ -3505,13 +3494,12 @@ ZEND_FUNCTION(IcePHP_defineClass) char* name; size_t nameLen; zend_long compactId; - zend_bool preserve; zend_bool interface; zval* base; zval* members; - if(zend_parse_parameters(ZEND_NUM_ARGS(), const_cast("sslbbo!a!"), &id, &idLen, &name, &nameLen, - &compactId, &preserve, &interface, &base, &members) == FAILURE) + if(zend_parse_parameters(ZEND_NUM_ARGS(), const_cast("sslbo!a!"), &id, &idLen, &name, &nameLen, + &compactId, &interface, &base, &members) == FAILURE) { return; } @@ -3523,7 +3511,7 @@ ZEND_FUNCTION(IcePHP_defineClass) addClassInfoById(type); } - type->define(name, static_cast(compactId), preserve ? true : false, interface ? true : false, base, members); + type->define(name, static_cast(compactId), interface ? true : false, base, members); if(!interface) { @@ -3588,12 +3576,11 @@ ZEND_FUNCTION(IcePHP_defineException) size_t idLen; char* name; size_t nameLen; - zend_bool preserve; zval* base; zval* members; - if(zend_parse_parameters(ZEND_NUM_ARGS(), const_cast("ssbo!a!"), &id, &idLen, &name, &nameLen, - &preserve, &base, &members) == FAILURE) + if(zend_parse_parameters(ZEND_NUM_ARGS(), const_cast("sso!a!"), &id, &idLen, &name, &nameLen, + &base, &members) == FAILURE) { return; } @@ -3601,7 +3588,6 @@ ZEND_FUNCTION(IcePHP_defineException) auto ex = make_shared(); ex->id = id; ex->name = name; - ex->preserve = preserve ? true : false; if(base) { ex->base = Wrapper::value(base); diff --git a/php/src/Types.h b/php/src/Types.h index 1850e1e4279..2db23d6658a 100644 --- a/php/src/Types.h +++ b/php/src/Types.h @@ -402,7 +402,7 @@ class ClassInfo final : public TypeInfo ClassInfo(std::string); - void define(const std::string&, std::int32_t, bool, bool, zval*, zval*); + void define(const std::string&, std::int32_t, bool, zval*, zval*); std::string getId() const final; @@ -431,7 +431,6 @@ class ClassInfo final : public TypeInfo const std::string id; const std::string name; // PHP class name const std::int32_t compactId; - const bool preserve; const bool interface; ClassInfoPtr base; const DataMemberList members; @@ -499,7 +498,6 @@ class ExceptionInfo final : public std::enable_shared_from_this std::string id; std::string name; // PHP class name - bool preserve; ExceptionInfoPtr base; DataMemberList members; DataMemberList optionalMembers; @@ -591,8 +589,6 @@ class ExceptionReader final : public Ice::UserException zval* getException() const; - Ice::SlicedDataPtr getSlicedData() const; - protected: void _writeImpl(Ice::OutputStream*) const final {} @@ -603,7 +599,6 @@ class ExceptionReader final : public Ice::UserException CommunicatorInfoPtr _communicatorInfo; ExceptionInfoPtr _info; zval _ex; - Ice::SlicedDataPtr _slicedData; }; } // End of namespace IcePHP diff --git a/php/test/Ice/optional/Test.ice b/php/test/Ice/optional/Test.ice index f3ed574fbb5..9b3180295fb 100644 --- a/php/test/Ice/optional/Test.ice +++ b/php/test/Ice/optional/Test.ice @@ -115,7 +115,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/php/test/Ice/slicing/exceptions/Client.php b/php/test/Ice/slicing/exceptions/Client.php index 4a616d261bd..31da82071ef 100644 --- a/php/test/Ice/slicing/exceptions/Client.php +++ b/php/test/Ice/slicing/exceptions/Client.php @@ -233,89 +233,6 @@ function allTests($helper) } echo "ok\n"; - echo "unknown most derived in compact format... "; - flush(); - { - try - { - $test->unknownMostDerived2AsBaseCompact(); - test(false); - } - catch(Exception $b) - { - echo get_class($b); - if(get_class($b) == "Test\\Base") - { - // For the 1.0 encoding, the unknown exception is sliced to Base. - test($test->ice_getEncodingVersion() == $Ice_Encoding_1_0); - } - else if(get_class($b) == "Ice\\UnknownUserException") - { - // An UnkonwnUserException is raised for the compact format because the most-derived type is unknown - // and the exception cannot be sliced. - test($test->ice_getEncodingVersion() != $Ice_Encoding_1_0); - } - else - { - throw $b; - } - } - } - echo "ok\n"; - - echo "preserved exceptions... "; - flush(); - { - try - { - $test->knownPreservedAsBase(); - test(false); - } - catch(Test\KnownPreservedDerived $b) - { - test($b->b == "base"); - test($b->kp == "preserved"); - test($b->kpd == "derived"); - } - - try - { - $test->knownPreservedAsKnownPreserved(); - test(false); - } - catch(Test\KnownPreservedDerived $b) - { - test($b->b == "base"); - test($b->kp == "preserved"); - test($b->kpd == "derived"); - } - - try - { - $test->unknownPreservedAsBase(); - test(false); - } - catch(Test\KnownPreservedDerived $b) - { - test($b->b == "base"); - test($b->kp == "preserved"); - test($b->kpd == "derived"); - } - - try - { - $test->unknownPreservedAsKnownPreserved(); - test(false); - } - catch(Test\KnownPreservedDerived $b) - { - test($b->b == "base"); - test($b->kp == "preserved"); - test($b->kpd == "derived"); - } - } - echo "ok\n"; - return $test; } diff --git a/php/test/Ice/slicing/exceptions/Test.ice b/php/test/Ice/slicing/exceptions/Test.ice index a16c2319ea7..92cd9ecf6a6 100644 --- a/php/test/Ice/slicing/exceptions/Test.ice +++ b/php/test/Ice/slicing/exceptions/Test.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/php/test/Ice/slicing/objects/Client.php b/php/test/Ice/slicing/objects/Client.php index 6ce563c8c3d..89a195aa480 100644 --- a/php/test/Ice/slicing/objects/Client.php +++ b/php/test/Ice/slicing/objects/Client.php @@ -328,9 +328,19 @@ function allTests($helper) $b2 = $b1->pb; test($b2 != null); test($b2->sb == "D3.sb"); - test(get_class($b2) == "Test\B"); // Sliced by server test($b2->pb === $b1); // Object identity comparison - test(!($b2 instanceof Test\D3)); + + $p3 = $b2; + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(!($p3 instanceof Test\D3)); + } + else + { + test(($p3 instanceof Test\D3)); + test($p3->pd3 === $p1); + test($p3->sd3 == "D3.sd3"); + } test($b1 !== $d1); test($b1 !== $d3); @@ -365,8 +375,6 @@ function allTests($helper) test($b1 != null); test($b1->sb == "D3.sb"); - test(get_class($b1) == "Test\B"); // Sliced by server - test(!($b1 instanceof Test\D3)); $b2 = $b1->pb; test($b2 != null); @@ -378,6 +386,18 @@ function allTests($helper) test($p3->sd1 == "D1.sd1"); test($p3->pd1 === $b1); // Object identity comparison + $p1 = $b1; + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(!($p1 instanceof Test\D3)); + } + else + { + test(($p1 instanceof Test\D3)); + test($p1->pd3 === $b2); + test($p1->sd3 == "D3.sd3"); + } + test($b1 !== $d1); test($b1 !== $d3); test($b2 !== $d1); @@ -411,19 +431,30 @@ function allTests($helper) test($b1 != null); test($b1->sb == "D3.sb"); - test(get_class($b1) == "Test\B"); // Sliced by server - test(!($b1 instanceof Test\D3)); $b2 = $b1->pb; test($b2 != null); test($b2->sb == "D1.sb"); test(get_class($b2) == "Test\D1"); test($b2->pb === $b1); // Object identity comparison + $p3 = $b2; test($p3 instanceof Test\D1); test($p3->sd1 == "D1.sd1"); test($p3->pd1 === $b1); // Object identity comparison + $p1 = $b1; + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(!($p1 instanceof Test\D3)); + } + else + { + test(($p1 instanceof Test\D3)); + test($p1->pd3 === $b2); + test($p1->sd3 == "D3.sd3"); + } + test($b1 !== $d1); test($b1 !== $d3); test($b2 !== $d1); @@ -500,10 +531,27 @@ function allTests($helper) $r = $test->returnTest3($d3, $b2); test($r != null); - test(get_class($r) == "Test\B"); test($r->sb == "D3.sb"); test($r->pb === $r); + $p3 = $r; + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(!($p3 instanceof Test\D3)); + } + else + { + test(($p3 instanceof Test\D3)); + + test($p3->sb == "D3.sb"); + test($p3->pb === $r); + test($p3->sd3 == "D3.sd3"); + + test($p3->pd3->ice_id() == "::Test::B"); + test($p3->pd3->sb == "B.sb(1)"); + test($p3->pd3->pb === $p3->pd3); + } + // // Break cyclic dependencies - helps in detecting leaks. // @@ -537,7 +585,6 @@ function allTests($helper) $r = $test->returnTest3($d3, $d12); test($r != null); - test(get_class($r) == "Test\B"); test($r->sb == "D3.sb"); test($r->pb === $r); @@ -628,11 +675,20 @@ function allTests($helper) test(get_class($ss1b) == "Test\B"); test(get_class($ss1d1) == "Test\D1"); - test(get_class($ss1d3) == "Test\B"); test(get_class($ss2b) == "Test\B"); test(get_class($ss2d1) == "Test\D1"); - test(get_class($ss2d3) == "Test\B"); + + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(get_class($ss1d3) == "Test\B"); + test(get_class($ss2d3) == "Test\B"); + } + else + { + test(get_class($ss1d3) == "Test\D3"); + test(get_class($ss2d3) == "Test\D3"); + } // // Break cyclic dependencies - helps in detecting leaks. @@ -853,9 +909,19 @@ function allTests($helper) $pu->pu = "preserved"; $r = $test->exchangePBase($pu); - test(get_class($r) != "Test\\PCUnknown"); test($r->pi == 3); + $p2 = $r; + if($test->ice_getEncodingVersion() == $Ice_Encoding_1_0) + { + test(get_class($p2) != "Test\\PCUnknown"); + } + else + { + test(get_class($p2) == "Test\\PCUnknown"); + test($p2->pu == "preserved"); + } + // // Server only knows the intermediate type Preserved. The object will be sliced to // Preserved for the 1.0 encoding; otherwise it should be returned intact. diff --git a/php/test/Ice/slicing/objects/ClientPrivate.ice b/php/test/Ice/slicing/objects/ClientPrivate.ice index cd5e1ec84ea..b2a3f882931 100644 --- a/php/test/Ice/slicing/objects/ClientPrivate.ice +++ b/php/test/Ice/slicing/objects/ClientPrivate.ice @@ -15,7 +15,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/php/test/Ice/slicing/objects/Test.ice b/php/test/Ice/slicing/objects/Test.ice index b50a94d0c7a..f9efdaea22c 100644 --- a/php/test/Ice/slicing/objects/Test.ice +++ b/php/test/Ice/slicing/objects/Test.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -86,13 +85,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } diff --git a/python/modules/IcePy/Operation.cpp b/python/modules/IcePy/Operation.cpp index 260cdb3bc3e..61eede58f46 100644 --- a/python/modules/IcePy/Operation.cpp +++ b/python/modules/IcePy/Operation.cpp @@ -1601,14 +1601,6 @@ IcePy::Invocation::unmarshalException(const OperationPtr& op, const pair(compactId) = compact; - const_cast(preserve) = pres; const_cast(interface) = intf; if(b != Py_None) @@ -3518,15 +3517,10 @@ IcePy::ValueWriter::ice_preMarshal() void IcePy::ValueWriter::_iceWrite(Ice::OutputStream* os) const { - Ice::SlicedDataPtr slicedData; - - if(_info && _info->preserve) - { - // - // Retrieve the SlicedData object that we stored as a hidden member of the Python object. - // - slicedData = StreamUtil::getSlicedDataMember(_object, const_cast(_map)); - } + // + // Retrieve the SlicedData object that we stored as a hidden member of the Python object. + // + Ice::SlicedDataPtr slicedData = StreamUtil::getSlicedDataMember(_object, const_cast(_map)); os->startValue(slicedData); @@ -3693,7 +3687,7 @@ IcePy::ValueReader::_iceRead(Ice::InputStream* is) } } - _slicedData = is->endValue(_info->preserve); + _slicedData = is->endValue(); if(_slicedData) { @@ -3792,17 +3786,7 @@ IcePy::ExceptionInfo::marshal(PyObject* p, Ice::OutputStream* os, ObjectMap* obj throw AbortMarshaling(); } - Ice::SlicedDataPtr slicedData; - - if(preserve) - { - // - // Retrieve the SlicedData object that we stored as a hidden member of the Python object. - // - slicedData = StreamUtil::getSlicedDataMember(p, objectMap); - } - - os->startException(slicedData); + os->startException(); ExceptionInfoPtr info = shared_from_this(); while(info) @@ -4081,7 +4065,7 @@ IcePy::ExceptionReader::_read(Ice::InputStream* is) const_cast(_ex) = _info->unmarshal(is); - const_cast(_slicedData) = is->endException(_info->preserve); + is->endException(); } bool @@ -4096,12 +4080,6 @@ IcePy::ExceptionReader::getException() const return _ex.get(); } -Ice::SlicedDataPtr -IcePy::ExceptionReader::getSlicedData() const -{ - return _slicedData; -} - // // IdResolver // @@ -4727,12 +4705,10 @@ IcePy_defineValue(PyObject*, PyObject* args) PyObject* type; int compactId; PyObject* meta; // Not currently used. - int preserve; int interface; PyObject* base; PyObject* members; - if(!PyArg_ParseTuple(args, STRCAST("sOiOiiOO"), &id, &type, &compactId, &meta, &preserve, &interface, &base, - &members)) + if(!PyArg_ParseTuple(args, STRCAST("sOiOiOO"), &id, &type, &compactId, &meta, &interface, &base, &members)) { return 0; } @@ -4760,7 +4736,7 @@ IcePy_defineValue(PyObject*, PyObject* args) r = info->typeObj; } - info->define(type, compactId, preserve ? true : false, interface ? true : false, base, members); + info->define(type, compactId, interface ? true : false, base, members); if(info->compactId != -1) { @@ -4782,10 +4758,9 @@ IcePy_defineException(PyObject*, PyObject* args) char* id; PyObject* type; PyObject* meta; - int preserve; PyObject* base; PyObject* members; - if(!PyArg_ParseTuple(args, STRCAST("sOOiOO"), &id, &type, &meta, &preserve, &base, &members)) + if(!PyArg_ParseTuple(args, STRCAST("sOOOO"), &id, &type, &meta, &base, &members)) { return 0; } @@ -4797,8 +4772,6 @@ IcePy_defineException(PyObject*, PyObject* args) ExceptionInfoPtr info = make_shared(); info->id = id; - info->preserve = preserve ? true : false; - if(base != Py_None) { info->base = dynamic_pointer_cast(getException(base)); diff --git a/python/modules/IcePy/Types.h b/python/modules/IcePy/Types.h index 285bc7f82cc..b3015b466f8 100644 --- a/python/modules/IcePy/Types.h +++ b/python/modules/IcePy/Types.h @@ -501,7 +501,7 @@ class ValueInfo final : public TypeInfo, public std::enable_shared_from_this void printMembers(PyObject*, IceUtilInternal::Output&, PrintObjectHistory*); std::string id; - bool preserve; ExceptionInfoPtr base; DataMemberList members; DataMemberList optionalMembers; @@ -702,8 +700,6 @@ class ExceptionReader : public Ice::UserException PyObject* getException() const; // Borrowed reference. - Ice::SlicedDataPtr getSlicedData() const; - protected: virtual void _writeImpl(Ice::OutputStream*) const {} @@ -713,7 +709,6 @@ class ExceptionReader : public Ice::UserException ExceptionInfoPtr _info; PyObjectHandle _ex; - Ice::SlicedDataPtr _slicedData; }; std::string resolveCompactId(std::int32_t id); diff --git a/python/python/Ice/Communicator_local.py b/python/python/Ice/Communicator_local.py index f6626b2d0e0..f2bdac06aa6 100644 --- a/python/python/Ice/Communicator_local.py +++ b/python/python/Ice/Communicator_local.py @@ -344,7 +344,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_Communicator = IcePy.defineValue( - "::Ice::Communicator", Communicator, -1, (), False, True, None, () + "::Ice::Communicator", Communicator, -1, (), True, None, () ) Communicator._ice_type = _M_Ice._t_Communicator diff --git a/python/python/Ice/Connection_local.py b/python/python/Ice/Connection_local.py index c21f6d054eb..1b5cf1158b8 100644 --- a/python/python/Ice/Connection_local.py +++ b/python/python/Ice/Connection_local.py @@ -98,7 +98,6 @@ def __str__(self): -1, (), False, - False, None, ( ("underlying", (), _M_Ice._t_ConnectionInfo, False, 0), @@ -142,7 +141,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_CloseCallback = IcePy.defineValue( - "::Ice::CloseCallback", CloseCallback, -1, (), False, True, None, () + "::Ice::CloseCallback", CloseCallback, -1, (), True, None, () ) CloseCallback._ice_type = _M_Ice._t_CloseCallback @@ -176,7 +175,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_HeartbeatCallback = IcePy.defineValue( - "::Ice::HeartbeatCallback", HeartbeatCallback, -1, (), False, True, None, () + "::Ice::HeartbeatCallback", HeartbeatCallback, -1, (), True, None, () ) HeartbeatCallback._ice_type = _M_Ice._t_HeartbeatCallback @@ -591,7 +590,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_Connection = IcePy.defineValue( - "::Ice::Connection", Connection, -1, (), False, True, None, () + "::Ice::Connection", Connection, -1, (), True, None, () ) Connection._ice_type = _M_Ice._t_Connection @@ -643,7 +642,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_ConnectionInfo, ( ("localAddress", (), IcePy._t_string, False, 0), @@ -708,7 +706,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_IPConnectionInfo, ( ("rcvSize", (), IcePy._t_int, False, 0), @@ -777,7 +774,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_IPConnectionInfo, ( ("mcastAddress", (), IcePy._t_string, False, 0), @@ -832,7 +828,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_ConnectionInfo, (("headers", (), _M_Ice._t_HeaderDict, False, 0),), ) diff --git a/python/python/Ice/Endpoint_local.py b/python/python/Ice/Endpoint_local.py index a977662489b..071da4a45bc 100644 --- a/python/python/Ice/Endpoint_local.py +++ b/python/python/Ice/Endpoint_local.py @@ -78,7 +78,6 @@ def __str__(self): -1, (), False, - False, None, ( ("underlying", (), _M_Ice._t_EndpointInfo, False, 0), @@ -123,7 +122,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_Endpoint = IcePy.defineValue( - "::Ice::Endpoint", Endpoint, -1, (), False, True, None, () + "::Ice::Endpoint", Endpoint, -1, (), True, None, () ) Endpoint._ice_type = _M_Ice._t_Endpoint @@ -171,7 +170,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_EndpointInfo, ( ("host", (), IcePy._t_string, False, 0), @@ -220,7 +218,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_IPEndpointInfo, (), ) @@ -272,7 +269,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_IPEndpointInfo, ( ("mcastInterface", (), IcePy._t_string, False, 0), @@ -313,7 +309,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_EndpointInfo, (("resource", (), IcePy._t_string, False, 0),), ) @@ -363,7 +358,6 @@ def __str__(self): -1, (), False, - False, _M_Ice._t_EndpointInfo, ( ("rawEncoding", (), _M_Ice._t_EncodingVersion, False, 0), diff --git a/python/python/Ice/ImplicitContext_local.py b/python/python/Ice/ImplicitContext_local.py index fb3c4f95c78..abad64352f3 100644 --- a/python/python/Ice/ImplicitContext_local.py +++ b/python/python/Ice/ImplicitContext_local.py @@ -113,7 +113,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ImplicitContext = IcePy.defineValue( - "::Ice::ImplicitContext", ImplicitContext, -1, (), False, True, None, () + "::Ice::ImplicitContext", ImplicitContext, -1, (), True, None, () ) ImplicitContext._ice_type = _M_Ice._t_ImplicitContext diff --git a/python/python/Ice/Instrumentation_local.py b/python/python/Ice/Instrumentation_local.py index ab92c6988aa..f35ee6242c6 100644 --- a/python/python/Ice/Instrumentation_local.py +++ b/python/python/Ice/Instrumentation_local.py @@ -74,7 +74,7 @@ def __str__(self): __repr__ = __str__ _M_Ice.Instrumentation._t_Observer = IcePy.defineValue( - "::Ice::Instrumentation::Observer", Observer, -1, (), False, True, None, () + "::Ice::Instrumentation::Observer", Observer, -1, (), True, None, () ) Observer._ice_type = _M_Ice.Instrumentation._t_Observer @@ -158,7 +158,6 @@ def __str__(self): ThreadObserver, -1, (), - False, True, None, (), @@ -262,7 +261,6 @@ def __str__(self): ConnectionObserver, -1, (), - False, True, None, (), @@ -310,7 +308,6 @@ def __str__(self): DispatchObserver, -1, (), - False, True, None, (), @@ -354,7 +351,6 @@ def __str__(self): ChildInvocationObserver, -1, (), - False, True, None, (), @@ -390,7 +386,6 @@ def __str__(self): RemoteObserver, -1, (), - False, True, None, (), @@ -424,7 +419,6 @@ def __str__(self): CollocatedObserver, -1, (), - False, True, None, (), @@ -494,7 +488,6 @@ def __str__(self): InvocationObserver, -1, (), - False, True, None, (), @@ -554,7 +547,6 @@ def __str__(self): ObserverUpdater, -1, (), - False, True, None, (), @@ -677,7 +669,6 @@ def __str__(self): CommunicatorObserver, -1, (), - False, True, None, (), diff --git a/python/python/Ice/LocalException_local.py b/python/python/Ice/LocalException_local.py index abdcfca7093..be2b4c13d90 100644 --- a/python/python/Ice/LocalException_local.py +++ b/python/python/Ice/LocalException_local.py @@ -50,7 +50,6 @@ def __str__(self): "::Ice::InitializationException", InitializationException, (), - False, None, (("reason", (), IcePy._t_string, False, 0),), ) @@ -83,7 +82,6 @@ def __str__(self): "::Ice::PluginInitializationException", PluginInitializationException, (), - False, None, (("reason", (), IcePy._t_string, False, 0),), ) @@ -114,7 +112,6 @@ def __str__(self): "::Ice::CollocationOptimizationException", CollocationOptimizationException, (), - False, None, (), ) @@ -154,7 +151,6 @@ def __str__(self): "::Ice::AlreadyRegisteredException", AlreadyRegisteredException, (), - False, None, ( ("kindOfObject", (), IcePy._t_string, False, 0), @@ -197,7 +193,6 @@ def __str__(self): "::Ice::NotRegisteredException", NotRegisteredException, (), - False, None, ( ("kindOfObject", (), IcePy._t_string, False, 0), @@ -235,7 +230,6 @@ def __str__(self): "::Ice::TwowayOnlyException", TwowayOnlyException, (), - False, None, (("operation", (), IcePy._t_string, False, 0),), ) @@ -269,7 +263,6 @@ def __str__(self): "::Ice::CloneNotImplementedException", CloneNotImplementedException, (), - False, None, (), ) @@ -304,7 +297,6 @@ def __str__(self): "::Ice::UnknownException", UnknownException, (), - False, None, (("unknown", (), IcePy._t_string, False, 0),), ) @@ -339,7 +331,6 @@ def __str__(self): "::Ice::UnknownLocalException", UnknownLocalException, (), - False, _M_Ice._t_UnknownException, (), ) @@ -374,7 +365,6 @@ def __str__(self): "::Ice::UnknownUserException", UnknownUserException, (), - False, _M_Ice._t_UnknownException, (), ) @@ -402,7 +392,7 @@ def __str__(self): _ice_id = "::Ice::VersionMismatchException" _M_Ice._t_VersionMismatchException = IcePy.defineException( - "::Ice::VersionMismatchException", VersionMismatchException, (), False, None, () + "::Ice::VersionMismatchException", VersionMismatchException, (), None, () ) VersionMismatchException._ice_type = _M_Ice._t_VersionMismatchException @@ -431,7 +421,6 @@ def __str__(self): "::Ice::CommunicatorDestroyedException", CommunicatorDestroyedException, (), - False, None, (), ) @@ -464,7 +453,6 @@ def __str__(self): "::Ice::ObjectAdapterDeactivatedException", ObjectAdapterDeactivatedException, (), - False, None, (("name", (), IcePy._t_string, False, 0),), ) @@ -500,7 +488,6 @@ def __str__(self): "::Ice::ObjectAdapterIdInUseException", ObjectAdapterIdInUseException, (), - False, None, (("id", (), IcePy._t_string, False, 0),), ) @@ -533,7 +520,6 @@ def __str__(self): "::Ice::NoEndpointException", NoEndpointException, (), - False, None, (("proxy", (), IcePy._t_string, False, 0),), ) @@ -566,7 +552,6 @@ def __str__(self): "::Ice::EndpointParseException", EndpointParseException, (), - False, None, (("str", (), IcePy._t_string, False, 0),), ) @@ -599,7 +584,6 @@ def __str__(self): "::Ice::EndpointSelectionTypeParseException", EndpointSelectionTypeParseException, (), - False, None, (("str", (), IcePy._t_string, False, 0),), ) @@ -634,7 +618,6 @@ def __str__(self): "::Ice::VersionParseException", VersionParseException, (), - False, None, (("str", (), IcePy._t_string, False, 0),), ) @@ -667,7 +650,6 @@ def __str__(self): "::Ice::IdentityParseException", IdentityParseException, (), - False, None, (("str", (), IcePy._t_string, False, 0),), ) @@ -700,7 +682,6 @@ def __str__(self): "::Ice::ProxyParseException", ProxyParseException, (), - False, None, (("str", (), IcePy._t_string, False, 0),), ) @@ -731,7 +712,6 @@ def __str__(self): "::Ice::IllegalIdentityException", IllegalIdentityException, (), - False, None, (), ) @@ -764,7 +744,6 @@ def __str__(self): "::Ice::IllegalServantException", IllegalServantException, (), - False, None, (("reason", (), IcePy._t_string, False, 0),), ) @@ -806,7 +785,6 @@ def __str__(self): "::Ice::RequestFailedException", RequestFailedException, (), - False, None, ( ("id", (), _M_Ice._t_Identity, False, 0), @@ -842,7 +820,6 @@ def __str__(self): "::Ice::ObjectNotExistException", ObjectNotExistException, (), - False, _M_Ice._t_RequestFailedException, (), ) @@ -874,7 +851,6 @@ def __str__(self): "::Ice::FacetNotExistException", FacetNotExistException, (), - False, _M_Ice._t_RequestFailedException, (), ) @@ -906,7 +882,6 @@ def __str__(self): "::Ice::OperationNotExistException", OperationNotExistException, (), - False, _M_Ice._t_RequestFailedException, (), ) @@ -942,7 +917,6 @@ def __str__(self): "::Ice::SyscallException", SyscallException, (), - False, None, (("error", (), IcePy._t_int, False, 0),), ) @@ -973,7 +947,6 @@ def __str__(self): "::Ice::SocketException", SocketException, (), - False, _M_Ice._t_SyscallException, (), ) @@ -1007,7 +980,6 @@ def __str__(self): "::Ice::CFNetworkException", CFNetworkException, (), - False, _M_Ice._t_SocketException, (("domain", (), IcePy._t_string, False, 0),), ) @@ -1041,7 +1013,6 @@ def __str__(self): "::Ice::FileException", FileException, (), - False, _M_Ice._t_SyscallException, (("path", (), IcePy._t_string, False, 0),), ) @@ -1072,7 +1043,6 @@ def __str__(self): "::Ice::ConnectFailedException", ConnectFailedException, (), - False, _M_Ice._t_SocketException, (), ) @@ -1103,7 +1073,6 @@ def __str__(self): "::Ice::ConnectionRefusedException", ConnectionRefusedException, (), - False, _M_Ice._t_ConnectFailedException, (), ) @@ -1134,7 +1103,6 @@ def __str__(self): "::Ice::ConnectionLostException", ConnectionLostException, (), - False, _M_Ice._t_SocketException, (), ) @@ -1170,7 +1138,6 @@ def __str__(self): "::Ice::DNSException", DNSException, (), - False, None, ( ("error", (), IcePy._t_int, False, 0), @@ -1204,7 +1171,6 @@ def __str__(self): "::Ice::OperationInterruptedException", OperationInterruptedException, (), - False, None, (), ) @@ -1232,7 +1198,7 @@ def __str__(self): _ice_id = "::Ice::TimeoutException" _M_Ice._t_TimeoutException = IcePy.defineException( - "::Ice::TimeoutException", TimeoutException, (), False, None, () + "::Ice::TimeoutException", TimeoutException, (), None, () ) TimeoutException._ice_type = _M_Ice._t_TimeoutException @@ -1261,7 +1227,6 @@ def __str__(self): "::Ice::ConnectTimeoutException", ConnectTimeoutException, (), - False, _M_Ice._t_TimeoutException, (), ) @@ -1292,7 +1257,6 @@ def __str__(self): "::Ice::CloseTimeoutException", CloseTimeoutException, (), - False, _M_Ice._t_TimeoutException, (), ) @@ -1323,7 +1287,6 @@ def __str__(self): "::Ice::ConnectionTimeoutException", ConnectionTimeoutException, (), - False, _M_Ice._t_TimeoutException, (), ) @@ -1354,7 +1317,6 @@ def __str__(self): "::Ice::InvocationTimeoutException", InvocationTimeoutException, (), - False, _M_Ice._t_TimeoutException, (), ) @@ -1385,7 +1347,6 @@ def __str__(self): "::Ice::InvocationCanceledException", InvocationCanceledException, (), - False, None, (), ) @@ -1418,7 +1379,6 @@ def __str__(self): "::Ice::ProtocolException", ProtocolException, (), - False, None, (("reason", (), IcePy._t_string, False, 0),), ) @@ -1452,7 +1412,6 @@ def __str__(self): "::Ice::BadMagicException", BadMagicException, (), - False, _M_Ice._t_ProtocolException, (("badMagic", (), _M_Ice._t_ByteSeq, False, 0),), ) @@ -1496,7 +1455,6 @@ def __str__(self): "::Ice::UnsupportedProtocolException", UnsupportedProtocolException, (), - False, _M_Ice._t_ProtocolException, ( ("bad", (), _M_Ice._t_ProtocolVersion, False, 0), @@ -1543,7 +1501,6 @@ def __str__(self): "::Ice::UnsupportedEncodingException", UnsupportedEncodingException, (), - False, _M_Ice._t_ProtocolException, ( ("bad", (), _M_Ice._t_EncodingVersion, False, 0), @@ -1577,7 +1534,6 @@ def __str__(self): "::Ice::UnknownMessageException", UnknownMessageException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1608,7 +1564,6 @@ def __str__(self): "::Ice::ConnectionNotValidatedException", ConnectionNotValidatedException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1641,7 +1596,6 @@ def __str__(self): "::Ice::UnknownRequestIdException", UnknownRequestIdException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1672,7 +1626,6 @@ def __str__(self): "::Ice::UnknownReplyStatusException", UnknownReplyStatusException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1707,7 +1660,6 @@ def __str__(self): "::Ice::CloseConnectionException", CloseConnectionException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1741,7 +1693,6 @@ def __str__(self): "::Ice::ConnectionManuallyClosedException", ConnectionManuallyClosedException, (), - False, None, (("graceful", (), IcePy._t_bool, False, 0),), ) @@ -1774,7 +1725,6 @@ def __str__(self): "::Ice::IllegalMessageSizeException", IllegalMessageSizeException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1805,7 +1755,6 @@ def __str__(self): "::Ice::CompressionException", CompressionException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1837,7 +1786,6 @@ def __str__(self): "::Ice::DatagramLimitException", DatagramLimitException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1868,7 +1816,6 @@ def __str__(self): "::Ice::MarshalException", MarshalException, (), - False, _M_Ice._t_ProtocolException, (), ) @@ -1899,7 +1846,6 @@ def __str__(self): "::Ice::ProxyUnmarshalException", ProxyUnmarshalException, (), - False, _M_Ice._t_MarshalException, (), ) @@ -1930,7 +1876,6 @@ def __str__(self): "::Ice::UnmarshalOutOfBoundsException", UnmarshalOutOfBoundsException, (), - False, _M_Ice._t_MarshalException, (), ) @@ -1964,7 +1909,6 @@ def __str__(self): "::Ice::NoValueFactoryException", NoValueFactoryException, (), - False, _M_Ice._t_MarshalException, (("type", (), IcePy._t_string, False, 0),), ) @@ -2003,7 +1947,6 @@ def __str__(self): "::Ice::UnexpectedObjectException", UnexpectedObjectException, (), - False, _M_Ice._t_MarshalException, ( ("type", (), IcePy._t_string, False, 0), @@ -2038,7 +1981,6 @@ def __str__(self): "::Ice::MemoryLimitException", MemoryLimitException, (), - False, _M_Ice._t_MarshalException, (), ) @@ -2069,7 +2011,6 @@ def __str__(self): "::Ice::StringConversionException", StringConversionException, (), - False, _M_Ice._t_MarshalException, (), ) @@ -2100,7 +2041,6 @@ def __str__(self): "::Ice::EncapsulationException", EncapsulationException, (), - False, _M_Ice._t_MarshalException, (), ) @@ -2134,7 +2074,6 @@ def __str__(self): "::Ice::FeatureNotSupportedException", FeatureNotSupportedException, (), - False, None, (("unsupportedFeature", (), IcePy._t_string, False, 0),), ) @@ -2167,7 +2106,6 @@ def __str__(self): "::Ice::SecurityException", SecurityException, (), - False, None, (("reason", (), IcePy._t_string, False, 0),), ) @@ -2195,7 +2133,7 @@ def __str__(self): _ice_id = "::Ice::FixedProxyException" _M_Ice._t_FixedProxyException = IcePy.defineException( - "::Ice::FixedProxyException", FixedProxyException, (), False, None, () + "::Ice::FixedProxyException", FixedProxyException, (), None, () ) FixedProxyException._ice_type = _M_Ice._t_FixedProxyException @@ -2221,7 +2159,7 @@ def __str__(self): _ice_id = "::Ice::ResponseSentException" _M_Ice._t_ResponseSentException = IcePy.defineException( - "::Ice::ResponseSentException", ResponseSentException, (), False, None, () + "::Ice::ResponseSentException", ResponseSentException, (), None, () ) ResponseSentException._ice_type = _M_Ice._t_ResponseSentException diff --git a/python/python/Ice/Logger_local.py b/python/python/Ice/Logger_local.py index 330b40b1d2c..a031283a332 100644 --- a/python/python/Ice/Logger_local.py +++ b/python/python/Ice/Logger_local.py @@ -90,7 +90,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_Logger = IcePy.defineValue( - "::Ice::Logger", Logger, -1, (), False, True, None, () + "::Ice::Logger", Logger, -1, (), True, None, () ) Logger._ice_type = _M_Ice._t_Logger diff --git a/python/python/Ice/ObjectAdapter_local.py b/python/python/Ice/ObjectAdapter_local.py index 485a1cf43f4..74e9a4e85dd 100644 --- a/python/python/Ice/ObjectAdapter_local.py +++ b/python/python/Ice/ObjectAdapter_local.py @@ -403,7 +403,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ObjectAdapter = IcePy.defineValue( - "::Ice::ObjectAdapter", ObjectAdapter, -1, (), False, True, None, () + "::Ice::ObjectAdapter", ObjectAdapter, -1, (), True, None, () ) ObjectAdapter._ice_type = _M_Ice._t_ObjectAdapter diff --git a/python/python/Ice/Plugin_local.py b/python/python/Ice/Plugin_local.py index ad61cde8ae3..eb322712a6b 100644 --- a/python/python/Ice/Plugin_local.py +++ b/python/python/Ice/Plugin_local.py @@ -57,7 +57,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_Plugin = IcePy.defineValue( - "::Ice::Plugin", Plugin, -1, (), False, True, None, () + "::Ice::Plugin", Plugin, -1, (), True, None, () ) Plugin._ice_type = _M_Ice._t_Plugin @@ -129,7 +129,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_PluginManager = IcePy.defineValue( - "::Ice::PluginManager", PluginManager, -1, (), False, True, None, () + "::Ice::PluginManager", PluginManager, -1, (), True, None, () ) PluginManager._ice_type = _M_Ice._t_PluginManager diff --git a/python/python/Ice/Properties_local.py b/python/python/Ice/Properties_local.py index 7f0c8380270..ce6b5988b68 100644 --- a/python/python/Ice/Properties_local.py +++ b/python/python/Ice/Properties_local.py @@ -183,7 +183,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_Properties = IcePy.defineValue( - "::Ice::Properties", Properties, -1, (), False, True, None, () + "::Ice::Properties", Properties, -1, (), True, None, () ) Properties._ice_type = _M_Ice._t_Properties diff --git a/python/python/Ice/ServantLocator_local.py b/python/python/Ice/ServantLocator_local.py index c928ef32a49..72b11e90b53 100644 --- a/python/python/Ice/ServantLocator_local.py +++ b/python/python/Ice/ServantLocator_local.py @@ -92,7 +92,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ServantLocator = IcePy.defineValue( - "::Ice::ServantLocator", ServantLocator, -1, (), False, True, None, () + "::Ice::ServantLocator", ServantLocator, -1, (), True, None, () ) ServantLocator._ice_type = _M_Ice._t_ServantLocator diff --git a/python/python/Ice/ValueFactory_local.py b/python/python/Ice/ValueFactory_local.py index cdb788ccb55..80f0a29e885 100644 --- a/python/python/Ice/ValueFactory_local.py +++ b/python/python/Ice/ValueFactory_local.py @@ -53,7 +53,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ValueFactory = IcePy.defineValue( - "::Ice::ValueFactory", ValueFactory, -1, (), False, True, None, () + "::Ice::ValueFactory", ValueFactory, -1, (), True, None, () ) ValueFactory._ice_type = _M_Ice._t_ValueFactory @@ -112,7 +112,7 @@ def __str__(self): __repr__ = __str__ _M_Ice._t_ValueFactoryManager = IcePy.defineValue( - "::Ice::ValueFactoryManager", ValueFactoryManager, -1, (), False, True, None, () + "::Ice::ValueFactoryManager", ValueFactoryManager, -1, (), True, None, () ) ValueFactoryManager._ice_type = _M_Ice._t_ValueFactoryManager diff --git a/python/python/Ice/__init__.py b/python/python/Ice/__init__.py index 6ec37e32050..0c95e796101 100644 --- a/python/python/Ice/__init__.py +++ b/python/python/Ice/__init__.py @@ -1933,7 +1933,7 @@ def _callbackOnInterruptCallback(self, sig): # IcePy._t_Object = IcePy.defineClass("::Ice::Object", Object, (), None, ()) IcePy._t_Value = IcePy.defineValue( - "::Ice::Object", Value, -1, (), False, False, None, () + "::Ice::Object", Value, -1, (), False, None, () ) IcePy._t_ObjectPrx = IcePy.defineProxy("::Ice::Object", ObjectPrx) Object._ice_type = IcePy._t_Object @@ -1988,11 +1988,11 @@ def _callbackOnInterruptCallback(self, sig): ) IcePy._t_LocalObject = IcePy.defineValue( - "::Ice::LocalObject", object, -1, (), False, False, None, () + "::Ice::LocalObject", object, -1, (), False, None, () ) IcePy._t_UnknownSlicedValue = IcePy.defineValue( - "::Ice::UnknownSlicedValue", UnknownSlicedValue, -1, (), True, False, None, () + "::Ice::UnknownSlicedValue", UnknownSlicedValue, -1, (), False, None, () ) UnknownSlicedValue._ice_type = IcePy._t_UnknownSlicedValue diff --git a/python/test/Ice/optional/Test.ice b/python/test/Ice/optional/Test.ice index 3a3031c0cd5..73e35dfe6a7 100644 --- a/python/test/Ice/optional/Test.ice +++ b/python/test/Ice/optional/Test.ice @@ -115,7 +115,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/python/test/Ice/slicing/exceptions/AllTests.py b/python/test/Ice/slicing/exceptions/AllTests.py index d7baf826485..63c83e13554 100644 --- a/python/test/Ice/slicing/exceptions/AllTests.py +++ b/python/test/Ice/slicing/exceptions/AllTests.py @@ -7,7 +7,7 @@ import threading import sys -Ice.loadSlice("-I. --all ClientPrivate.ice") +Ice.loadSlice("-I. --all Test.ice") import Test @@ -190,40 +190,6 @@ def exception_unknownMostDerived2AsBase(self, f): self.called() -class RelayI(Test.Relay): - def knownPreservedAsBase(self, current=None): - ex = Test.KnownPreservedDerived() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - raise ex - - def knownPreservedAsKnownPreserved(self, current=None): - ex = Test.KnownPreservedDerived() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - raise ex - - def unknownPreservedAsBase(self, current=None): - ex = Test.Preserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = Test.PreservedClass("bc", "pc") - ex.p2 = ex.p1 - raise ex - - def unknownPreservedAsKnownPreserved(self, current=None): - ex = Test.Preserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = Test.PreservedClass("bc", "pc") - ex.p2 = ex.p1 - raise ex - - def allTests(helper, communicator): obj = communicator.stringToProxy("Test:{0}".format(helper.getTestEndpoint())) t = Test.TestIntfPrx.checkedCast(obj) @@ -517,140 +483,4 @@ def allTests(helper, communicator): cb.check() print("ok") - sys.stdout.write("unknown most derived in compact format... ") - sys.stdout.flush() - try: - t.unknownMostDerived2AsBaseCompact() - test(False) - except Test.Base: - # - # For the 1.0 encoding, the unknown exception is sliced to Base. - # - test(t.ice_getEncodingVersion() == Ice.Encoding_1_0) - except Ice.UnknownUserException: - # - # An UnkownUserException is raised for the compact format because the - # most-derived type is unknown and the exception cannot be sliced. - # - test(t.ice_getEncodingVersion() != Ice.Encoding_1_0) - except Ice.OperationNotExistException: - pass - except Exception: - test(False) - print("ok") - - sys.stdout.write("preserved exceptions... ") - sys.stdout.flush() - - try: - t.unknownPreservedAsBase() - test(False) - except Test.Base as ex: - if t.ice_getEncodingVersion() == Ice.Encoding_1_0: - test(ex.ice_getSlicedData() is None) - else: - slicedData = ex.ice_getSlicedData() - test(slicedData) - test(len(slicedData.slices) == 2) - test(slicedData.slices[1].typeId == "::Test::SPreserved1") - test(slicedData.slices[0].typeId == "::Test::SPreserved2") - - try: - t.unknownPreservedAsKnownPreserved() - test(False) - except Test.KnownPreserved as ex: - test(ex.kp == "preserved") - if t.ice_getEncodingVersion() == Ice.Encoding_1_0: - test(ex.ice_getSlicedData() is None) - else: - slicedData = ex.ice_getSlicedData() - test(slicedData) - test(len(slicedData.slices) == 2) - test(slicedData.slices[1].typeId == "::Test::SPreserved1") - test(slicedData.slices[0].typeId == "::Test::SPreserved2") - - adapter = communicator.createObjectAdapter("") - relay = Test.RelayPrx.uncheckedCast(adapter.addWithUUID(RelayI())) - adapter.activate() - t.ice_getConnection().setAdapter(adapter) - - try: - t.relayKnownPreservedAsBase(relay) - test(False) - except Test.KnownPreservedDerived as ex: - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - except Ice.OperationNotExistException: - pass - except Exception: - test(False) - - try: - t.relayKnownPreservedAsKnownPreserved(relay) - test(False) - except Test.KnownPreservedDerived as ex: - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - except Ice.OperationNotExistException: - pass - except Exception: - test(False) - - try: - t.relayUnknownPreservedAsBase(relay) - test(False) - except Test.Preserved2 as ex: - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - test(ex.p1.ice_id() == Test.PreservedClass.ice_staticId()) - pc = ex.p1 - test(isinstance(pc, Test.PreservedClass)) - test(pc.bc == "bc") - test(pc.pc == "pc") - test(ex.p2 == ex.p1) - except Test.KnownPreservedDerived as ex: - # - # For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - # - test(t.ice_getEncodingVersion() == Ice.Encoding_1_0) - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - except Ice.OperationNotExistException: - pass - except Exception: - test(False) - - try: - t.relayUnknownPreservedAsKnownPreserved(relay) - test(False) - except Test.Preserved2 as ex: - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - test(ex.p1.ice_id() == Test.PreservedClass.ice_staticId()) - pc = ex.p1 - test(isinstance(pc, Test.PreservedClass)) - test(pc.bc == "bc") - test(pc.pc == "pc") - test(ex.p2 == ex.p1) - except Test.KnownPreservedDerived as ex: - # - # For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - # - test(t.ice_getEncodingVersion() == Ice.Encoding_1_0) - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - except Ice.OperationNotExistException: - pass - except Exception: - test(False) - - adapter.destroy() - print("ok") - return t diff --git a/python/test/Ice/slicing/exceptions/ClientPrivate.ice b/python/test/Ice/slicing/exceptions/ClientPrivate.ice deleted file mode 100644 index 552e9b14337..00000000000 --- a/python/test/Ice/slicing/exceptions/ClientPrivate.ice +++ /dev/null @@ -1,27 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -module Test -{ - -class PreservedClass extends BaseClass -{ - string pc; -} - -exception Preserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception Preserved2 extends Preserved1 -{ - BaseClass p2; -} - -} diff --git a/python/test/Ice/slicing/exceptions/Server.py b/python/test/Ice/slicing/exceptions/Server.py index a4cc3ca030d..40fb11dfdbb 100755 --- a/python/test/Ice/slicing/exceptions/Server.py +++ b/python/test/Ice/slicing/exceptions/Server.py @@ -97,61 +97,6 @@ def unknownMostDerived2AsBase(self, current=None): umd2.umd2 = "UnknownMostDerived2.umd2" raise umd2 - def unknownMostDerived2AsBaseCompact(self, current=None): - umd2 = Test.UnknownMostDerived2() - umd2.b = "UnknownMostDerived2.b" - umd2.ui = "UnknownMostDerived2.ui" - umd2.umd2 = "UnknownMostDerived2.umd2" - raise umd2 - - def knownPreservedAsBase(self, current=None): - ex = Test.KnownPreservedDerived() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - raise ex - - def knownPreservedAsKnownPreserved(self, current=None): - ex = Test.KnownPreservedDerived() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - raise ex - - def relayKnownPreservedAsBase(self, r, current): - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) - p.knownPreservedAsBase() - - def relayKnownPreservedAsKnownPreserved(self, r, current): - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) - p.knownPreservedAsKnownPreserved() - - def unknownPreservedAsBase(self, current=None): - ex = Test.SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = Test.SPreservedClass("bc", "spc") - ex.p2 = ex.p1 - raise ex - - def unknownPreservedAsKnownPreserved(self, current=None): - ex = Test.SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = Test.SPreservedClass("bc", "spc") - ex.p2 = ex.p1 - raise ex - - def relayUnknownPreservedAsBase(self, r, current): - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) - p.unknownPreservedAsBase() - - def relayUnknownPreservedAsKnownPreserved(self, r, current): - p = Test.RelayPrx.uncheckedCast(current.con.createProxy(r.ice_getIdentity())) - p.unknownPreservedAsKnownPreserved() - class Server(TestHelper): def run(self, args): diff --git a/python/test/Ice/slicing/exceptions/ServerAMD.py b/python/test/Ice/slicing/exceptions/ServerAMD.py index e9ce727c7f5..bdb80c10864 100755 --- a/python/test/Ice/slicing/exceptions/ServerAMD.py +++ b/python/test/Ice/slicing/exceptions/ServerAMD.py @@ -128,103 +128,6 @@ def unknownMostDerived2AsBase(self, current=None): f.set_exception(umd2) return f - def unknownMostDerived2AsBaseCompact(self, current=None): - umd2 = Test.UnknownMostDerived2() - umd2.b = "UnknownMostDerived2.b" - umd2.ui = "UnknownMostDerived2.ui" - umd2.umd2 = "UnknownMostDerived2.umd2" - f = Ice.Future() - f.set_exception(umd2) - return f - - def knownPreservedAsBase(self, r, current=None): - ex = Test.KnownPreservedDerived() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - f = Ice.Future() - f.set_exception(ex) - return f - - def knownPreservedAsKnownPreserved(self, r, current=None): - ex = Test.KnownPreservedDerived() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - f = Ice.Future() - f.set_exception(ex) - return f - - def relayKnownPreservedAsBase(self, r, current): - f = Ice.Future() - try: - p = Test.RelayPrx.uncheckedCast( - current.con.createProxy(r.ice_getIdentity()) - ) - p.knownPreservedAsBase() - test(False) - except Ice.Exception as ex: - f.set_exception(ex) - return f - - def relayKnownPreservedAsKnownPreserved(self, r, current): - f = Ice.Future() - try: - p = Test.RelayPrx.uncheckedCast( - current.con.createProxy(r.ice_getIdentity()) - ) - p.knownPreservedAsKnownPreserved() - test(False) - except Ice.Exception as ex: - f.set_exception(ex) - return f - - def unknownPreservedAsBase(self, r, current=None): - ex = Test.SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = Test.SPreservedClass("bc", "spc") - ex.p2 = ex.p1 - f = Ice.Future() - f.set_exception(ex) - return f - - def unknownPreservedAsKnownPreserved(self, r, current=None): - ex = Test.SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = Test.SPreservedClass("bc", "spc") - ex.p2 = ex.p1 - f = Ice.Future() - f.set_exception(ex) - return f - - def relayUnknownPreservedAsBase(self, r, current): - f = Ice.Future() - try: - p = Test.RelayPrx.uncheckedCast( - current.con.createProxy(r.ice_getIdentity()) - ) - p.unknownPreservedAsBase() - test(False) - except Ice.Exception as ex: - f.set_exception(ex) - return f - - def relayUnknownPreservedAsKnownPreserved(self, r, current): - f = Ice.Future() - try: - p = Test.RelayPrx.uncheckedCast( - current.con.createProxy(r.ice_getIdentity()) - ) - p.unknownPreservedAsKnownPreserved() - test(False) - except Ice.Exception as ex: - f.set_exception(ex) - return f - class ServerAMD(TestHelper): def run(self, args): diff --git a/python/test/Ice/slicing/exceptions/ServerPrivate.ice b/python/test/Ice/slicing/exceptions/ServerPrivate.ice index 843b57a6a0f..772989b9748 100644 --- a/python/test/Ice/slicing/exceptions/ServerPrivate.ice +++ b/python/test/Ice/slicing/exceptions/ServerPrivate.ice @@ -29,19 +29,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/python/test/Ice/slicing/exceptions/Test.ice b/python/test/Ice/slicing/exceptions/Test.ice index a16c2319ea7..92cd9ecf6a6 100644 --- a/python/test/Ice/slicing/exceptions/Test.ice +++ b/python/test/Ice/slicing/exceptions/Test.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/python/test/Ice/slicing/objects/AllTests.py b/python/test/Ice/slicing/objects/AllTests.py index 159daccce51..9eb9721964c 100644 --- a/python/test/Ice/slicing/objects/AllTests.py +++ b/python/test/Ice/slicing/objects/AllTests.py @@ -305,13 +305,21 @@ def response_preserved1(self, f): test(r.pb == r) self.called() - def response_preserved2(self, f): + def response_preserved2encoding10(self, f): r = f.result() test(r) test(not isinstance(r, Test.PCUnknown)) test(r.pi == 3) self.called() + def response_preserved2encoding11(self, f): + r = f.result() + test(r) + test(isinstance(r, Test.PCUnknown)) + test(r.pi == 3) + test(r.pu == "preserved") + self.called() + def response_preserved3(self, f): # # Encoding 1.0 @@ -812,10 +820,14 @@ def allTests(helper, communicator): b2 = b1.pb test(b2) test(b2.sb == "D3.sb") - test(b2.ice_id() == "::Test::B") # Sliced by server test(b2.pb == b1) p3 = b2 - test(not isinstance(p3, Test.D3)) + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p3, Test.D3)) + else: + test(isinstance(b2, Test.D3)) + test(p3.pd3 == p1) + test(p3.sd3 == "D3.sd3") test(b1 != d1) test(b1 != d3) @@ -855,10 +867,14 @@ def allTests(helper, communicator): b2 = b1.pb test(b2) test(b2.sb == "D3.sb") - test(b2.ice_id() == "::Test::B") # Sliced by server test(b2.pb == b1) p3 = b2 - test(not isinstance(p3, Test.D3)) + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p3, Test.D3)) + else: + test(isinstance(b2, Test.D3)) + test(p3.pd3 == p1) + test(p3.sd3 == "D3.sd3") test(b1 != d1) test(b1 != d3) @@ -886,20 +902,26 @@ def allTests(helper, communicator): test(b1) test(b1.sb == "D3.sb") - test(b1.ice_id() == "::Test::B") # Sliced by server - p1 = b1 - test(not isinstance(p1, Test.D3)) b2 = b1.pb test(b2) test(b2.sb == "D1.sb") test(b2.ice_id() == "::Test::D1") test(b2.pb == b1) + p3 = b2 test(isinstance(p3, Test.D1)) test(p3.sd1 == "D1.sd1") test(p3.pd1 == b1) + p1 = b1 + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p1, Test.D3)) + else: + test(isinstance(p1, Test.D3)) + test(p1.pd3 == b2) + test(p1.sd3 == "D3.sd3") + test(b1 != d1) test(b1 != d3) test(b2 != d1) @@ -927,22 +949,25 @@ def allTests(helper, communicator): cb.check() b1 = cb.r - test(b1) - test(b1.sb == "D3.sb") - test(b1.ice_id() == "::Test::B") # Sliced by server - p1 = b1 - test(not isinstance(p1, Test.D3)) - b2 = b1.pb test(b2) test(b2.sb == "D1.sb") test(b2.ice_id() == "::Test::D1") test(b2.pb == b1) + p3 = b2 test(isinstance(p3, Test.D1)) test(p3.sd1 == "D1.sd1") test(p3.pd1 == b1) + p1 = b1 + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p1, Test.D3)) + else: + test(isinstance(p1, Test.D3)) + test(p1.pd3 == b2) + test(p1.sd3 == "D3.sd3") + test(b1 != d1) test(b1 != d3) test(b2 != d1) @@ -1028,9 +1053,21 @@ def allTests(helper, communicator): r = t.returnTest3(d3, b2) test(r) - test(r.ice_id() == "::Test::B") - test(r.sb == "D3.sb") - test(r.pb == r) + + p3 = r + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p3, Test.D3)) + else: + test(isinstance(p3, Test.D3)) + + test(p3.sb == "D3.sb") + test(p3.pb == r) + test(p3.sd3 == "D3.sd3") + + test(p3.pd3.ice_id() == "::Test::B") + test(p3.pd3.sb == "B.sb(1)") + test(p3.pd3.pb == p3.pd3) + except Ice.Exception: test(False) print("ok") @@ -1059,10 +1096,19 @@ def allTests(helper, communicator): cb.check() r = cb.r - test(r) - test(r.ice_id() == "::Test::B") - test(r.sb == "D3.sb") - test(r.pb == r) + p3 = r + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p3, Test.D3)) + else: + test(isinstance(p3, Test.D3)) + + test(p3.sb == "D3.sb") + test(p3.pb == r) + test(p3.sd3 == "D3.sd3") + + test(p3.pd3.ice_id() == "::Test::B") + test(p3.pd3.sb == "B.sb(1)") + test(p3.pd3.pb == p3.pd3) except Ice.Exception: test(False) print("ok") @@ -1091,10 +1137,17 @@ def allTests(helper, communicator): d12.pd1 = d11 r = t.returnTest3(d3, d12) - test(r) - test(r.ice_id() == "::Test::B") + test(r.sb == "D3.sb") test(r.pb == r) + p3 = r + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p3, Test.D3)) + else: + test(isinstance(p3, Test.D3)) + test(p3.sd3 == "D3.sd3") + test(p3.pd3.ice_id() == "::Test::D1") + except Ice.Exception: test(False) print("ok") @@ -1127,10 +1180,16 @@ def allTests(helper, communicator): cb.check() r = cb.r - test(r) - test(r.ice_id() == "::Test::B") test(r.sb == "D3.sb") test(r.pb == r) + p3 = r + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p3, Test.D3)) + else: + test(isinstance(p3, Test.D3)) + test(p3.sd3 == "D3.sd3") + test(p3.pd3.ice_id() == "::Test::D1") + except Ice.Exception: test(False) print("ok") @@ -1202,11 +1261,17 @@ def allTests(helper, communicator): test(ss1b.ice_id() == "::Test::B") test(ss1d1.ice_id() == "::Test::D1") - test(ss1d3.ice_id() == "::Test::B") test(ss2b.ice_id() == "::Test::B") test(ss2d1.ice_id() == "::Test::D1") - test(ss2d3.ice_id() == "::Test::B") + + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(ss1d3.ice_id() == "::Test::B") + test(ss2d3.ice_id() == "::Test::B") + else: + test(ss1d3.ice_id() == "::Test::D3") + test(ss2d3.ice_id() == "::Test::D3") + except Ice.Exception: test(False) print("ok") @@ -1281,11 +1346,17 @@ def allTests(helper, communicator): test(ss1b.ice_id() == "::Test::B") test(ss1d1.ice_id() == "::Test::D1") - test(ss1d3.ice_id() == "::Test::B") test(ss2b.ice_id() == "::Test::B") test(ss2d1.ice_id() == "::Test::D1") - test(ss2d3.ice_id() == "::Test::B") + + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(ss1d3.ice_id() == "::Test::B") + test(ss2d3.ice_id() == "::Test::B") + else: + test(ss1d3.ice_id() == "::Test::D3") + test(ss2d3.ice_id() == "::Test::D3") + except Ice.Exception: test(False) print("ok") @@ -1526,9 +1597,15 @@ def allTests(helper, communicator): pu.pu = "preserved" r = t.exchangePBase(pu) - test(not isinstance(r, Test.PCUnknown)) test(r.pi == 3) + p2 = r + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + test(not isinstance(p2, Test.PCUnknown)) + else: + test(isinstance(p2, Test.PCUnknown)) + test(p2.pu == "preserved") + # # Server only knows the intermediate type Preserved. The object will be sliced to # Preserved for the 1.0 encoding; otherwise it should be returned intact. @@ -1645,7 +1722,10 @@ def allTests(helper, communicator): pu.pu = "preserved" cb = Callback() - t.exchangePBaseAsync(pu).add_done_callback(cb.response_preserved2) + if t.ice_getEncodingVersion() == Ice.Encoding_1_0: + t.exchangePBaseAsync(pu).add_done_callback(cb.response_preserved2encoding10) + else: + t.exchangePBaseAsync(pu).add_done_callback(cb.response_preserved2encoding11) cb.check() # @@ -1778,42 +1858,6 @@ def allTests(helper, communicator): p._ice_slicedData = None # Break the cycle. p = None # Release reference. test(PreservedI.counter == 0) - - # - # Throw a preserved exception where the most-derived type is unknown. - # The preserved exception slice contains a class data member. This - # object is also preserved, and its most-derived type is also unknown. - # The preserved slice of the object contains a class data member that - # refers to itself. - # - # The chain of references looks like this: - # - # ex->slicedData->obj->slicedData->obj - # - try: - test(PreservedI.counter == 0) - - try: - t.throwPreservedException() - except Test.PreservedException as ex: - # - # The class instance is only retained when the encoding is > 1.0. - # - if t.ice_getEncodingVersion() != Ice.Encoding_1_0: - test(PreservedI.counter == 1) - gc.collect() # No effect. - test(PreservedI.counter == 1) - ex._ice_slicedData = None # Break the cycle. - - # - # Exception has gone out of scope. - # - if t.ice_getEncodingVersion() != Ice.Encoding_1_0: - gc.collect() - test(len(gc.garbage) == 0) - test(PreservedI.counter == 0) - except Ice.Exception: - test(False) except Ice.OperationNotExistException: pass diff --git a/python/test/Ice/slicing/objects/ClientPrivate.ice b/python/test/Ice/slicing/objects/ClientPrivate.ice index cd5e1ec84ea..b2a3f882931 100644 --- a/python/test/Ice/slicing/objects/ClientPrivate.ice +++ b/python/test/Ice/slicing/objects/ClientPrivate.ice @@ -15,7 +15,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/python/test/Ice/slicing/objects/Server.py b/python/test/Ice/slicing/objects/Server.py index db4067d398a..48e87c30ac3 100755 --- a/python/test/Ice/slicing/objects/Server.py +++ b/python/test/Ice/slicing/objects/Server.py @@ -341,17 +341,6 @@ def throwUnknownDerivedAsBase(self, current=None): ude.pd2 = d2 raise ude - def throwPreservedException(self, current=None): - ue = Test.PSUnknownException() - ue.p = Test.PSUnknown2() - ue.p.pi = 5 - ue.p.ps = "preserved" - ue.p.pb = ue.p - f = Ice.Future() - f.set_exception(ue) - return f - # ue.p.pb = None # Break the cycle. - def useForward(self, current=None): f = Test.Forward() f.h = Test.Hidden() diff --git a/python/test/Ice/slicing/objects/ServerAMD.py b/python/test/Ice/slicing/objects/ServerAMD.py index 2607694a144..277b9897f7a 100755 --- a/python/test/Ice/slicing/objects/ServerAMD.py +++ b/python/test/Ice/slicing/objects/ServerAMD.py @@ -377,17 +377,6 @@ def throwUnknownDerivedAsBase(self, current=None): f.set_exception(ude) return f - def throwPreservedException(self, current=None): - ue = Test.PSUnknownException() - ue.p = Test.PSUnknown2() - ue.p.pi = 5 - ue.p.ps = "preserved" - ue.p.pb = ue.p - f = Ice.Future() - f.set_exception(ue) - return f - # ue.p.pb = None # Break the cycle. - def useForward(self, current=None): fwd = Test.Forward() fwd.h = Test.Hidden() diff --git a/python/test/Ice/slicing/objects/ServerPrivate.ice b/python/test/Ice/slicing/objects/ServerPrivate.ice index 10d11274b01..2bb1e6c4d3f 100644 --- a/python/test/Ice/slicing/objects/ServerPrivate.ice +++ b/python/test/Ice/slicing/objects/ServerPrivate.ice @@ -55,9 +55,4 @@ class PSUnknown2 extends Preserved PBase pb; } -exception PSUnknownException extends PreservedException -{ - PSUnknown2 p; -} - } diff --git a/python/test/Ice/slicing/objects/Test.ice b/python/test/Ice/slicing/objects/Test.ice index b50a94d0c7a..f31217aa6d6 100644 --- a/python/test/Ice/slicing/objects/Test.ice +++ b/python/test/Ice/slicing/objects/Test.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -86,17 +85,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] -exception PreservedException -{ -} - ["format:sliced"] interface TestIntf { @@ -148,7 +141,6 @@ interface TestIntf void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - ["amd"] void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ diff --git a/ruby/ruby/Ice.rb b/ruby/ruby/Ice.rb index dedc6b6075a..ffe9d3705a0 100644 --- a/ruby/ruby/Ice.rb +++ b/ruby/ruby/Ice.rb @@ -142,7 +142,7 @@ def ice_getSlicedData() attr_accessor :_ice_slicedData # Only used for instances of preserved classes. end - T_Value.defineClass(Value, -1, false, false, nil, []) + T_Value.defineClass(Value, -1, false, nil, []) T_ObjectPrx.defineProxy(ObjectPrx, nil, []) @@ -165,7 +165,7 @@ def ice_id end end T_UnknownSlicedValue = Ice.__declareClass('::Ice::UnknownSlicedValue') - T_UnknownSlicedValue.defineClass(UnknownSlicedValue, -1, true, false, T_Value, []) + T_UnknownSlicedValue.defineClass(UnknownSlicedValue, -1, false, T_Value, []) # # InitializationData. diff --git a/ruby/ruby/IceLocal/Connection.rb b/ruby/ruby/IceLocal/Connection.rb index 62bd5d1b81b..aeaac1e9c78 100644 --- a/ruby/ruby/IceLocal/Connection.rb +++ b/ruby/ruby/IceLocal/Connection.rb @@ -91,7 +91,7 @@ def initialize(underlying=nil, incoming=false, adapterName='', connectionId='') T_ConnectionInfo = ::Ice::__declareLocalClass('::Ice::ConnectionInfo') end - T_ConnectionInfo.defineClass(ConnectionInfo, -1, false, false, nil, [ + T_ConnectionInfo.defineClass(ConnectionInfo, -1, false, nil, [ ['underlying', ::Ice::T_ConnectionInfo, false, 0], ['incoming', ::Ice::T_bool, false, 0], ['adapterName', ::Ice::T_string, false, 0], @@ -324,7 +324,7 @@ def initialize(underlying=nil, incoming=false, adapterName='', connectionId='', T_IPConnectionInfo = ::Ice::__declareLocalClass('::Ice::IPConnectionInfo') end - T_IPConnectionInfo.defineClass(IPConnectionInfo, -1, false, false, ::Ice::T_ConnectionInfo, [ + T_IPConnectionInfo.defineClass(IPConnectionInfo, -1, false, ::Ice::T_ConnectionInfo, [ ['localAddress', ::Ice::T_string, false, 0], ['localPort', ::Ice::T_int, false, 0], ['remoteAddress', ::Ice::T_string, false, 0], @@ -351,7 +351,7 @@ def initialize(underlying=nil, incoming=false, adapterName='', connectionId='', T_TCPConnectionInfo = ::Ice::__declareLocalClass('::Ice::TCPConnectionInfo') end - T_TCPConnectionInfo.defineClass(TCPConnectionInfo, -1, false, false, ::Ice::T_IPConnectionInfo, [ + T_TCPConnectionInfo.defineClass(TCPConnectionInfo, -1, false, ::Ice::T_IPConnectionInfo, [ ['rcvSize', ::Ice::T_int, false, 0], ['sndSize', ::Ice::T_int, false, 0] ]) @@ -378,7 +378,7 @@ def initialize(underlying=nil, incoming=false, adapterName='', connectionId='', T_UDPConnectionInfo = ::Ice::__declareLocalClass('::Ice::UDPConnectionInfo') end - T_UDPConnectionInfo.defineClass(UDPConnectionInfo, -1, false, false, ::Ice::T_IPConnectionInfo, [ + T_UDPConnectionInfo.defineClass(UDPConnectionInfo, -1, false, ::Ice::T_IPConnectionInfo, [ ['mcastAddress', ::Ice::T_string, false, 0], ['mcastPort', ::Ice::T_int, false, 0], ['rcvSize', ::Ice::T_int, false, 0], @@ -408,6 +408,6 @@ def initialize(underlying=nil, incoming=false, adapterName='', connectionId='', T_WSConnectionInfo = ::Ice::__declareLocalClass('::Ice::WSConnectionInfo') end - T_WSConnectionInfo.defineClass(WSConnectionInfo, -1, false, false, ::Ice::T_ConnectionInfo, [['headers', ::Ice::T_HeaderDict, false, 0]]) + T_WSConnectionInfo.defineClass(WSConnectionInfo, -1, false, ::Ice::T_ConnectionInfo, [['headers', ::Ice::T_HeaderDict, false, 0]]) end end diff --git a/ruby/ruby/IceLocal/Endpoint.rb b/ruby/ruby/IceLocal/Endpoint.rb index bff4723f706..17f2a66ecba 100644 --- a/ruby/ruby/IceLocal/Endpoint.rb +++ b/ruby/ruby/IceLocal/Endpoint.rb @@ -40,7 +40,7 @@ def initialize(underlying=nil, timeout=0, compress=false) T_EndpointInfo = ::Ice::__declareLocalClass('::Ice::EndpointInfo') end - T_EndpointInfo.defineClass(EndpointInfo, -1, false, false, nil, [ + T_EndpointInfo.defineClass(EndpointInfo, -1, false, nil, [ ['underlying', ::Ice::T_EndpointInfo, false, 0], ['timeout', ::Ice::T_int, false, 0], ['compress', ::Ice::T_bool, false, 0] @@ -71,7 +71,7 @@ def initialize(underlying=nil, timeout=0, compress=false, host='', port=0, sourc T_IPEndpointInfo = ::Ice::__declareLocalClass('::Ice::IPEndpointInfo') end - T_IPEndpointInfo.defineClass(IPEndpointInfo, -1, false, false, ::Ice::T_EndpointInfo, [ + T_IPEndpointInfo.defineClass(IPEndpointInfo, -1, false, ::Ice::T_EndpointInfo, [ ['host', ::Ice::T_string, false, 0], ['port', ::Ice::T_int, false, 0], ['sourceAddress', ::Ice::T_string, false, 0] @@ -93,7 +93,7 @@ def initialize(underlying=nil, timeout=0, compress=false, host='', port=0, sourc T_TCPEndpointInfo = ::Ice::__declareLocalClass('::Ice::TCPEndpointInfo') end - T_TCPEndpointInfo.defineClass(TCPEndpointInfo, -1, false, false, ::Ice::T_IPEndpointInfo, []) + T_TCPEndpointInfo.defineClass(TCPEndpointInfo, -1, false, ::Ice::T_IPEndpointInfo, []) end if not defined?(::Ice::UDPEndpointInfo_Mixin) @@ -115,7 +115,7 @@ def initialize(underlying=nil, timeout=0, compress=false, host='', port=0, sourc T_UDPEndpointInfo = ::Ice::__declareLocalClass('::Ice::UDPEndpointInfo') end - T_UDPEndpointInfo.defineClass(UDPEndpointInfo, -1, false, false, ::Ice::T_IPEndpointInfo, [ + T_UDPEndpointInfo.defineClass(UDPEndpointInfo, -1, false, ::Ice::T_IPEndpointInfo, [ ['mcastInterface', ::Ice::T_string, false, 0], ['mcastTtl', ::Ice::T_int, false, 0] ]) @@ -139,7 +139,7 @@ def initialize(underlying=nil, timeout=0, compress=false, resource='') T_WSEndpointInfo = ::Ice::__declareLocalClass('::Ice::WSEndpointInfo') end - T_WSEndpointInfo.defineClass(WSEndpointInfo, -1, false, false, ::Ice::T_EndpointInfo, [['resource', ::Ice::T_string, false, 0]]) + T_WSEndpointInfo.defineClass(WSEndpointInfo, -1, false, ::Ice::T_EndpointInfo, [['resource', ::Ice::T_string, false, 0]]) end if not defined?(::Ice::OpaqueEndpointInfo_Mixin) @@ -161,7 +161,7 @@ def initialize(underlying=nil, timeout=0, compress=false, rawEncoding=::Ice::Enc T_OpaqueEndpointInfo = ::Ice::__declareLocalClass('::Ice::OpaqueEndpointInfo') end - T_OpaqueEndpointInfo.defineClass(OpaqueEndpointInfo, -1, false, false, ::Ice::T_EndpointInfo, [ + T_OpaqueEndpointInfo.defineClass(OpaqueEndpointInfo, -1, false, ::Ice::T_EndpointInfo, [ ['rawEncoding', ::Ice::T_EncodingVersion, false, 0], ['rawBytes', ::Ice::T_ByteSeq, false, 0] ]) diff --git a/ruby/ruby/IceLocal/LocalException.rb b/ruby/ruby/IceLocal/LocalException.rb index cf793d74c73..ee2a099746c 100644 --- a/ruby/ruby/IceLocal/LocalException.rb +++ b/ruby/ruby/IceLocal/LocalException.rb @@ -34,7 +34,7 @@ def to_s attr_accessor :reason end - T_InitializationException = ::Ice::__defineException('::Ice::InitializationException', InitializationException, false, nil, [["reason", ::Ice::T_string, false, 0]]) + T_InitializationException = ::Ice::__defineException('::Ice::InitializationException', InitializationException, nil, [["reason", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::PluginInitializationException) @@ -50,7 +50,7 @@ def to_s attr_accessor :reason end - T_PluginInitializationException = ::Ice::__defineException('::Ice::PluginInitializationException', PluginInitializationException, false, nil, [["reason", ::Ice::T_string, false, 0]]) + T_PluginInitializationException = ::Ice::__defineException('::Ice::PluginInitializationException', PluginInitializationException, nil, [["reason", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::CollocationOptimizationException) @@ -63,7 +63,7 @@ def to_s end end - T_CollocationOptimizationException = ::Ice::__defineException('::Ice::CollocationOptimizationException', CollocationOptimizationException, false, nil, []) + T_CollocationOptimizationException = ::Ice::__defineException('::Ice::CollocationOptimizationException', CollocationOptimizationException, nil, []) end if not defined?(::Ice::AlreadyRegisteredException) @@ -80,7 +80,7 @@ def to_s attr_accessor :kindOfObject, :id end - T_AlreadyRegisteredException = ::Ice::__defineException('::Ice::AlreadyRegisteredException', AlreadyRegisteredException, false, nil, [ + T_AlreadyRegisteredException = ::Ice::__defineException('::Ice::AlreadyRegisteredException', AlreadyRegisteredException, nil, [ ["kindOfObject", ::Ice::T_string, false, 0], ["id", ::Ice::T_string, false, 0] ]) @@ -100,7 +100,7 @@ def to_s attr_accessor :kindOfObject, :id end - T_NotRegisteredException = ::Ice::__defineException('::Ice::NotRegisteredException', NotRegisteredException, false, nil, [ + T_NotRegisteredException = ::Ice::__defineException('::Ice::NotRegisteredException', NotRegisteredException, nil, [ ["kindOfObject", ::Ice::T_string, false, 0], ["id", ::Ice::T_string, false, 0] ]) @@ -119,7 +119,7 @@ def to_s attr_accessor :operation end - T_TwowayOnlyException = ::Ice::__defineException('::Ice::TwowayOnlyException', TwowayOnlyException, false, nil, [["operation", ::Ice::T_string, false, 0]]) + T_TwowayOnlyException = ::Ice::__defineException('::Ice::TwowayOnlyException', TwowayOnlyException, nil, [["operation", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::CloneNotImplementedException) @@ -132,7 +132,7 @@ def to_s end end - T_CloneNotImplementedException = ::Ice::__defineException('::Ice::CloneNotImplementedException', CloneNotImplementedException, false, nil, []) + T_CloneNotImplementedException = ::Ice::__defineException('::Ice::CloneNotImplementedException', CloneNotImplementedException, nil, []) end if not defined?(::Ice::UnknownException) @@ -148,7 +148,7 @@ def to_s attr_accessor :unknown end - T_UnknownException = ::Ice::__defineException('::Ice::UnknownException', UnknownException, false, nil, [["unknown", ::Ice::T_string, false, 0]]) + T_UnknownException = ::Ice::__defineException('::Ice::UnknownException', UnknownException, nil, [["unknown", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::UnknownLocalException) @@ -162,7 +162,7 @@ def to_s end end - T_UnknownLocalException = ::Ice::__defineException('::Ice::UnknownLocalException', UnknownLocalException, false, ::Ice::T_UnknownException, []) + T_UnknownLocalException = ::Ice::__defineException('::Ice::UnknownLocalException', UnknownLocalException, ::Ice::T_UnknownException, []) end if not defined?(::Ice::UnknownUserException) @@ -176,7 +176,7 @@ def to_s end end - T_UnknownUserException = ::Ice::__defineException('::Ice::UnknownUserException', UnknownUserException, false, ::Ice::T_UnknownException, []) + T_UnknownUserException = ::Ice::__defineException('::Ice::UnknownUserException', UnknownUserException, ::Ice::T_UnknownException, []) end if not defined?(::Ice::VersionMismatchException) @@ -189,7 +189,7 @@ def to_s end end - T_VersionMismatchException = ::Ice::__defineException('::Ice::VersionMismatchException', VersionMismatchException, false, nil, []) + T_VersionMismatchException = ::Ice::__defineException('::Ice::VersionMismatchException', VersionMismatchException, nil, []) end if not defined?(::Ice::CommunicatorDestroyedException) @@ -202,7 +202,7 @@ def to_s end end - T_CommunicatorDestroyedException = ::Ice::__defineException('::Ice::CommunicatorDestroyedException', CommunicatorDestroyedException, false, nil, []) + T_CommunicatorDestroyedException = ::Ice::__defineException('::Ice::CommunicatorDestroyedException', CommunicatorDestroyedException, nil, []) end if not defined?(::Ice::ObjectAdapterDeactivatedException) @@ -218,7 +218,7 @@ def to_s attr_accessor :name end - T_ObjectAdapterDeactivatedException = ::Ice::__defineException('::Ice::ObjectAdapterDeactivatedException', ObjectAdapterDeactivatedException, false, nil, [["name", ::Ice::T_string, false, 0]]) + T_ObjectAdapterDeactivatedException = ::Ice::__defineException('::Ice::ObjectAdapterDeactivatedException', ObjectAdapterDeactivatedException, nil, [["name", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::ObjectAdapterIdInUseException) @@ -234,7 +234,7 @@ def to_s attr_accessor :id end - T_ObjectAdapterIdInUseException = ::Ice::__defineException('::Ice::ObjectAdapterIdInUseException', ObjectAdapterIdInUseException, false, nil, [["id", ::Ice::T_string, false, 0]]) + T_ObjectAdapterIdInUseException = ::Ice::__defineException('::Ice::ObjectAdapterIdInUseException', ObjectAdapterIdInUseException, nil, [["id", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::NoEndpointException) @@ -250,7 +250,7 @@ def to_s attr_accessor :proxy end - T_NoEndpointException = ::Ice::__defineException('::Ice::NoEndpointException', NoEndpointException, false, nil, [["proxy", ::Ice::T_string, false, 0]]) + T_NoEndpointException = ::Ice::__defineException('::Ice::NoEndpointException', NoEndpointException, nil, [["proxy", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::EndpointParseException) @@ -266,7 +266,7 @@ def to_s attr_accessor :str end - T_EndpointParseException = ::Ice::__defineException('::Ice::EndpointParseException', EndpointParseException, false, nil, [["str", ::Ice::T_string, false, 0]]) + T_EndpointParseException = ::Ice::__defineException('::Ice::EndpointParseException', EndpointParseException, nil, [["str", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::EndpointSelectionTypeParseException) @@ -282,7 +282,7 @@ def to_s attr_accessor :str end - T_EndpointSelectionTypeParseException = ::Ice::__defineException('::Ice::EndpointSelectionTypeParseException', EndpointSelectionTypeParseException, false, nil, [["str", ::Ice::T_string, false, 0]]) + T_EndpointSelectionTypeParseException = ::Ice::__defineException('::Ice::EndpointSelectionTypeParseException', EndpointSelectionTypeParseException, nil, [["str", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::VersionParseException) @@ -298,7 +298,7 @@ def to_s attr_accessor :str end - T_VersionParseException = ::Ice::__defineException('::Ice::VersionParseException', VersionParseException, false, nil, [["str", ::Ice::T_string, false, 0]]) + T_VersionParseException = ::Ice::__defineException('::Ice::VersionParseException', VersionParseException, nil, [["str", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::IdentityParseException) @@ -314,7 +314,7 @@ def to_s attr_accessor :str end - T_IdentityParseException = ::Ice::__defineException('::Ice::IdentityParseException', IdentityParseException, false, nil, [["str", ::Ice::T_string, false, 0]]) + T_IdentityParseException = ::Ice::__defineException('::Ice::IdentityParseException', IdentityParseException, nil, [["str", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::ProxyParseException) @@ -330,7 +330,7 @@ def to_s attr_accessor :str end - T_ProxyParseException = ::Ice::__defineException('::Ice::ProxyParseException', ProxyParseException, false, nil, [["str", ::Ice::T_string, false, 0]]) + T_ProxyParseException = ::Ice::__defineException('::Ice::ProxyParseException', ProxyParseException, nil, [["str", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::IllegalIdentityException) @@ -343,7 +343,7 @@ def to_s end end - T_IllegalIdentityException = ::Ice::__defineException('::Ice::IllegalIdentityException', IllegalIdentityException, false, nil, []) + T_IllegalIdentityException = ::Ice::__defineException('::Ice::IllegalIdentityException', IllegalIdentityException, nil, []) end if not defined?(::Ice::IllegalServantException) @@ -359,7 +359,7 @@ def to_s attr_accessor :reason end - T_IllegalServantException = ::Ice::__defineException('::Ice::IllegalServantException', IllegalServantException, false, nil, [["reason", ::Ice::T_string, false, 0]]) + T_IllegalServantException = ::Ice::__defineException('::Ice::IllegalServantException', IllegalServantException, nil, [["reason", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::RequestFailedException) @@ -377,7 +377,7 @@ def to_s attr_accessor :id, :facet, :operation end - T_RequestFailedException = ::Ice::__defineException('::Ice::RequestFailedException', RequestFailedException, false, nil, [ + T_RequestFailedException = ::Ice::__defineException('::Ice::RequestFailedException', RequestFailedException, nil, [ ["id", ::Ice::T_Identity, false, 0], ["facet", ::Ice::T_string, false, 0], ["operation", ::Ice::T_string, false, 0] @@ -395,7 +395,7 @@ def to_s end end - T_ObjectNotExistException = ::Ice::__defineException('::Ice::ObjectNotExistException', ObjectNotExistException, false, ::Ice::T_RequestFailedException, []) + T_ObjectNotExistException = ::Ice::__defineException('::Ice::ObjectNotExistException', ObjectNotExistException, ::Ice::T_RequestFailedException, []) end if not defined?(::Ice::FacetNotExistException) @@ -409,7 +409,7 @@ def to_s end end - T_FacetNotExistException = ::Ice::__defineException('::Ice::FacetNotExistException', FacetNotExistException, false, ::Ice::T_RequestFailedException, []) + T_FacetNotExistException = ::Ice::__defineException('::Ice::FacetNotExistException', FacetNotExistException, ::Ice::T_RequestFailedException, []) end if not defined?(::Ice::OperationNotExistException) @@ -423,7 +423,7 @@ def to_s end end - T_OperationNotExistException = ::Ice::__defineException('::Ice::OperationNotExistException', OperationNotExistException, false, ::Ice::T_RequestFailedException, []) + T_OperationNotExistException = ::Ice::__defineException('::Ice::OperationNotExistException', OperationNotExistException, ::Ice::T_RequestFailedException, []) end if not defined?(::Ice::SyscallException) @@ -439,7 +439,7 @@ def to_s attr_accessor :error end - T_SyscallException = ::Ice::__defineException('::Ice::SyscallException', SyscallException, false, nil, [["error", ::Ice::T_int, false, 0]]) + T_SyscallException = ::Ice::__defineException('::Ice::SyscallException', SyscallException, nil, [["error", ::Ice::T_int, false, 0]]) end if not defined?(::Ice::SocketException) @@ -453,7 +453,7 @@ def to_s end end - T_SocketException = ::Ice::__defineException('::Ice::SocketException', SocketException, false, ::Ice::T_SyscallException, []) + T_SocketException = ::Ice::__defineException('::Ice::SocketException', SocketException, ::Ice::T_SyscallException, []) end if not defined?(::Ice::CFNetworkException) @@ -470,7 +470,7 @@ def to_s attr_accessor :domain end - T_CFNetworkException = ::Ice::__defineException('::Ice::CFNetworkException', CFNetworkException, false, ::Ice::T_SocketException, [["domain", ::Ice::T_string, false, 0]]) + T_CFNetworkException = ::Ice::__defineException('::Ice::CFNetworkException', CFNetworkException, ::Ice::T_SocketException, [["domain", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::FileException) @@ -487,7 +487,7 @@ def to_s attr_accessor :path end - T_FileException = ::Ice::__defineException('::Ice::FileException', FileException, false, ::Ice::T_SyscallException, [["path", ::Ice::T_string, false, 0]]) + T_FileException = ::Ice::__defineException('::Ice::FileException', FileException, ::Ice::T_SyscallException, [["path", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::ConnectFailedException) @@ -501,7 +501,7 @@ def to_s end end - T_ConnectFailedException = ::Ice::__defineException('::Ice::ConnectFailedException', ConnectFailedException, false, ::Ice::T_SocketException, []) + T_ConnectFailedException = ::Ice::__defineException('::Ice::ConnectFailedException', ConnectFailedException, ::Ice::T_SocketException, []) end if not defined?(::Ice::ConnectionRefusedException) @@ -515,7 +515,7 @@ def to_s end end - T_ConnectionRefusedException = ::Ice::__defineException('::Ice::ConnectionRefusedException', ConnectionRefusedException, false, ::Ice::T_ConnectFailedException, []) + T_ConnectionRefusedException = ::Ice::__defineException('::Ice::ConnectionRefusedException', ConnectionRefusedException, ::Ice::T_ConnectFailedException, []) end if not defined?(::Ice::ConnectionLostException) @@ -529,7 +529,7 @@ def to_s end end - T_ConnectionLostException = ::Ice::__defineException('::Ice::ConnectionLostException', ConnectionLostException, false, ::Ice::T_SocketException, []) + T_ConnectionLostException = ::Ice::__defineException('::Ice::ConnectionLostException', ConnectionLostException, ::Ice::T_SocketException, []) end if not defined?(::Ice::DNSException) @@ -546,7 +546,7 @@ def to_s attr_accessor :error, :host end - T_DNSException = ::Ice::__defineException('::Ice::DNSException', DNSException, false, nil, [ + T_DNSException = ::Ice::__defineException('::Ice::DNSException', DNSException, nil, [ ["error", ::Ice::T_int, false, 0], ["host", ::Ice::T_string, false, 0] ]) @@ -562,7 +562,7 @@ def to_s end end - T_OperationInterruptedException = ::Ice::__defineException('::Ice::OperationInterruptedException', OperationInterruptedException, false, nil, []) + T_OperationInterruptedException = ::Ice::__defineException('::Ice::OperationInterruptedException', OperationInterruptedException, nil, []) end if not defined?(::Ice::TimeoutException) @@ -575,7 +575,7 @@ def to_s end end - T_TimeoutException = ::Ice::__defineException('::Ice::TimeoutException', TimeoutException, false, nil, []) + T_TimeoutException = ::Ice::__defineException('::Ice::TimeoutException', TimeoutException, nil, []) end if not defined?(::Ice::ConnectTimeoutException) @@ -588,7 +588,7 @@ def to_s end end - T_ConnectTimeoutException = ::Ice::__defineException('::Ice::ConnectTimeoutException', ConnectTimeoutException, false, ::Ice::T_TimeoutException, []) + T_ConnectTimeoutException = ::Ice::__defineException('::Ice::ConnectTimeoutException', ConnectTimeoutException, ::Ice::T_TimeoutException, []) end if not defined?(::Ice::CloseTimeoutException) @@ -601,7 +601,7 @@ def to_s end end - T_CloseTimeoutException = ::Ice::__defineException('::Ice::CloseTimeoutException', CloseTimeoutException, false, ::Ice::T_TimeoutException, []) + T_CloseTimeoutException = ::Ice::__defineException('::Ice::CloseTimeoutException', CloseTimeoutException, ::Ice::T_TimeoutException, []) end if not defined?(::Ice::ConnectionTimeoutException) @@ -614,7 +614,7 @@ def to_s end end - T_ConnectionTimeoutException = ::Ice::__defineException('::Ice::ConnectionTimeoutException', ConnectionTimeoutException, false, ::Ice::T_TimeoutException, []) + T_ConnectionTimeoutException = ::Ice::__defineException('::Ice::ConnectionTimeoutException', ConnectionTimeoutException, ::Ice::T_TimeoutException, []) end if not defined?(::Ice::InvocationTimeoutException) @@ -627,7 +627,7 @@ def to_s end end - T_InvocationTimeoutException = ::Ice::__defineException('::Ice::InvocationTimeoutException', InvocationTimeoutException, false, ::Ice::T_TimeoutException, []) + T_InvocationTimeoutException = ::Ice::__defineException('::Ice::InvocationTimeoutException', InvocationTimeoutException, ::Ice::T_TimeoutException, []) end if not defined?(::Ice::InvocationCanceledException) @@ -640,7 +640,7 @@ def to_s end end - T_InvocationCanceledException = ::Ice::__defineException('::Ice::InvocationCanceledException', InvocationCanceledException, false, nil, []) + T_InvocationCanceledException = ::Ice::__defineException('::Ice::InvocationCanceledException', InvocationCanceledException, nil, []) end if not defined?(::Ice::ProtocolException) @@ -656,7 +656,7 @@ def to_s attr_accessor :reason end - T_ProtocolException = ::Ice::__defineException('::Ice::ProtocolException', ProtocolException, false, nil, [["reason", ::Ice::T_string, false, 0]]) + T_ProtocolException = ::Ice::__defineException('::Ice::ProtocolException', ProtocolException, nil, [["reason", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::BadMagicException) @@ -673,7 +673,7 @@ def to_s attr_accessor :badMagic end - T_BadMagicException = ::Ice::__defineException('::Ice::BadMagicException', BadMagicException, false, ::Ice::T_ProtocolException, [["badMagic", ::Ice::T_ByteSeq, false, 0]]) + T_BadMagicException = ::Ice::__defineException('::Ice::BadMagicException', BadMagicException, ::Ice::T_ProtocolException, [["badMagic", ::Ice::T_ByteSeq, false, 0]]) end if not defined?(::Ice::UnsupportedProtocolException) @@ -691,7 +691,7 @@ def to_s attr_accessor :bad, :supported end - T_UnsupportedProtocolException = ::Ice::__defineException('::Ice::UnsupportedProtocolException', UnsupportedProtocolException, false, ::Ice::T_ProtocolException, [ + T_UnsupportedProtocolException = ::Ice::__defineException('::Ice::UnsupportedProtocolException', UnsupportedProtocolException, ::Ice::T_ProtocolException, [ ["bad", ::Ice::T_ProtocolVersion, false, 0], ["supported", ::Ice::T_ProtocolVersion, false, 0] ]) @@ -712,7 +712,7 @@ def to_s attr_accessor :bad, :supported end - T_UnsupportedEncodingException = ::Ice::__defineException('::Ice::UnsupportedEncodingException', UnsupportedEncodingException, false, ::Ice::T_ProtocolException, [ + T_UnsupportedEncodingException = ::Ice::__defineException('::Ice::UnsupportedEncodingException', UnsupportedEncodingException, ::Ice::T_ProtocolException, [ ["bad", ::Ice::T_EncodingVersion, false, 0], ["supported", ::Ice::T_EncodingVersion, false, 0] ]) @@ -729,7 +729,7 @@ def to_s end end - T_UnknownMessageException = ::Ice::__defineException('::Ice::UnknownMessageException', UnknownMessageException, false, ::Ice::T_ProtocolException, []) + T_UnknownMessageException = ::Ice::__defineException('::Ice::UnknownMessageException', UnknownMessageException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::ConnectionNotValidatedException) @@ -743,7 +743,7 @@ def to_s end end - T_ConnectionNotValidatedException = ::Ice::__defineException('::Ice::ConnectionNotValidatedException', ConnectionNotValidatedException, false, ::Ice::T_ProtocolException, []) + T_ConnectionNotValidatedException = ::Ice::__defineException('::Ice::ConnectionNotValidatedException', ConnectionNotValidatedException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::UnknownRequestIdException) @@ -757,7 +757,7 @@ def to_s end end - T_UnknownRequestIdException = ::Ice::__defineException('::Ice::UnknownRequestIdException', UnknownRequestIdException, false, ::Ice::T_ProtocolException, []) + T_UnknownRequestIdException = ::Ice::__defineException('::Ice::UnknownRequestIdException', UnknownRequestIdException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::UnknownReplyStatusException) @@ -771,7 +771,7 @@ def to_s end end - T_UnknownReplyStatusException = ::Ice::__defineException('::Ice::UnknownReplyStatusException', UnknownReplyStatusException, false, ::Ice::T_ProtocolException, []) + T_UnknownReplyStatusException = ::Ice::__defineException('::Ice::UnknownReplyStatusException', UnknownReplyStatusException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::CloseConnectionException) @@ -785,7 +785,7 @@ def to_s end end - T_CloseConnectionException = ::Ice::__defineException('::Ice::CloseConnectionException', CloseConnectionException, false, ::Ice::T_ProtocolException, []) + T_CloseConnectionException = ::Ice::__defineException('::Ice::CloseConnectionException', CloseConnectionException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::ConnectionManuallyClosedException) @@ -801,7 +801,7 @@ def to_s attr_accessor :graceful end - T_ConnectionManuallyClosedException = ::Ice::__defineException('::Ice::ConnectionManuallyClosedException', ConnectionManuallyClosedException, false, nil, [["graceful", ::Ice::T_bool, false, 0]]) + T_ConnectionManuallyClosedException = ::Ice::__defineException('::Ice::ConnectionManuallyClosedException', ConnectionManuallyClosedException, nil, [["graceful", ::Ice::T_bool, false, 0]]) end if not defined?(::Ice::IllegalMessageSizeException) @@ -815,7 +815,7 @@ def to_s end end - T_IllegalMessageSizeException = ::Ice::__defineException('::Ice::IllegalMessageSizeException', IllegalMessageSizeException, false, ::Ice::T_ProtocolException, []) + T_IllegalMessageSizeException = ::Ice::__defineException('::Ice::IllegalMessageSizeException', IllegalMessageSizeException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::CompressionException) @@ -829,7 +829,7 @@ def to_s end end - T_CompressionException = ::Ice::__defineException('::Ice::CompressionException', CompressionException, false, ::Ice::T_ProtocolException, []) + T_CompressionException = ::Ice::__defineException('::Ice::CompressionException', CompressionException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::DatagramLimitException) @@ -843,7 +843,7 @@ def to_s end end - T_DatagramLimitException = ::Ice::__defineException('::Ice::DatagramLimitException', DatagramLimitException, false, ::Ice::T_ProtocolException, []) + T_DatagramLimitException = ::Ice::__defineException('::Ice::DatagramLimitException', DatagramLimitException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::MarshalException) @@ -857,7 +857,7 @@ def to_s end end - T_MarshalException = ::Ice::__defineException('::Ice::MarshalException', MarshalException, false, ::Ice::T_ProtocolException, []) + T_MarshalException = ::Ice::__defineException('::Ice::MarshalException', MarshalException, ::Ice::T_ProtocolException, []) end if not defined?(::Ice::ProxyUnmarshalException) @@ -871,7 +871,7 @@ def to_s end end - T_ProxyUnmarshalException = ::Ice::__defineException('::Ice::ProxyUnmarshalException', ProxyUnmarshalException, false, ::Ice::T_MarshalException, []) + T_ProxyUnmarshalException = ::Ice::__defineException('::Ice::ProxyUnmarshalException', ProxyUnmarshalException, ::Ice::T_MarshalException, []) end if not defined?(::Ice::UnmarshalOutOfBoundsException) @@ -885,7 +885,7 @@ def to_s end end - T_UnmarshalOutOfBoundsException = ::Ice::__defineException('::Ice::UnmarshalOutOfBoundsException', UnmarshalOutOfBoundsException, false, ::Ice::T_MarshalException, []) + T_UnmarshalOutOfBoundsException = ::Ice::__defineException('::Ice::UnmarshalOutOfBoundsException', UnmarshalOutOfBoundsException, ::Ice::T_MarshalException, []) end if not defined?(::Ice::NoValueFactoryException) @@ -902,7 +902,7 @@ def to_s attr_accessor :type end - T_NoValueFactoryException = ::Ice::__defineException('::Ice::NoValueFactoryException', NoValueFactoryException, false, ::Ice::T_MarshalException, [["type", ::Ice::T_string, false, 0]]) + T_NoValueFactoryException = ::Ice::__defineException('::Ice::NoValueFactoryException', NoValueFactoryException, ::Ice::T_MarshalException, [["type", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::UnexpectedObjectException) @@ -920,7 +920,7 @@ def to_s attr_accessor :type, :expectedType end - T_UnexpectedObjectException = ::Ice::__defineException('::Ice::UnexpectedObjectException', UnexpectedObjectException, false, ::Ice::T_MarshalException, [ + T_UnexpectedObjectException = ::Ice::__defineException('::Ice::UnexpectedObjectException', UnexpectedObjectException, ::Ice::T_MarshalException, [ ["type", ::Ice::T_string, false, 0], ["expectedType", ::Ice::T_string, false, 0] ]) @@ -937,7 +937,7 @@ def to_s end end - T_MemoryLimitException = ::Ice::__defineException('::Ice::MemoryLimitException', MemoryLimitException, false, ::Ice::T_MarshalException, []) + T_MemoryLimitException = ::Ice::__defineException('::Ice::MemoryLimitException', MemoryLimitException, ::Ice::T_MarshalException, []) end if not defined?(::Ice::StringConversionException) @@ -951,7 +951,7 @@ def to_s end end - T_StringConversionException = ::Ice::__defineException('::Ice::StringConversionException', StringConversionException, false, ::Ice::T_MarshalException, []) + T_StringConversionException = ::Ice::__defineException('::Ice::StringConversionException', StringConversionException, ::Ice::T_MarshalException, []) end if not defined?(::Ice::EncapsulationException) @@ -965,7 +965,7 @@ def to_s end end - T_EncapsulationException = ::Ice::__defineException('::Ice::EncapsulationException', EncapsulationException, false, ::Ice::T_MarshalException, []) + T_EncapsulationException = ::Ice::__defineException('::Ice::EncapsulationException', EncapsulationException, ::Ice::T_MarshalException, []) end if not defined?(::Ice::FeatureNotSupportedException) @@ -981,7 +981,7 @@ def to_s attr_accessor :unsupportedFeature end - T_FeatureNotSupportedException = ::Ice::__defineException('::Ice::FeatureNotSupportedException', FeatureNotSupportedException, false, nil, [["unsupportedFeature", ::Ice::T_string, false, 0]]) + T_FeatureNotSupportedException = ::Ice::__defineException('::Ice::FeatureNotSupportedException', FeatureNotSupportedException, nil, [["unsupportedFeature", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::SecurityException) @@ -997,7 +997,7 @@ def to_s attr_accessor :reason end - T_SecurityException = ::Ice::__defineException('::Ice::SecurityException', SecurityException, false, nil, [["reason", ::Ice::T_string, false, 0]]) + T_SecurityException = ::Ice::__defineException('::Ice::SecurityException', SecurityException, nil, [["reason", ::Ice::T_string, false, 0]]) end if not defined?(::Ice::FixedProxyException) @@ -1010,7 +1010,7 @@ def to_s end end - T_FixedProxyException = ::Ice::__defineException('::Ice::FixedProxyException', FixedProxyException, false, nil, []) + T_FixedProxyException = ::Ice::__defineException('::Ice::FixedProxyException', FixedProxyException, nil, []) end if not defined?(::Ice::ResponseSentException) @@ -1023,6 +1023,6 @@ def to_s end end - T_ResponseSentException = ::Ice::__defineException('::Ice::ResponseSentException', ResponseSentException, false, nil, []) + T_ResponseSentException = ::Ice::__defineException('::Ice::ResponseSentException', ResponseSentException, nil, []) end end diff --git a/ruby/src/IceRuby/Operation.cpp b/ruby/src/IceRuby/Operation.cpp index d160a58feb5..b40cbc7833d 100644 --- a/ruby/src/IceRuby/Operation.cpp +++ b/ruby/src/IceRuby/Operation.cpp @@ -588,14 +588,6 @@ IceRuby::OperationI::unmarshalException(const vector& bytes, const Ice: if(validateException(ex)) { - util.updateSlicedData(); - - Ice::SlicedDataPtr slicedData = r.getSlicedData(); - if(slicedData) - { - StreamUtil::setSlicedDataMember(ex, slicedData); - } - return ex; } else diff --git a/ruby/src/IceRuby/Types.cpp b/ruby/src/IceRuby/Types.cpp index 504fa5b7f8e..e23bc80474a 100644 --- a/ruby/src/IceRuby/Types.cpp +++ b/ruby/src/IceRuby/Types.cpp @@ -317,8 +317,8 @@ IceRuby::StreamUtil::setSlicedDataMember(VALUE obj, const Ice::SlicedDataPtr& sl } // -// Instances of preserved class and exception types may have a data member -// named _ice_slicedData which is an instance of the Ruby class Ice::SlicedData. +// Instances of class types may have a data member named _ice_slicedData which is an instance of the Ruby class +// Ice::SlicedData. This data member is only set for unmarshaled instances. // Ice::SlicedDataPtr IceRuby::StreamUtil::getSlicedDataMember(VALUE obj, ValueMap* valueMap) @@ -1969,8 +1969,7 @@ IceRuby::DictionaryInfo::destroy() // ClassInfo implementation. // IceRuby::ClassInfo::ClassInfo(VALUE ident, bool loc) : - compactId(-1), isBase(false), isLocal(loc), preserve(false), interface(false), rubyClass(Qnil), typeObj(Qnil), - defined(false) + compactId(-1), isBase(false), isLocal(loc), interface(false), rubyClass(Qnil), typeObj(Qnil), defined(false) { const_cast(id) = getString(ident); if (isLocal) @@ -1991,7 +1990,7 @@ IceRuby::ClassInfo::init() } void -IceRuby::ClassInfo::define(VALUE t, VALUE compact, VALUE pres, VALUE intf, VALUE b, VALUE m) +IceRuby::ClassInfo::define(VALUE t, VALUE compact, VALUE intf, VALUE b, VALUE m) { if(!NIL_P(b)) { @@ -2000,7 +1999,6 @@ IceRuby::ClassInfo::define(VALUE t, VALUE compact, VALUE pres, VALUE intf, VALUE } const_cast(compactId) = static_cast(getInteger(compact)); - const_cast(preserve) = RTEST(pres); const_cast(interface) = RTEST(intf); convertDataMembers(m, const_cast(members), const_cast(optionalMembers), true); const_cast(rubyClass) = t; @@ -2477,15 +2475,10 @@ IceRuby::ValueWriter::ice_preMarshal() void IceRuby::ValueWriter::_iceWrite(Ice::OutputStream* os) const { - Ice::SlicedDataPtr slicedData; - - if(_info && _info->preserve) - { - // - // Retrieve the SlicedData object that we stored as a hidden member of the Ruby object. - // - slicedData = StreamUtil::getSlicedDataMember(_object, const_cast(_map)); - } + // + // Retrieve the SlicedData object that we stored as a hidden member of the Ruby object. + // + Ice::SlicedDataPtr slicedData = StreamUtil::getSlicedDataMember(_object, const_cast(_map)); os->startValue(slicedData); if(_formal && _formal->interface) @@ -2626,7 +2619,7 @@ IceRuby::ValueReader::_iceRead(Ice::InputStream* is) } } - _slicedData = is->endValue(_info->preserve); + _slicedData = is->endValue(); if(_slicedData) { @@ -2848,8 +2841,7 @@ IceRuby::ExceptionReader::ExceptionReader(const ExceptionInfoPtr& info) : IceRuby::ExceptionReader::ExceptionReader(const ExceptionReader& reader) : _info(reader._info), - _ex(reader._ex), - _slicedData(reader._slicedData) + _ex(reader._ex) { rb_gc_register_address(&_ex); } @@ -2891,8 +2883,6 @@ IceRuby::ExceptionReader::_read(Ice::InputStream* is) const_cast(_ex) = _info->unmarshal(is); rb_gc_register_address(&_ex); - - const_cast(_slicedData) = is->endException(_info->preserve); } bool @@ -2907,12 +2897,6 @@ IceRuby::ExceptionReader::getException() const return _ex; } -Ice::SlicedDataPtr -IceRuby::ExceptionReader::getSlicedData() const -{ - return _slicedData; -} - extern "C" VALUE IceRuby_defineEnum(VALUE /*self*/, VALUE id, VALUE type, VALUE enumerators) @@ -3032,15 +3016,13 @@ IceRuby_declareLocalClass(VALUE /*self*/, VALUE id) extern "C" VALUE -IceRuby_defineException(VALUE /*self*/, VALUE id, VALUE type, VALUE preserve, VALUE base, VALUE members) +IceRuby_defineException(VALUE /*self*/, VALUE id, VALUE type, VALUE base, VALUE members) { ICE_RUBY_TRY { ExceptionInfoPtr info = make_shared(); info->id = getString(id); - info->preserve = preserve == Qtrue; - if(!NIL_P(base)) { info->base = dynamic_pointer_cast(getException(base)); @@ -3091,15 +3073,14 @@ IceRuby_TypeInfo_defineProxy(VALUE self, VALUE type, VALUE base, VALUE interface extern "C" VALUE -IceRuby_TypeInfo_defineClass(VALUE self, VALUE type, VALUE compactId, VALUE preserve, VALUE interface, VALUE base, - VALUE members) +IceRuby_TypeInfo_defineClass(VALUE self, VALUE type, VALUE compactId, VALUE interface, VALUE base, VALUE members) { ICE_RUBY_TRY { ClassInfoPtr info = dynamic_pointer_cast(getType(self)); assert(info); - info->define(type, compactId, preserve, interface, base, members); + info->define(type, compactId, interface, base, members); if(info->compactId != -1) { @@ -3218,9 +3199,9 @@ IceRuby::initTypes(VALUE iceModule) rb_define_module_function(iceModule, "__declareProxy", CAST_METHOD(IceRuby_declareProxy), 1); rb_define_module_function(iceModule, "__declareClass", CAST_METHOD(IceRuby_declareClass), 1); rb_define_module_function(iceModule, "__declareLocalClass", CAST_METHOD(IceRuby_declareLocalClass), 1); - rb_define_module_function(iceModule, "__defineException", CAST_METHOD(IceRuby_defineException), 5); + rb_define_module_function(iceModule, "__defineException", CAST_METHOD(IceRuby_defineException), 4); - rb_define_method(_typeInfoClass, "defineClass", CAST_METHOD(IceRuby_TypeInfo_defineClass), 6); + rb_define_method(_typeInfoClass, "defineClass", CAST_METHOD(IceRuby_TypeInfo_defineClass), 5); rb_define_method(_typeInfoClass, "defineProxy", CAST_METHOD(IceRuby_TypeInfo_defineProxy), 3); rb_define_module_function(iceModule, "__stringify", CAST_METHOD(IceRuby_stringify), 2); diff --git a/ruby/src/IceRuby/Types.h b/ruby/src/IceRuby/Types.h index 5d36281c893..1d96bb28195 100644 --- a/ruby/src/IceRuby/Types.h +++ b/ruby/src/IceRuby/Types.h @@ -379,7 +379,7 @@ class ClassInfo final : public TypeInfo, public std::enable_shared_from_this void printMembers(VALUE, IceUtilInternal::Output&, PrintObjectHistory*); std::string id; - bool preserve; ExceptionInfoPtr base; DataMemberList members; DataMemberList optionalMembers; @@ -541,8 +539,6 @@ class ExceptionReader final : public Ice::UserException VALUE getException() const; - Ice::SlicedDataPtr getSlicedData() const; - protected: void _writeImpl(Ice::OutputStream*) const final {} @@ -552,7 +548,6 @@ class ExceptionReader final : public Ice::UserException ExceptionInfoPtr _info; VALUE _ex; - Ice::SlicedDataPtr _slicedData; }; ClassInfoPtr lookupClassInfo(std::string_view); diff --git a/ruby/test/Ice/optional/Test.ice b/ruby/test/Ice/optional/Test.ice index 5e840228fcc..123bd1452da 100644 --- a/ruby/test/Ice/optional/Test.ice +++ b/ruby/test/Ice/optional/Test.ice @@ -115,7 +115,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/ruby/test/Ice/slicing/exceptions/AllTests.rb b/ruby/test/Ice/slicing/exceptions/AllTests.rb index c7ac5a6a2d8..0090b5dbd03 100644 --- a/ruby/test/Ice/slicing/exceptions/AllTests.rb +++ b/ruby/test/Ice/slicing/exceptions/AllTests.rb @@ -193,75 +193,5 @@ def allTests(helper, communicator) end puts "ok" - print "unknown most derived in compact format... " - STDOUT.flush - begin - t.unknownMostDerived2AsBaseCompact() - test(false) - rescue Test::Base - # - # For the 1.0 encoding, the unknown exception is sliced to Base. - # - test(t.ice_getEncodingVersion() == Ice::Encoding_1_0) - rescue Ice::UnknownUserException - # - # An UnkonwnUserException is raised for the compact format because the - # most-derived type is unknown and the exception cannot be sliced. - # - test(t.ice_getEncodingVersion() != Ice::Encoding_1_0) - rescue - test(false) - end - puts "ok" - - print "preserved exceptions... " - STDOUT.flush - - begin - t.knownPreservedAsBase() - test(false) - rescue Test::KnownPreservedDerived => ex - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - rescue - test(false) - end - - begin - t.knownPreservedAsKnownPreserved() - test(false) - rescue Test::KnownPreservedDerived => ex - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - rescue - test(false) - end - - begin - t.unknownPreservedAsBase() - test(false) - rescue Test::KnownPreservedDerived => ex - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - rescue - test(false) - end - - begin - t.unknownPreservedAsKnownPreserved() - test(false) - rescue Test::KnownPreservedDerived => ex - test(ex.b == "base") - test(ex.kp == "preserved") - test(ex.kpd == "derived") - rescue - test(false) - end - - puts "ok" - return t end diff --git a/ruby/test/Ice/slicing/exceptions/Test.ice b/ruby/test/Ice/slicing/exceptions/Test.ice index a16c2319ea7..92cd9ecf6a6 100644 --- a/ruby/test/Ice/slicing/exceptions/Test.ice +++ b/ruby/test/Ice/slicing/exceptions/Test.ice @@ -27,38 +27,13 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -73,20 +48,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/ruby/test/Ice/slicing/objects/AllTests.rb b/ruby/test/Ice/slicing/objects/AllTests.rb index da0f867bf2c..c5bf2ab125d 100644 --- a/ruby/test/Ice/slicing/objects/AllTests.rb +++ b/ruby/test/Ice/slicing/objects/AllTests.rb @@ -304,10 +304,16 @@ def allTests(helper, communicator) b2 = b1.pb test(b2) test(b2.sb == "D3.sb") - test(b2.ice_id() == "::Test::B") # Sliced by server test(b2.pb == b1) + p3 = b2 - test(!p3.is_a?(Test::D3)) + if t.ice_getEncodingVersion() == Ice::Encoding_1_0 + test(!p3.is_a?(Test::D3)) + else + test(p3.is_a?(Test::D3)) + test(p3.pd3 == p1) + test(p3.sd3 == "D3.sd3") + end test(b1 != d1) test(b1 != d3) @@ -336,20 +342,27 @@ def allTests(helper, communicator) test(b1) test(b1.sb == "D3.sb") - test(b1.ice_id() == "::Test::B") # Sliced by server - p1 = b1 - test(!p1.is_a?(Test::D3)) b2 = b1.pb test(b2) test(b2.sb == "D1.sb") test(b2.ice_id() == "::Test::D1") test(b2.pb == b1) + p3 = b2 test(p3.is_a?(Test::D1)) test(p3.sd1 == "D1.sd1") test(p3.pd1 == b1) + p1 = b1 + if t.ice_getEncodingVersion() == Ice::Encoding_1_0 + test(!p1.is_a?(Test::D3)) + else + test(p1.is_a?(Test::D3)) + test(p1.pd3 == b2) + test(p1.sd3 == "D3.sd3") + end + test(b1 != d1) test(b1 != d3) test(b2 != d1) @@ -422,9 +435,24 @@ def allTests(helper, communicator) r = t.returnTest3(d3, b2) test(r) - test(r.ice_id() == "::Test::B") test(r.sb == "D3.sb") test(r.pb == r) + + p3 = r + if t.ice_getEncodingVersion() == Ice::Encoding_1_0 + test(!p3.is_a?(Test::D3)) + else + test(p3.is_a?(Test::D3)) + + test(p3.sb == "D3.sb") + test(p3.pb == r) + test(p3.sd3 == "D3.sd3") + + test(p3.pd3.ice_id() == "::Test::B") + test(p3.pd3.sb == "B.sb(1)") + test(p3.pd3.pb == p3.pd3) + end + rescue Ice::Exception test(false) end @@ -452,11 +480,20 @@ def allTests(helper, communicator) d12.pd1 = d11 r = t.returnTest3(d3, d12) + test(r) - test(r.ice_id() == "::Test::B") test(r.sb == "D3.sb") test(r.pb == r) - rescue Ice::Exception + p3 = r + if t.ice_getEncodingVersion() == Ice::Encoding_1_0 + test(!p3.is_a?(Test::D3)) + else + test(p3.is_a?(Test::D3)) + test(p3.sd3 == "D3.sd3") + test(p3.pd3.ice_id() == "::Test::D1") + end + + rescue Ice::Exception test(false) end puts "ok" @@ -528,11 +565,18 @@ def allTests(helper, communicator) test(ss1b.ice_id() == "::Test::B") test(ss1d1.ice_id() == "::Test::D1") - test(ss1d3.ice_id() == "::Test::B") test(ss2b.ice_id() == "::Test::B") test(ss2d1.ice_id() == "::Test::D1") - test(ss2d3.ice_id() == "::Test::B") + + if t.ice_getEncodingVersion() == Ice::Encoding_1_0 + test(ss1d3.ice_id() == "::Test::B") + test(ss2d3.ice_id() == "::Test::B") + else + test(ss1d3.ice_id() == "::Test::D3") + test(ss2d3.ice_id() == "::Test::D3") + end + rescue Ice::Exception test(false) end @@ -698,9 +742,16 @@ def allTests(helper, communicator) pu.pu = "preserved" r = t.exchangePBase(pu) - test(!r.is_a?(Test::PCUnknown)) test(r.pi == 3) + p2 = r + if t.ice_getEncodingVersion() == Ice::Encoding_1_0 + test(!p2.is_a?(Test::PCUnknown)) + else + test(p2.is_a?(Test::PCUnknown)) + test(p2.pu == "preserved") + end + # # Server only knows the intermediate type Preserved. The object will be sliced to # Preserved for the 1.0 encoding; otherwise it should be returned intact. diff --git a/ruby/test/Ice/slicing/objects/ClientPrivate.ice b/ruby/test/Ice/slicing/objects/ClientPrivate.ice index cd5e1ec84ea..b2a3f882931 100644 --- a/ruby/test/Ice/slicing/objects/ClientPrivate.ice +++ b/ruby/test/Ice/slicing/objects/ClientPrivate.ice @@ -15,7 +15,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/ruby/test/Ice/slicing/objects/Test.ice b/ruby/test/Ice/slicing/objects/Test.ice index b50a94d0c7a..f9efdaea22c 100644 --- a/ruby/test/Ice/slicing/objects/Test.ice +++ b/ruby/test/Ice/slicing/objects/Test.ice @@ -70,7 +70,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -86,13 +85,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] exception PreservedException { } diff --git a/scripts/tests/Ice/slicing/objects.py b/scripts/tests/Ice/slicing/objects.py index 201dd23d2d3..912a56b9878 100644 --- a/scripts/tests/Ice/slicing/objects.py +++ b/scripts/tests/Ice/slicing/objects.py @@ -14,5 +14,4 @@ props={"Ice.Default.EncodingVersion": "1.0"}, ), ], - options={"valgrind": [False]}, ) diff --git a/slice/Glacier2/PermissionsVerifier.ice b/slice/Glacier2/PermissionsVerifier.ice index 4b9875ad400..60ae27a11d9 100644 --- a/slice/Glacier2/PermissionsVerifier.ice +++ b/slice/Glacier2/PermissionsVerifier.ice @@ -21,7 +21,6 @@ module Glacier2 { /// This exception is raised if a client is denied the ability to create a session with the router. - ["preserve-slice"] exception PermissionDeniedException { /// The reason why permission was denied. diff --git a/slice/Glacier2/Session.ice b/slice/Glacier2/Session.ice index 9c449d6e314..f2321593ffb 100644 --- a/slice/Glacier2/Session.ice +++ b/slice/Glacier2/Session.ice @@ -23,7 +23,6 @@ module Glacier2 { /// This exception is raised if an attempt to create a new session failed. - ["preserve-slice"] exception CannotCreateSessionException { /// The reason why session creation has failed. diff --git a/swift/Rakefile b/swift/Rakefile index 99eb9c19091..4110a256d89 100644 --- a/swift/Rakefile +++ b/swift/Rakefile @@ -78,10 +78,8 @@ $test_extra_sources = { "TwowaysAMI.swift"], "Ice/servantLocator" => ["ServantLocatorI.swift"], - "Ice/slicing/exceptions/Client" => ["ClientPrivate.ice"], "Ice/slicing/exceptions/Server" => ["ServerPrivate.ice"], "Ice/slicing/exceptions/ServerAMD" => ["ServerPrivateAMD.ice"], - "Ice/slicing/objects/Client" => ["ClientPrivate.ice"], "Ice/slicing/objects/Server" => ["ServerPrivate.ice"], "Ice/slicing/objects/ServerAMD" => ["ServerPrivateAMD.ice"], diff --git a/swift/src/Ice/Exception.swift b/swift/src/Ice/Exception.swift index 688feb000ac..22a5b4dc725 100644 --- a/swift/src/Ice/Exception.swift +++ b/swift/src/Ice/Exception.swift @@ -64,22 +64,14 @@ open class UserException: Exception { open func _iceRead(from istr: InputStream) throws { istr.startException() try _iceReadImpl(from: istr) - try istr.endException(preserve: false) + try istr.endException() } open func _iceWrite(to ostr: OutputStream) { - ostr.startException(data: nil) + ostr.startException() _iceWriteImpl(to: ostr) ostr.endException() } - - /// Returns the sliced data if the exception has a preserved-slice base class and has been sliced during - /// un-marshaling, nil is returned otherwise. - /// - /// - returns: `SlicedData?` - The sliced data or nil. - open func ice_getSlicedData() -> SlicedData? { - return nil - } } /// Error used to wrap C++ std::exception errors. diff --git a/swift/src/Ice/InputStream.swift b/swift/src/Ice/InputStream.swift index 36dcf53966a..35c4d1c179a 100644 --- a/swift/src/Ice/InputStream.swift +++ b/swift/src/Ice/InputStream.swift @@ -312,13 +312,11 @@ public class InputStream { /// Marks the end of a class instance. /// - /// - parameter preserve: `Bool` - True if unknown slices should be preserved, false otherwise. - /// /// - returns: `Ice.SlicedData` - A SlicedData object containing the preserved slices for unknown types. @discardableResult - public func endValue(preserve: Bool) throws -> SlicedData? { + public func endValue() throws -> SlicedData? { precondition(encaps.decoder != nil) - return try encaps.decoder.endInstance(preserve: preserve) + return try encaps.decoder.endInstance() } /// Marks the start of a user exception. @@ -329,14 +327,11 @@ public class InputStream { /// Marks the end of a user exception. /// - /// - parameter preserve: `Bool` - True if unknown slices should be preserved, false otherwise. - /// /// - returns: `Ice.SlicedData?` - A `SlicedData` object containing the preserved slices for unknown /// types. - @discardableResult - public func endException(preserve: Bool) throws -> SlicedData? { + public func endException() throws { precondition(encaps.decoder != nil) - return try encaps.decoder.endInstance(preserve: preserve) + _ = try encaps.decoder.endInstance() } func initEncaps() { @@ -903,7 +898,7 @@ private protocol EncapsDecoder: AnyObject { func throwException() throws func startInstance(type: SliceType) - func endInstance(preserve: Bool) throws -> SlicedData? + func endInstance() throws -> SlicedData? func startSlice() throws -> String func endSlice() throws func skipSlice() throws @@ -1199,7 +1194,7 @@ private class EncapsDecoder10: EncapsDecoder { skipFirstSlice = true } - func endInstance(preserve _: Bool) throws -> SlicedData? { + func endInstance() throws -> SlicedData? { // // Read the Ice::Value slice. // @@ -1477,11 +1472,8 @@ private class EncapsDecoder11: EncapsDecoder { current.skipFirstSlice = true } - func endInstance(preserve: Bool) throws -> SlicedData? { - var slicedData: SlicedData? - if preserve { - slicedData = try readSlicedData() - } + func endInstance() throws -> SlicedData? { + let slicedData = try readSlicedData() current.slices.removeAll() current.indirectionTables.removeAll() @@ -1611,37 +1603,38 @@ private class EncapsDecoder11: EncapsDecoder { } // - // Preserve this slice. + // Preserve this slice if unmarshalling a value in Slice format. Exception slices are not preserved. // - let hasOptionalMembers = current.sliceFlags.contains(.FLAG_HAS_OPTIONAL_MEMBERS) - let isLastSlice = current.sliceFlags.contains(.FLAG_IS_LAST_SLICE) - var dataEnd = stream.pos + if current.sliceType == .ValueSlice { + let hasOptionalMembers = current.sliceFlags.contains(.FLAG_HAS_OPTIONAL_MEMBERS) + let isLastSlice = current.sliceFlags.contains(.FLAG_IS_LAST_SLICE) + var dataEnd = stream.pos - if hasOptionalMembers { - // - // Don't include the optional member end marker. It will be re-written by - // endSlice when the sliced data is re-written. - // - dataEnd -= 1 - } + if hasOptionalMembers { + // + // Don't include the optional member end marker. It will be re-written by + // endSlice when the sliced data is re-written. + // + dataEnd -= 1 + } - let bytes = stream.data.subdata(in: start ..< dataEnd) // copy + let bytes = stream.data.subdata(in: start ..< dataEnd) // copy - let info = SliceInfo(typeId: current.typeId, - compactId: current.compactId, - bytes: bytes, - instances: [], - hasOptionalMembers: hasOptionalMembers, - isLastSlice: isLastSlice) + let info = SliceInfo(typeId: current.typeId, + compactId: current.compactId, + bytes: bytes, + instances: [], + hasOptionalMembers: hasOptionalMembers, + isLastSlice: isLastSlice) + + current.slices.append(info) + } // // Read the indirect instance table. We read the instances or their - // IDs if the instance is a reference to an already unmarhsaled + // IDs if the instance is a reference to an already unmarhshaled // instance. // - // The SliceInfo object sequence is initialized only if - // readSlicedData is called. - // if current.sliceFlags.contains(.FLAG_HAS_INDIRECTION_TABLE) { var indirectionTable = try [Int32](repeating: 0, count: Int(stream.readAndCheckSeqSize(minSize: 1))) @@ -1652,8 +1645,6 @@ private class EncapsDecoder11: EncapsDecoder { } else { current.indirectionTables.append([]) } - - current.slices.append(info) } func readOptional(tag: Int32, format: OptionalFormat) throws -> Bool { diff --git a/swift/src/Ice/OutputStream.swift b/swift/src/Ice/OutputStream.swift index cee117c6465..d229bc05563 100644 --- a/swift/src/Ice/OutputStream.swift +++ b/swift/src/Ice/OutputStream.swift @@ -101,11 +101,9 @@ public class OutputStream { } /// Marks the start of a user exception. - /// - /// - parameter data: `Ice.SlicedData` Preserved slices for this exception, or nil. - public func startException(data: SlicedData?) { + public func startException() { precondition(encaps.encoder != nil) - encaps.encoder.startInstance(type: .ExceptionSlice, data: data) + encaps.encoder.startInstance(type: .ExceptionSlice, data: nil) } /// Marks the end of a user exception. @@ -520,6 +518,8 @@ public extension OutputStream { /// - parameter _: `UserException` - The user exception to write. func write(_ v: UserException) { initEncaps() + // Exceptions are always encoded with the sliced format. + encaps.format = FormatType.SlicedFormat encaps.encoder.writeException(v: v) } diff --git a/swift/src/Ice/UnknownSlicedValue.swift b/swift/src/Ice/UnknownSlicedValue.swift index 5126a3b441a..adf84acb01f 100644 --- a/swift/src/Ice/UnknownSlicedValue.swift +++ b/swift/src/Ice/UnknownSlicedValue.swift @@ -5,7 +5,6 @@ /// Unknown sliced value holds an instance of an unknown Slice class type. public final class UnknownSlicedValue: Value { private let unknownTypeId: String - private var slicedData: SlicedData? public required init() { unknownTypeId = "" @@ -25,22 +24,4 @@ public final class UnknownSlicedValue: Value { override public class func ice_staticId() -> String { return "::Ice::UnknownSlicedValue" } - - /// Returns the sliced data if the value has a preserved-slice base class and has been sliced during - /// un-marshaling of the value, nil is returned otherwise. - /// - /// - returns: `Ice.SlicedData?` - The sliced data or nil. - override public func ice_getSlicedData() -> SlicedData? { - return slicedData - } - - override public func _iceRead(from ins: InputStream) throws { - ins.startValue() - slicedData = try ins.endValue(preserve: true) - } - - override public func _iceWrite(to os: OutputStream) { - os.startValue(data: slicedData) - os.endValue() - } } diff --git a/swift/src/Ice/Value.swift b/swift/src/Ice/Value.swift index 7c22a468c44..d12b2496e42 100644 --- a/swift/src/Ice/Value.swift +++ b/swift/src/Ice/Value.swift @@ -4,6 +4,8 @@ // The base class for all Ice values. open class Value { + private var slicedData: SlicedData? + public required init() {} /// Returns the Slice type ID of the most-derived interface supported by this object. @@ -31,17 +33,17 @@ open class Value { /// /// - returns: `SlicedData?` - The sliced data or nil. open func ice_getSlicedData() -> SlicedData? { - return nil + return slicedData } open func _iceRead(from istr: InputStream) throws { istr.startValue() try _iceReadImpl(from: istr) - try istr.endValue(preserve: false) + slicedData = try istr.endValue() } open func _iceWrite(to os: OutputStream) { - os.startValue(data: nil) + os.startValue(data: slicedData) _iceWriteImpl(to: os) os.endValue() } diff --git a/swift/test/Ice/optional/AllTests.swift b/swift/test/Ice/optional/AllTests.swift index 2dc4a093805..25f94a804cb 100644 --- a/swift/test/Ice/optional/AllTests.swift +++ b/swift/test/Ice/optional/AllTests.swift @@ -11,7 +11,7 @@ class TestValueReader: Ice.Value { istr.startValue() _ = try istr.startSlice() try istr.endSlice() - _ = try istr.endValue(preserve: false) + _ = try istr.endValue() } } @@ -26,7 +26,7 @@ class BValueReader: Ice.Value { _ = try istr.startSlice() _ = try istr.read() as Int32 try istr.endSlice() - _ = try istr.endValue(preserve: false) + _ = try istr.endValue() } } @@ -44,7 +44,7 @@ class CValueReader: Ice.Value { _ = try istr.startSlice() _ = try istr.read() as Int32 try istr.endSlice() - _ = try istr.endValue(preserve: false) + _ = try istr.endValue() } } @@ -114,7 +114,7 @@ class DValueReader: Ice.Value { _ = try istr.startSlice() _ = try istr.read() as Int32 try istr.endSlice() - _ = try istr.endValue(preserve: false) + _ = try istr.endValue() } func check() throws { @@ -138,7 +138,7 @@ class FValueReader: Ice.Value { _ = try istr.startSlice() try istr.read(A.self) { self._f.ae = $0 } try istr.endSlice() - _ = try istr.endValue(preserve: false) + _ = try istr.endValue() } public func getF() -> F? { diff --git a/swift/test/Ice/optional/Test.ice b/swift/test/Ice/optional/Test.ice index ca580eb6e23..6a2445240e2 100644 --- a/swift/test/Ice/optional/Test.ice +++ b/swift/test/Ice/optional/Test.ice @@ -119,7 +119,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB = 0; diff --git a/swift/test/Ice/optional/TestAMD.ice b/swift/test/Ice/optional/TestAMD.ice index a75838ac760..b893476529a 100644 --- a/swift/test/Ice/optional/TestAMD.ice +++ b/swift/test/Ice/optional/TestAMD.ice @@ -119,7 +119,6 @@ class A optional(500) int mc; } -["preserve-slice"] class B extends A { int requiredB; diff --git a/swift/test/Ice/slicing/exceptions/AllTests.swift b/swift/test/Ice/slicing/exceptions/AllTests.swift index c7496600de7..a6c283680f4 100644 --- a/swift/test/Ice/slicing/exceptions/AllTests.swift +++ b/swift/test/Ice/slicing/exceptions/AllTests.swift @@ -438,160 +438,5 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { }.wait() output.writeLine("ok") - output.write("unknown most derived in compact format... ") - do { - try testPrx.unknownMostDerived2AsBaseCompact() - try test(false) - } catch is Base { - // - // For the 1.0 encoding, the unknown exception is sliced to Base. - // - try test(testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0) - } catch is Ice.UnknownUserException { - // - // A MarshalException is raised for the compact format because the - // most-derived type is unknown and the exception cannot be sliced. - // - try test(testPrx.ice_getEncodingVersion() != Ice.Encoding_1_0) - } catch is Ice.OperationNotExistException {} - output.writeLine("ok") - - output.write("preserved exceptions... ") - do { - try testPrx.unknownPreservedAsBase() - try test(false) - } catch let ex as Base { - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(ex.ice_getSlicedData() == nil) - } else { - let slicedData = ex.ice_getSlicedData()! - try test(slicedData.slices.count == 2) - try test(slicedData.slices[1].typeId == "::Test::SPreserved1") - try test(slicedData.slices[0].typeId == "::Test::SPreserved2") - } - } - - do { - try testPrx.unknownPreservedAsKnownPreserved() - try test(false) - } catch let ex as KnownPreserved { - try test(ex.kp == "preserved") - if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { - try test(ex.ice_getSlicedData() == nil) - } else { - let slicedData = ex.ice_getSlicedData()! - try test(slicedData.slices.count == 2) - try test(slicedData.slices[1].typeId == "::Test::SPreserved1") - try test(slicedData.slices[0].typeId == "::Test::SPreserved2") - } - } - - do { - let adapter = try communicator.createObjectAdapter("") - let relay = try uncheckedCast(prx: adapter.addWithUUID(RelayDisp(RelayI())), - type: RelayPrx.self) - try adapter.activate() - try testPrx.ice_getConnection()!.setAdapter(adapter) - - do { - try testPrx.relayKnownPreservedAsBase(relay) - try test(false) - } catch let ex as KnownPreservedDerived { - try test(ex.b == "base") - try test(ex.kp == "preserved") - try test(ex.kpd == "derived") - } catch is Ice.OperationNotExistException {} - - do { - try testPrx.relayKnownPreservedAsKnownPreserved(relay) - try test(false) - } catch let ex as KnownPreservedDerived { - try test(ex.b == "base") - try test(ex.kp == "preserved") - try test(ex.kpd == "derived") - } catch is Ice.OperationNotExistException {} - - do { - try testPrx.relayUnknownPreservedAsBase(relay) - try test(false) - } catch let ex as Preserved2 { - try test(ex.b == "base") - try test(ex.kp == "preserved") - try test(ex.kpd == "derived") - try test(ex.p1!.ice_id() == PreservedClass.ice_staticId()) - let pc = ex.p1 as? PreservedClass - try test(pc!.bc == "bc") - try test(pc!.pc == "pc") - try test(ex.p2 === ex.p1) - } catch let ex as KnownPreservedDerived { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - try test(testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0) - try test(ex.b == "base") - try test(ex.kp == "preserved") - try test(ex.kpd == "derived") - } catch is Ice.OperationNotExistException {} - - do { - try testPrx.relayUnknownPreservedAsKnownPreserved(relay) - try test(false) - } catch let ex as Preserved2 { - try test(ex.b == "base") - try test(ex.kp == "preserved") - try test(ex.kpd == "derived") - try test(ex.p1!.ice_id() == PreservedClass.ice_staticId()) - let pc = ex.p1 as? PreservedClass - try test(pc!.bc == "bc") - try test(pc!.pc == "pc") - try test(ex.p2 === ex.p1) - } catch let ex as KnownPreservedDerived { - // - // For the 1.0 encoding, the unknown exception is sliced to KnownPreserved. - // - try test(testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0) - try test(ex.b == "base") - try test(ex.kp == "preserved") - try test(ex.kpd == "derived") - } catch is Ice.OperationNotExistException {} - - adapter.destroy() - } - output.writeLine("ok") - return testPrx } - -class RelayI: Relay { - func knownPreservedAsBase(current _: Current) throws { - throw KnownPreservedDerived(b: "base", - kp: "preserved", - kpd: "derived") - } - - func knownPreservedAsKnownPreserved(current _: Current) throws { - throw KnownPreservedDerived(b: "base", - kp: "preserved", - kpd: "derived") - } - - func unknownPreservedAsBase(current _: Current) throws { - let ex = Preserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = PreservedClass(bc: "bc", pc: "pc") - ex.p2 = ex.p1 - throw ex - } - - func unknownPreservedAsKnownPreserved(current _: Current) throws { - let ex = Preserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = PreservedClass(bc: "bc", pc: "pc") - ex.p2 = ex.p1 - throw ex - } -} diff --git a/swift/test/Ice/slicing/exceptions/ClientPrivate.ice b/swift/test/Ice/slicing/exceptions/ClientPrivate.ice deleted file mode 100644 index 017c8112d2a..00000000000 --- a/swift/test/Ice/slicing/exceptions/ClientPrivate.ice +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright (c) ZeroC, Inc. All rights reserved. -// - -#pragma once - -#include - -[["swift:class-resolver-prefix:IceSlicingExceptionsClient"]] - -module Test -{ - -class PreservedClass extends BaseClass -{ - string pc; -} - -exception Preserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception Preserved2 extends Preserved1 -{ - BaseClass p2; -} - -} diff --git a/swift/test/Ice/slicing/exceptions/ServerPrivate.ice b/swift/test/Ice/slicing/exceptions/ServerPrivate.ice index 4b6621cecdc..6deaae5d57a 100644 --- a/swift/test/Ice/slicing/exceptions/ServerPrivate.ice +++ b/swift/test/Ice/slicing/exceptions/ServerPrivate.ice @@ -31,19 +31,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/swift/test/Ice/slicing/exceptions/ServerPrivateAMD.ice b/swift/test/Ice/slicing/exceptions/ServerPrivateAMD.ice index 4013ffe5176..27cc317fed8 100644 --- a/swift/test/Ice/slicing/exceptions/ServerPrivateAMD.ice +++ b/swift/test/Ice/slicing/exceptions/ServerPrivateAMD.ice @@ -31,19 +31,4 @@ exception UnknownMostDerived2 extends UnknownIntermediate string umd2; } -class SPreservedClass extends BaseClass -{ - string spc; -} - -exception SPreserved1 extends KnownPreservedDerived -{ - BaseClass p1; -} - -exception SPreserved2 extends SPreserved1 -{ - BaseClass p2; -} - } diff --git a/swift/test/Ice/slicing/exceptions/Test.ice b/swift/test/Ice/slicing/exceptions/Test.ice index fd05ecc04a1..e466ed04cc0 100644 --- a/swift/test/Ice/slicing/exceptions/Test.ice +++ b/swift/test/Ice/slicing/exceptions/Test.ice @@ -28,38 +28,14 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; + void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -74,20 +50,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/swift/test/Ice/slicing/exceptions/TestAMD.ice b/swift/test/Ice/slicing/exceptions/TestAMD.ice index 4918c494953..f3d957b0695 100644 --- a/swift/test/Ice/slicing/exceptions/TestAMD.ice +++ b/swift/test/Ice/slicing/exceptions/TestAMD.ice @@ -28,38 +28,14 @@ exception KnownMostDerived extends KnownIntermediate string kmd; } -["preserve-slice"] -exception KnownPreserved extends Base -{ - string kp; -} - -exception KnownPreservedDerived extends KnownPreserved -{ - string kpd; -} - -["preserve-slice"] -class BaseClass -{ - string bc; -} - -["format:sliced"] -interface Relay -{ - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; -} - ["amd", "format:sliced"] interface TestIntf { void baseAsBase() throws Base; - void unknownDerivedAsBase() throws Base; + + // Test that the compact metadata is ignored (exceptions are always encoded with the sliced format). + ["format:compact"] void unknownDerivedAsBase() throws Base; + void knownDerivedAsBase() throws Base; void knownDerivedAsKnownDerived() throws KnownDerived; @@ -74,20 +50,6 @@ interface TestIntf void unknownMostDerived1AsKnownIntermediate() throws KnownIntermediate; void unknownMostDerived2AsBase() throws Base; - ["format:compact"] void unknownMostDerived2AsBaseCompact() throws Base; - - void knownPreservedAsBase() throws Base; - void knownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayKnownPreservedAsBase(Relay* r) throws Base; - void relayKnownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - - void unknownPreservedAsBase() throws Base; - void unknownPreservedAsKnownPreserved() throws KnownPreserved; - - void relayUnknownPreservedAsBase(Relay* r) throws Base; - void relayUnknownPreservedAsKnownPreserved(Relay* r) throws KnownPreserved; - void shutdown(); } diff --git a/swift/test/Ice/slicing/exceptions/TestAMDI.swift b/swift/test/Ice/slicing/exceptions/TestAMDI.swift index 58c3465d056..59c5ab56e83 100644 --- a/swift/test/Ice/slicing/exceptions/TestAMDI.swift +++ b/swift/test/Ice/slicing/exceptions/TestAMDI.swift @@ -99,90 +99,6 @@ class TestI: TestIntf { } } - func unknownMostDerived2AsBaseCompactAsync(current _: Current) -> Promise { - return Promise { _ in - throw UnknownMostDerived2(b: "UnknownMostDerived2.b", - ui: "UnknownMostDerived2.ui", - umd2: "UnknownMostDerived2.umd2") - } - } - - func knownPreservedAsBaseAsync(current _: Current) -> Promise { - return Promise { _ in - throw KnownPreservedDerived(b: "base", - kp: "preserved", - kpd: "derived") - } - } - - func knownPreservedAsKnownPreservedAsync(current _: Current) -> Promise { - return Promise { _ in - throw KnownPreservedDerived(b: "base", - kp: "preserved", - kpd: "derived") - } - } - - func relayKnownPreservedAsBaseAsync(r: RelayPrx?, current: Current) -> Promise { - return Promise { _ in - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.knownPreservedAsBase() - try _helper.test(false) - } - } - - func relayKnownPreservedAsKnownPreservedAsync(r: RelayPrx?, current: Current) -> Promise { - return Promise { _ in - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.knownPreservedAsKnownPreserved() - try _helper.test(false) - } - } - - func unknownPreservedAsBaseAsync(current _: Current) -> Promise { - return Promise { _ in - let ex = SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = SPreservedClass(bc: "bc", spc: "spc") - ex.p2 = ex.p1 - throw ex - } - } - - func unknownPreservedAsKnownPreservedAsync(current _: Current) -> Promise { - return Promise { _ in - let ex = SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = SPreservedClass(bc: "bc", spc: "spc") - ex.p2 = ex.p1 - throw ex - } - } - - func relayUnknownPreservedAsBaseAsync(r: RelayPrx?, current: Current) -> Promise { - return Promise { _ in - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.unknownPreservedAsBase() - try _helper.test(false) - } - } - - func relayUnknownPreservedAsKnownPreservedAsync(r: RelayPrx?, current: Current) -> Promise { - return Promise { _ in - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.unknownPreservedAsKnownPreserved() - try _helper.test(false) - } - } - func shutdownAsync(current: Current) -> Promise { return Promise { seal in current.adapter!.getCommunicator().shutdown() diff --git a/swift/test/Ice/slicing/exceptions/TestI.swift b/swift/test/Ice/slicing/exceptions/TestI.swift index ac4bf2b25c7..21083f44cd3 100644 --- a/swift/test/Ice/slicing/exceptions/TestI.swift +++ b/swift/test/Ice/slicing/exceptions/TestI.swift @@ -72,72 +72,6 @@ class TestI: TestIntf { umd2: "UnknownMostDerived2.umd2") } - func unknownMostDerived2AsBaseCompact(current _: Current) throws { - throw UnknownMostDerived2(b: "UnknownMostDerived2.b", - ui: "UnknownMostDerived2.ui", - umd2: "UnknownMostDerived2.umd2") - } - - func knownPreservedAsBase(current _: Current) throws { - throw KnownPreservedDerived(b: "base", - kp: "preserved", - kpd: "derived") - } - - func knownPreservedAsKnownPreserved(current _: Current) throws { - throw KnownPreservedDerived(b: "base", - kp: "preserved", - kpd: "derived") - } - - func relayKnownPreservedAsBase(r: RelayPrx?, current: Current) throws { - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.knownPreservedAsBase() - try _helper.test(false) - } - - func relayKnownPreservedAsKnownPreserved(r: RelayPrx?, current: Current) throws { - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.knownPreservedAsKnownPreserved() - try _helper.test(false) - } - - func unknownPreservedAsBase(current _: Current) throws { - let ex = SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = SPreservedClass(bc: "bc", spc: "spc") - ex.p2 = ex.p1 - throw ex - } - - func unknownPreservedAsKnownPreserved(current _: Current) throws { - let ex = SPreserved2() - ex.b = "base" - ex.kp = "preserved" - ex.kpd = "derived" - ex.p1 = SPreservedClass(bc: "bc", spc: "spc") - ex.p2 = ex.p1 - throw ex - } - - func relayUnknownPreservedAsBase(r: RelayPrx?, current: Current) throws { - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.unknownPreservedAsBase() - try _helper.test(false) - } - - func relayUnknownPreservedAsKnownPreserved(r: RelayPrx?, current: Current) throws { - let p = try uncheckedCast(prx: current.con!.createProxy(r!.ice_getIdentity()), - type: RelayPrx.self) - try p.unknownPreservedAsKnownPreserved() - try _helper.test(false) - } - func shutdown(current: Current) throws { current.adapter!.getCommunicator().shutdown() } diff --git a/swift/test/Ice/slicing/objects/AllTests.swift b/swift/test/Ice/slicing/objects/AllTests.swift index 52e107c99c0..840dc692234 100644 --- a/swift/test/Ice/slicing/objects/AllTests.swift +++ b/swift/test/Ice/slicing/objects/AllTests.swift @@ -19,6 +19,13 @@ private func breakCycles(_ value: Value) { if let d2 = value as? D2 { d2.pd2 = nil } + if let d3 = value as? D3 { + let tmp = d3.pd3 + d3.pd3 = nil + if tmp != nil, tmp! !== d3 { + breakCycles(tmp!) + } + } if let d4 = value as? D4 { d4.p1 = nil d4.p2 = nil @@ -26,6 +33,14 @@ private func breakCycles(_ value: Value) { if let b = value as? B { b.pb?.pb = nil b.pb = nil + let tmp = b.pb + b.pb = nil + if tmp != nil, tmp! !== b { + breakCycles(tmp!) + } + if b.ice_getSlicedData() != nil { + b.ice_getSlicedData()?.clear() + } } if let p = value as? Preserved { p.ice_getSlicedData()?.clear() @@ -641,9 +656,10 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { output.write("return value identity with known first... ") do { - let (ret, p1, _) = try testPrx.returnTest1() + let (ret, p1, p2) = try testPrx.returnTest1() try test(ret === p1) breakCycles(ret!) + breakCycles(p2!) } output.writeLine("ok") @@ -651,9 +667,10 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try Promise { seal in firstly { testPrx.returnTest1Async() - }.done { r, p1, _ in + }.done { r, p1, p2 in try test(r === p1) breakCycles(r!) + breakCycles(p2!) seal.fulfill(()) }.catch { e in seal.reject(e) @@ -700,19 +717,28 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try test(b1.sb == "D1.sb") try test(b1.ice_id() == "::Test::D1") - if let p1 = b1 as? D1 { - try test(p1.sd1 == "D1.sd1") - try test(p1.pd1 === b1.pb) + let p1 = b1 as? D1 + if p1 !== nil { + try test(p1!.sd1 == "D1.sd1") + try test(p1!.pd1 === b1.pb) } else { try test(false) } let b2 = b1.pb! try test(b2.sb == "D3.sb") - // Sliced by server - try test(b2.ice_id() == "::Test::B") try test(b2.pb === b1) - try test(!(b2 is D3)) + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(b2 is D3)) + } else { + if let p3 = b2 as? D3 { + try test(p3.pd3 === p1!) + try test(p3.sd3 == "D3.sd3") + } else { + try test(false) + } + } try test(b1 !== d1) try test(b1 !== d3) @@ -747,19 +773,29 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try test(b1.sb == "D1.sb") try test(b1.ice_id() == "::Test::D1") - if let p1 = b1 as? D1 { - try test(p1.sd1 == "D1.sd1") - try test(p1.pd1 === b1.pb) + let p1 = b1 as? D1 + if p1 !== nil { + try test(p1!.sd1 == "D1.sd1") + try test(p1!.pd1 === b1.pb) } else { try test(false) } let b2 = b1.pb! try test(b2.sb == "D3.sb") - // Sliced by server - try test(b2.ice_id() == "::Test::B") try test(b2.pb === b1) - try test(!(b2 is D3)) + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(b2 is D3)) + } else { + if let p3 = b2 as? D3 { + try test(p3.pd3 === p1!) + try test(p3.sd3 == "D3.sd3") + } else { + try test(false) + } + } + try test(b1 !== d1) try test(b1 !== d3) try test(b2 !== d1) @@ -791,9 +827,6 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { let b1 = try testPrx.returnTest3(p1: d3, p2: d1)! try test(b1.sb == "D3.sb") - try test(b1.ice_id() == "::Test::B") // Sliced by server - - try test(!(b1 is D3)) let b2 = b1.pb! try test(b2.sb == "D1.sb") @@ -806,6 +839,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try test(false) } + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(b1 is D3)) + } else { + if let p1 = b1 as? D3 { + try test(p1.sd3 == "D3.sd3") + try test(p1.pd3 === b2) + } else { + try test(false) + } + } + try test(b1 !== d1) try test(b1 !== d3) try test(b2 !== d1) @@ -838,9 +882,6 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { let b1 = b! try test(b1.sb == "D3.sb") - try test(b1.ice_id() == "::Test::B") // Sliced by server - - try test(!(b1 is D3)) let b2 = b1.pb! try test(b2.sb == "D1.sb") @@ -853,6 +894,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try test(false) } + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(b1 is D3)) + } else { + if let p1 = b1 as? D3 { + try test(p1.sd3 == "D3.sd3") + try test(p1.pd3 === b2) + } else { + try test(false) + } + } + try test(b1 !== d1) try test(b1 !== d3) try test(b2 !== d1) @@ -988,9 +1040,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { let ret = try testPrx.returnTest3(p1: d3, p2: b2)! - try test(ret.ice_id() == "::Test::B") try test(ret.sb == "D3.sb") try test(ret.pb === ret) + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(ret is D3)) + } else { + if let p3 = ret as? D3 { + try test(p3.sd3 == "D3.sd3") + try test(p3.pd3!.ice_id() == "::Test::B") + try test(p3.pd3!.sb == "B.sb(1)") + try test(p3.pd3!.pb === p3.pd3) + } else { + try test(false) + } + } + breakCycles(ret) breakCycles(b1) breakCycles(d3) @@ -1018,9 +1083,22 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { }.done { r in try test(r != nil) let ret = r! - try test(ret.ice_id() == "::Test::B") try test(ret.sb == "D3.sb") try test(ret.pb === ret) + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(ret is D3)) + } else { + if let p3 = ret as? D3 { + try test(p3.sd3 == "D3.sd3") + try test(p3.pd3!.ice_id() == "::Test::B") + try test(p3.pd3!.sb == "B.sb(1)") + try test(p3.pd3!.pb === p3.pd3) + } else { + try test(false) + } + } + breakCycles(ret) breakCycles(b1) breakCycles(d3) @@ -1051,7 +1129,6 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { d12.pd1 = d11 let ret = try testPrx.returnTest3(p1: d3, p2: d12)! - try test(ret.ice_id() == "::Test::B") try test(ret.sb == "D3.sb") try test(ret.pb === ret) breakCycles(d3) @@ -1085,7 +1162,6 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { }.done { r in try test(r != nil) let ret = r! - try test(ret.ice_id() == "::Test::B") try test(ret.sb == "D3.sb") try test(ret.pb === ret) breakCycles(d3) @@ -1166,11 +1242,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try test(ss1b2!.ice_id() == "::Test::B") try test(ss1d2!.ice_id() == "::Test::D1") - try test(ss1d4!.ice_id() == "::Test::B") try test(ss2b2!.ice_id() == "::Test::B") try test(ss2d2!.ice_id() == "::Test::D1") - try test(ss2d4!.ice_id() == "::Test::B") + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(ss1d4!.ice_id() == "::Test::B") + try test(ss2d4!.ice_id() == "::Test::B") + } else { + try test(ss1d4!.ice_id() == "::Test::D3") + try test(ss2d4!.ice_id() == "::Test::D3") + } breakCycles(ss.c1!) breakCycles(ss.c2!) @@ -1246,11 +1328,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { try test(ss1b2!.ice_id() == "::Test::B") try test(ss1d2!.ice_id() == "::Test::D1") - try test(ss1d4!.ice_id() == "::Test::B") try test(ss2b2!.ice_id() == "::Test::B") try test(ss2d2!.ice_id() == "::Test::D1") - try test(ss2d4!.ice_id() == "::Test::B") + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(ss1d4!.ice_id() == "::Test::B") + try test(ss2d4!.ice_id() == "::Test::B") + } else { + try test(ss1d4!.ice_id() == "::Test::D3") + try test(ss2d4!.ice_id() == "::Test::D3") + } breakCycles(ss.c1!) breakCycles(ss.c2!) @@ -1626,8 +1714,18 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { pu.pu = "preserved" let r = try testPrx.exchangePBase(pu)! - try test(!(r is PCUnknown)) try test(r.pi == 3) + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(r is PCUnknown)) + } else { + if let p2 = r as? PCUnknown { + try test(p2.pu == "preserved") + } else { + try test(false) + } + } + breakCycles(r) } catch is Ice.OperationNotExistException {} @@ -1800,8 +1898,17 @@ public func allTests(_ helper: TestHelper) throws -> TestIntfPrx { testPrx.exchangePBaseAsync(pu) }.done { ret in let r = ret! - try test(!(r is PCUnknown)) - try test(r.pi == 3) + + if testPrx.ice_getEncodingVersion() == Ice.Encoding_1_0 { + try test(!(r is PCUnknown)) + } else { + if let p2 = r as? PCUnknown { + try test(p2.pu == "preserved") + } else { + try test(false) + } + } + breakCycles(r) seal.fulfill(()) }.catch { e in diff --git a/swift/test/Ice/slicing/objects/ClientPrivate.ice b/swift/test/Ice/slicing/objects/ClientPrivate.ice index 67cf66a7323..ce848109eae 100644 --- a/swift/test/Ice/slicing/objects/ClientPrivate.ice +++ b/swift/test/Ice/slicing/objects/ClientPrivate.ice @@ -17,7 +17,6 @@ class D3 extends B B pd3; } -["preserve-slice"] class PCUnknown extends PBase { string pu; diff --git a/swift/test/Ice/slicing/objects/ServerPrivate.ice b/swift/test/Ice/slicing/objects/ServerPrivate.ice index 36892bc126a..6a6baa8430b 100644 --- a/swift/test/Ice/slicing/objects/ServerPrivate.ice +++ b/swift/test/Ice/slicing/objects/ServerPrivate.ice @@ -57,9 +57,4 @@ class PSUnknown2 extends Preserved PBase pb; } -exception PSUnknownException extends PreservedException -{ - PSUnknown2 p; -} - } diff --git a/swift/test/Ice/slicing/objects/ServerPrivateAMD.ice b/swift/test/Ice/slicing/objects/ServerPrivateAMD.ice index 31228ab5613..10517cb979d 100644 --- a/swift/test/Ice/slicing/objects/ServerPrivateAMD.ice +++ b/swift/test/Ice/slicing/objects/ServerPrivateAMD.ice @@ -57,9 +57,4 @@ class PSUnknown2 extends Preserved PBase pb; } -exception PSUnknownException extends PreservedException -{ - PSUnknown2 p; -} - } diff --git a/swift/test/Ice/slicing/objects/Test.ice b/swift/test/Ice/slicing/objects/Test.ice index 3e9164301f7..ef32328328d 100644 --- a/swift/test/Ice/slicing/objects/Test.ice +++ b/swift/test/Ice/slicing/objects/Test.ice @@ -72,7 +72,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -88,17 +87,11 @@ class CompactPDerived(56) extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] -exception PreservedException -{ -} - ["format:sliced"] interface TestIntf { @@ -150,7 +143,6 @@ interface TestIntf void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - ["amd"] void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ diff --git a/swift/test/Ice/slicing/objects/TestAMD.ice b/swift/test/Ice/slicing/objects/TestAMD.ice index 28787be71e3..93aa97d8b5c 100644 --- a/swift/test/Ice/slicing/objects/TestAMD.ice +++ b/swift/test/Ice/slicing/objects/TestAMD.ice @@ -72,7 +72,6 @@ class PBase sequence PBaseSeq; -["preserve-slice"] class Preserved extends PBase { string ps; @@ -83,17 +82,11 @@ class PDerived extends Preserved PBase pb; } -["preserve-slice"] class PNode { PNode next; } -["preserve-slice"] -exception PreservedException -{ -} - ["amd", "format:sliced"] interface TestIntf { @@ -145,7 +138,6 @@ interface TestIntf void throwDerivedAsBase() throws BaseException; void throwDerivedAsDerived() throws DerivedException; void throwUnknownDerivedAsBase() throws BaseException; - void throwPreservedException() throws PreservedException; void useForward(out Forward f); /* Use of forward-declared class to verify that code is generated correctly. */ diff --git a/swift/test/Ice/slicing/objects/TestAMDI.swift b/swift/test/Ice/slicing/objects/TestAMDI.swift index 0d05c4df33d..152da6bea43 100644 --- a/swift/test/Ice/slicing/objects/TestAMDI.swift +++ b/swift/test/Ice/slicing/objects/TestAMDI.swift @@ -452,17 +452,6 @@ class TestI: TestIntf { } } - func throwPreservedExceptionAsync(current _: Current) -> Promise { - return Promise { _ in - let ue = PSUnknownException() - ue.p = PSUnknown2() - ue.p!.pi = 5 - ue.p!.ps = "preserved" - ue.p!.pb = ue.p - throw ue - } - } - func useForwardAsync(current _: Current) -> Promise { return Promise { seal in let f = Forward() diff --git a/swift/test/Ice/slicing/objects/TestI.swift b/swift/test/Ice/slicing/objects/TestI.swift index 47ec2c100f6..2f0837586c9 100644 --- a/swift/test/Ice/slicing/objects/TestI.swift +++ b/swift/test/Ice/slicing/objects/TestI.swift @@ -476,20 +476,6 @@ class TestI: TestIntf { throw ude } - func throwPreservedExceptionAsync(current: Current) -> Promise { - return Promise { seal in - try current.adapter!.getDispatchQueue().async(flags: .barrier) { - let ue = PSUnknownException() - ue.p = PSUnknown2() - ue.p!.pi = 5 - ue.p!.ps = "preserved" - ue.p!.pb = ue.p - seal.reject(ue) // Ice marshals the error immediately - ue.p!.pb = nil // break the cycle - } - } - } - func useForward(current _: Current) throws -> Forward? { let f = Forward() f.h = Hidden()