summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/include/Ice/Exception.h18
-rw-r--r--cpp/include/Ice/Object.h18
-rw-r--r--cpp/include/Ice/Stream.h10
-rw-r--r--cpp/src/Freeze/TransactionalEvictorI.cpp6
-rw-r--r--cpp/src/Ice/Exception.cpp45
-rw-r--r--cpp/src/Ice/Object.cpp45
-rw-r--r--cpp/src/Ice/OpaqueEndpointI.h4
-rw-r--r--cpp/src/Ice/OutgoingAsync.cpp5
-rw-r--r--cpp/src/IceSSL/EndpointI.h4
-rw-r--r--cpp/src/slice2cpp/Gen.cpp304
-rw-r--r--cpp/src/slice2cs/Gen.cpp298
-rw-r--r--cpp/src/slice2java/Gen.cpp239
-rw-r--r--cpp/test/Ice/background/EndpointI.h4
-rw-r--r--cs/src/Ice/Exception.cs43
-rw-r--r--cs/src/Ice/Object.cs36
-rw-r--r--java/src/Ice/Object.java4
-rw-r--r--java/src/Ice/ObjectImpl.java40
-rw-r--r--java/src/Ice/UserException.java54
18 files changed, 602 insertions, 575 deletions
diff --git a/cpp/include/Ice/Exception.h b/cpp/include/Ice/Exception.h
index 7d0d85656ea..413bdd34bba 100644
--- a/cpp/include/Ice/Exception.h
+++ b/cpp/include/Ice/Exception.h
@@ -15,6 +15,7 @@
#include <Ice/Format.h>
#include <Ice/Handle.h>
#include <Ice/ObjectF.h>
+#include <Ice/StreamF.h>
namespace IceInternal
{
@@ -56,11 +57,22 @@ public:
virtual UserException* ice_clone() const = 0;
virtual void ice_throw() const = 0;
- virtual void __write(::IceInternal::BasicStream*) const = 0;
- virtual void __read(::IceInternal::BasicStream*) = 0;
-
+ virtual void __write(::IceInternal::BasicStream*) const;
+ virtual void __read(::IceInternal::BasicStream*);
+
+ virtual void __write(const OutputStreamPtr&) const;
+ virtual void __read(const InputStreamPtr&);
+
virtual bool __usesClasses() const;
virtual void __usesClasses(bool);
+
+protected:
+
+ virtual void __writeImpl(::IceInternal::BasicStream*) const = 0;
+ virtual void __readImpl(::IceInternal::BasicStream*) = 0;
+
+ virtual void __writeImpl(const OutputStreamPtr&) const;
+ virtual void __readImpl(const InputStreamPtr&);
};
typedef ::IceInternal::Handle<UserException> UserExceptionPtr;
diff --git a/cpp/include/Ice/Object.h b/cpp/include/Ice/Object.h
index b60443de61a..f4b83294666 100644
--- a/cpp/include/Ice/Object.h
+++ b/cpp/include/Ice/Object.h
@@ -95,14 +95,12 @@ public:
virtual DispatchStatus __dispatch(IceInternal::Incoming&, const Current&);
virtual DispatchStatus __collocDispatch(IceInternal::Direct&);
- virtual void __write(IceInternal::BasicStream*) const {}
- virtual void __writeImpl(IceInternal::BasicStream*) const {}
- virtual void __read(IceInternal::BasicStream*) {}
- virtual void __readImpl(IceInternal::BasicStream*) {}
-
- virtual void __write(const OutputStreamPtr&) const {}
- virtual void __read(const InputStreamPtr&) {}
+ virtual void __write(IceInternal::BasicStream*) const;
+ virtual void __read(IceInternal::BasicStream*);
+ virtual void __write(const OutputStreamPtr&) const;
+ virtual void __read(const InputStreamPtr&);
+
//
// Virtual methods to support garbage collection of Slice class instances. These
// methods are overriden by Slice classes which can have cycles.
@@ -119,6 +117,12 @@ protected:
Object() {} // This class is abstract.
virtual ~Object() {}
+ virtual void __writeImpl(IceInternal::BasicStream*) const {}
+ virtual void __readImpl(IceInternal::BasicStream*) {}
+
+ virtual void __writeImpl(const OutputStreamPtr&) const;
+ virtual void __readImpl(const InputStreamPtr&);
+
static void __checkMode(OperationMode, OperationMode);
};
diff --git a/cpp/include/Ice/Stream.h b/cpp/include/Ice/Stream.h
index d398bca39d1..e40c6ead949 100644
--- a/cpp/include/Ice/Stream.h
+++ b/cpp/include/Ice/Stream.h
@@ -71,6 +71,11 @@ public:
virtual void __write(IceInternal::BasicStream*) const;
virtual void __read(IceInternal::BasicStream*);
+#ifdef __SUNPRO_CC
+ using UserException::__read;
+ using UserException::__write;
+#endif
+
protected:
const CommunicatorPtr _communicator;
@@ -397,6 +402,11 @@ public:
virtual void __write(IceInternal::BasicStream*) const;
virtual void __read(IceInternal::BasicStream*);
+#ifdef __SUNPRO_CC
+ using UserException::__read;
+ using UserException::__write;
+#endif
+
protected:
const CommunicatorPtr _communicator;
diff --git a/cpp/src/Freeze/TransactionalEvictorI.cpp b/cpp/src/Freeze/TransactionalEvictorI.cpp
index d41e0e1f3ec..594d8f1a599 100644
--- a/cpp/src/Freeze/TransactionalEvictorI.cpp
+++ b/cpp/src/Freeze/TransactionalEvictorI.cpp
@@ -81,11 +81,11 @@ Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& ada
_currentEvictorSize(0)
{
- class DipatchInterceptorAdapter : public Ice::DispatchInterceptor
+ class DispatchInterceptorAdapter : public Ice::DispatchInterceptor
{
public:
- DipatchInterceptorAdapter(const TransactionalEvictorIPtr& evictor) :
+ DispatchInterceptorAdapter(const TransactionalEvictorIPtr& evictor) :
_evictor(evictor)
{
}
@@ -100,7 +100,7 @@ Freeze::TransactionalEvictorI::TransactionalEvictorI(const ObjectAdapterPtr& ada
TransactionalEvictorIPtr _evictor;
};
- _interceptor = new DipatchInterceptorAdapter(this);
+ _interceptor = new DispatchInterceptorAdapter(this);
string propertyPrefix = string("Freeze.Evictor.") + envName + '.' + _filename;
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index 724a306017f..91b1377230b 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -12,6 +12,8 @@
#include <Ice/Network.h>
#include <Ice/Plugin.h>
#include <Ice/SlicedData.h>
+#include <Ice/BasicStream.h>
+#include <Ice/Stream.h>
#include <IceUtil/StringUtil.h>
#ifdef ICE_OS_WINRT
# include <IceUtil/Unicode.h>
@@ -83,7 +85,50 @@ throwMarshalException(const char* file, int line, const string& reason)
}
}
+}
+void
+Ice::UserException::__write(::IceInternal::BasicStream* os) const
+{
+ os->startWriteException(0);
+ __writeImpl(os);
+ os->endWriteException();
+}
+
+void
+Ice::UserException::__read(::IceInternal::BasicStream* is)
+{
+ is->startReadException();
+ __readImpl(is);
+ is->endReadException(false);
+}
+
+void
+Ice::UserException::__write(const Ice::OutputStreamPtr& os) const
+{
+ os->startException(0);
+ __writeImpl(os);
+ os->endException();
+}
+
+void
+Ice::UserException::__read(const Ice::InputStreamPtr& is)
+{
+ is->startException();
+ __readImpl(is);
+ is->endException(false);
+}
+
+void
+Ice::UserException::__writeImpl(const Ice::OutputStreamPtr&) const
+{
+ throw MarshalException(__FILE__, __LINE__, "user exception was not generated with stream support");
+}
+
+void
+Ice::UserException::__readImpl(const Ice::InputStreamPtr&)
+{
+ throw MarshalException(__FILE__, __LINE__, "user exception was not generated with stream support");
}
bool
diff --git a/cpp/src/Ice/Object.cpp b/cpp/src/Ice/Object.cpp
index 096bf434b5f..93256b730d0 100644
--- a/cpp/src/Ice/Object.cpp
+++ b/cpp/src/Ice/Object.cpp
@@ -248,6 +248,50 @@ Ice::Object::__collocDispatch(IceInternal::Direct& request)
return request.run(this);
}
+void
+Ice::Object::__write(IceInternal::BasicStream* os) const
+{
+ os->startWriteObject(0);
+ __writeImpl(os);
+ os->endWriteObject();
+}
+
+void
+Ice::Object::__read(IceInternal::BasicStream* is)
+{
+ is->startReadObject();
+ __readImpl(is);
+ is->endReadObject(false);
+}
+
+void
+Ice::Object::__write(const OutputStreamPtr& os) const
+{
+ os->startObject(0);
+ __writeImpl(os);
+ os->endObject();
+}
+
+void
+Ice::Object::__read(const InputStreamPtr& is)
+{
+ is->startObject();
+ __readImpl(is);
+ is->endObject(false);
+}
+
+void
+Ice::Object::__writeImpl(const OutputStreamPtr&) const
+{
+ throw MarshalException(__FILE__, __LINE__, "class was not generated with stream support");
+}
+
+void
+Ice::Object::__readImpl(const InputStreamPtr&)
+{
+ throw MarshalException(__FILE__, __LINE__, "class was not generated with stream support");
+}
+
namespace
{
@@ -401,6 +445,7 @@ Ice::BlobjectArrayAsync::__dispatch(Incoming& in, const Current& current)
}
return DispatchAsync;
}
+
void
Ice::ice_writeObject(const OutputStreamPtr& out, const ObjectPtr& p)
{
diff --git a/cpp/src/Ice/OpaqueEndpointI.h b/cpp/src/Ice/OpaqueEndpointI.h
index c9e3e05a20d..7e303d68205 100644
--- a/cpp/src/Ice/OpaqueEndpointI.h
+++ b/cpp/src/Ice/OpaqueEndpointI.h
@@ -44,6 +44,10 @@ public:
virtual bool operator==(const Ice::LocalObject&) const;
virtual bool operator<(const Ice::LocalObject&) const;
+#ifdef __SUNPRO_CC
+ using EndpointI::connectionId;
+#endif
+
protected:
virtual ::Ice::Int hashInit() const;
diff --git a/cpp/src/Ice/OutgoingAsync.cpp b/cpp/src/Ice/OutgoingAsync.cpp
index f608b6f434b..126fa243ddc 100644
--- a/cpp/src/Ice/OutgoingAsync.cpp
+++ b/cpp/src/Ice/OutgoingAsync.cpp
@@ -1039,6 +1039,11 @@ IceInternal::CommunicatorBatchOutgoingAsync::flushConnection(const ConnectionIPt
return false;
}
+#ifdef __SUNPRO_CC
+ using BatchOutgoingAsync::__sent;
+#endif
+
+
virtual void __finished(const Ice::LocalException& ex, bool)
{
_remoteObserver.failed(ex.ice_name());
diff --git a/cpp/src/IceSSL/EndpointI.h b/cpp/src/IceSSL/EndpointI.h
index d551bd0626a..7a7602a16d7 100644
--- a/cpp/src/IceSSL/EndpointI.h
+++ b/cpp/src/IceSSL/EndpointI.h
@@ -48,6 +48,10 @@ public:
virtual bool operator==(const Ice::LocalObject&) const;
virtual bool operator<(const Ice::LocalObject&) const;
+#ifdef __SUNPRO_CC
+ using IceInternal::EndpointI::connectionId;
+#endif
+
private:
virtual ::Ice::Int hashInit() const;
diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp
index 3d89df4997b..88db0da48c4 100644
--- a/cpp/src/slice2cpp/Gen.cpp
+++ b/cpp/src/slice2cpp/Gen.cpp
@@ -406,15 +406,13 @@ Slice::Gen::generate(const UnitPtr& p)
{
C << "\n#include <Ice/LocalException.h>";
}
+
+ H << "\n#include <Ice/StreamF.h>";
if(_stream)
{
- H << "\n#include <Ice/Stream.h>";
- }
- else
- {
- H << "\n#include <Ice/StreamF.h>";
- }
+ C << "\n#include <Ice/Stream.h>";
+ }
}
if(p->hasContentsWithMetaData("preserve-slice"))
@@ -872,35 +870,69 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
ExceptionPtr base = p->base();
bool basePreserved = p->inheritsMetaData("preserve-slice");
- bool preserved = basePreserved || p->hasMetaData("preserve-slice");
+ bool preserved = p->hasMetaData("preserve-slice");
- H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ if(preserved && !basePreserved)
+ {
+ H << sp << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ H << nl << "virtual void __read(::IceInternal::BasicStream*);";
+
+ if(_stream)
+ {
+ H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
+ H << nl << "virtual void __read(const ::Ice::InputStreamPtr&);";
+ }
+ else
+ {
+ string baseName = base ? fixKwd(base->scoped()) : string("::Ice::UserException");
+ H << nl << "#ifdef __SUNPRO_CC";
+ H << nl << "using " << baseName << "::__write;";
+ H << nl << "using " << baseName << "::__read;";
+ H << nl << "#endif";
+ }
+ }
+
+ H.dec();
+ H << sp << nl << "protected:";
+ H.inc();
+
H << nl << "virtual void __writeImpl(::IceInternal::BasicStream*) const;";
- H << nl << "virtual void __read(::IceInternal::BasicStream*);";
H << nl << "virtual void __readImpl(::IceInternal::BasicStream*);";
- H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
- H << nl << "virtual void __read(const ::Ice::InputStreamPtr&);";
if(_stream)
{
H << nl << "virtual void __writeImpl(const ::Ice::OutputStreamPtr&) const;";
H << nl << "virtual void __readImpl(const ::Ice::InputStreamPtr&);";
}
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- if(preserved)
- {
- C << nl << "__os->startWriteException(__slicedData);";
- }
else
{
- C << nl << "__os->startWriteException(0);";
+ string baseName = base ? fixKwd(base->scoped()) : string("::Ice::UserException");
+ H << nl << "#ifdef __SUNPRO_CC";
+ H << nl << "using " << baseName << "::__writeImpl;";
+ H << nl << "using " << baseName << "::__readImpl;";
+ H << nl << "#endif";
}
- C << nl << "__writeImpl(__os);";
- C << nl << "__os->endWriteException();";
- C << eb;
+ if(preserved && !basePreserved)
+ {
+
+ H << sp << nl << "::Ice::SlicedDataPtr __slicedData;";
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
+ C << nl << "__os->startWriteException(__slicedData);";
+ C << nl << "__writeImpl(__os);";
+ C << nl << "__os->endWriteException();";
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
+ C << sb;
+ C << nl << "__is->startReadException();";
+ C << nl << "__readImpl(__is);";
+ C << nl << "__slicedData = __is->endReadException(true);";
+ C << eb;
+ }
+
C << sp << nl << "void" << nl << scoped.substr(2) << "::__writeImpl(::IceInternal::BasicStream* __os) const";
C << sb;
C << nl << "__os->startWriteSlice(\"" << p->scoped() << "\", " << (!base ? "true" : "false") << ");";
@@ -912,20 +944,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
- C << sb;
- C << nl << "__is->startReadException();";
- C << nl << "__readImpl(__is);";
- if(preserved)
- {
- C << nl << "__slicedData = __is->endReadException(true);";
- }
- else
- {
- C << nl << "__is->endReadException(false);";
- }
- C << eb;
-
C << sp << nl << "void" << nl << scoped.substr(2) << "::__readImpl(::IceInternal::BasicStream* __is)";
C << sb;
C << nl << "__is->startReadSlice();";
@@ -939,19 +957,22 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(_stream)
{
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __os) const";
- C << sb;
- if(preserved)
+ if(preserved && !basePreserved)
{
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __os) const";
+ C << sb;
C << nl << "__os->startException(__slicedData);";
+ C << nl << "__writeImpl(__os);";
+ C << nl << "__os->endException();";
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __is)";
+ C << sb;
+ C << nl << "__is->startException();";
+ C << nl << "__readImpl(__is);";
+ C << nl << "__slicedData = __is->endException(true);";
+ C << eb;
}
- else
- {
- C << nl << "__os->startException(0);";
- }
- C << nl << "__writeImpl(__os);";
- C << nl << "__os->endException();";
- C << eb;
C << sp << nl << "void" << nl << scoped.substr(2)
<< "::__writeImpl(const ::Ice::OutputStreamPtr& __os) const";
@@ -965,20 +986,6 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __is)";
- C << sb;
- C << nl << "__is->startException();";
- C << nl << "__readImpl(__is);";
- if(preserved)
- {
- C << nl << "__slicedData = __is->endException(true);";
- }
- else
- {
- C << nl << "__is->endException(false);";
- }
- C << eb;
-
C << sp << nl << "void" << nl << scoped.substr(2)
<< "::__readImpl(const ::Ice::InputStreamPtr& __is)";
C << sb;
@@ -991,34 +998,8 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
C << eb;
}
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
- C << sb;
- C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
-
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&)";
- C << sb;
- C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"exception " << scoped .substr(2)<< " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
- }
-
- if(preserved && !basePreserved)
- {
- H.zeroIndent();
- H << sp << nl << "protected:";
- H.restoreIndent();
- H << sp << nl << "::Ice::SlicedDataPtr __slicedData;";
- }
+
factoryName = "__F" + p->flattenedScope() + p->name();
C << sp << nl << "struct " << factoryName << " : public ::IceInternal::UserExceptionFactory";
@@ -3648,7 +3629,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
base = bases.front();
}
bool basePreserved = p->inheritsMetaData("preserve-slice");
- bool preserved = basePreserved || p->hasMetaData("preserve-slice");
+ bool preserved = p->hasMetaData("preserve-slice");
if(!p->isLocal())
{
@@ -3790,35 +3771,72 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
}
- H << sp;
- H << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ if(!p->isAbstract())
+ {
+ H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();";
+ }
+
+ if(preserved && !basePreserved)
+ {
+ H << sp;
+ H << nl << "virtual void __write(::IceInternal::BasicStream*) const;";
+ H << nl << "virtual void __read(::IceInternal::BasicStream*);";
+
+ if(_stream)
+ {
+ H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
+ H << nl << "virtual void __read(const ::Ice::InputStreamPtr&);";
+ }
+ else
+ {
+ string baseName = base ? fixKwd(base->scoped()) : string("::Ice::Object");
+ H << nl << "#ifdef __SUNPRO_CC";
+ H << nl << "using " << baseName << "::__write;";
+ H << nl << "using " << baseName << "::__read;";
+ H << nl << "#endif";
+ }
+ }
+
+ H.dec();
+ H << sp << nl << "protected:";
+ H.inc();
+
H << nl << "virtual void __writeImpl(::IceInternal::BasicStream*) const;";
- H << nl << "virtual void __read(::IceInternal::BasicStream*);";
H << nl << "virtual void __readImpl(::IceInternal::BasicStream*);";
- H << nl << "virtual void __write(const ::Ice::OutputStreamPtr&) const;";
- H << nl << "virtual void __read(const ::Ice::InputStreamPtr&);";
if(_stream)
{
H << nl << "virtual void __writeImpl(const ::Ice::OutputStreamPtr&) const;";
H << nl << "virtual void __readImpl(const ::Ice::InputStreamPtr&);";
}
-
- C << sp;
- C << nl << "void" << nl << scoped.substr(2)
- << "::__write(::IceInternal::BasicStream* __os) const";
- C << sb;
- if(preserved)
+ else
{
- C << nl << "__os->startWriteObject(__slicedData);";
+ string baseName = base ? fixKwd(base->scoped()) : string("::Ice::Object");
+ H << nl << "#ifdef __SUNPRO_CC";
+ H << nl << "using " << baseName << "::__writeImpl;";
+ H << nl << "using " << baseName << "::__readImpl;";
+ H << nl << "#endif";
}
- else
+
+ if(preserved && !basePreserved)
{
- C << nl << "__os->startWriteObject(0);";
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2)
+ << "::__write(::IceInternal::BasicStream* __os) const";
+ C << sb;
+ C << nl << "__os->startWriteObject(__slicedData);";
+ C << nl << "__writeImpl(__os);";
+ C << nl << "__os->endWriteObject();";
+ C << eb;
+
+ C << sp;
+ C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
+ C << sb;
+ C << nl << "__is->startReadObject();";
+ C << nl << "__readImpl(__is);";
+ C << nl << "__slicedData = __is->endReadObject(true);";
+ C << eb;
}
- C << nl << "__writeImpl(__os);";
- C << nl << "__os->endWriteObject();";
- C << eb;
C << sp;
C << nl << "void" << nl << scoped.substr(2)
@@ -3834,21 +3852,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
C << eb;
C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(::IceInternal::BasicStream* __is)";
- C << sb;
- C << nl << "__is->startReadObject();";
- C << nl << "__readImpl(__is);";
- if(preserved)
- {
- C << nl << "__slicedData = __is->endReadObject(true);";
- }
- else
- {
- C << nl << "__is->endReadObject(false);";
- }
- C << eb;
-
- C << sp;
C << nl << "void" << nl << scoped.substr(2) << "::__readImpl(::IceInternal::BasicStream* __is)";
C << sb;
C << nl << "__is->startReadSlice();";
@@ -3862,19 +3865,22 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(_stream)
{
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __os) const";
- C << sb;
- if(preserved)
+ if(preserved && !basePreserved)
{
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr& __os) const";
+ C << sb;
C << nl << "__os->startObject(__slicedData);";
+ C << nl << "__writeImpl(__os);";
+ C << nl << "__os->endObject();";
+ C << eb;
+
+ C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __is)";
+ C << sb;
+ C << nl << "__is->startObject();";
+ C << nl << "__readImpl(__is);";
+ C << nl << "__slicedData = __is->endObject(true);";
+ C << eb;
}
- else
- {
- C << nl << "__os->startObject(0);";
- }
- C << nl << "__writeImpl(__os);";
- C << nl << "__os->endObject();";
- C << eb;
C << sp << nl << "void" << nl << scoped.substr(2)
<< "::__writeImpl(const ::Ice::OutputStreamPtr& __os) const";
@@ -3888,20 +3894,6 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
C << eb;
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr& __is)";
- C << sb;
- C << nl << "__is->startObject();";
- C << nl << "__readImpl(__is);";
- if(preserved)
- {
- C << nl << "__slicedData = __is->endObject(true);";
- }
- else
- {
- C << nl << "__is->endObject(false);";
- }
- C << eb;
-
C << sp << nl << "void" << nl << scoped.substr(2) << "::__readImpl(const ::Ice::InputStreamPtr& __is)";
C << sb;
C << nl << "__is->startSlice();";
@@ -3913,31 +3905,9 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
}
C << eb;
}
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- C << sp << nl << "void" << nl << scoped.substr(2) << "::__write(const ::Ice::OutputStreamPtr&) const";
- C << sb;
- C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
-
- C << sp;
- C << nl << "void" << nl << scoped.substr(2) << "::__read(const ::Ice::InputStreamPtr&)";
- C << sb;
- C << nl << "::Ice::MarshalException ex(__FILE__, __LINE__);";
- C << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- C << nl << "throw ex;";
- C << eb;
- }
if(!p->isAbstract())
{
- H << sp << nl << "static const ::Ice::ObjectFactoryPtr& ice_factory();";
-
string factoryName = "__F" + p->flattenedScope() + p->name();
C << sp;
C << nl << "class " << factoryName << " : public ::Ice::ObjectFactory";
@@ -4002,7 +3972,7 @@ Slice::Gen::ObjectVisitor::visitClassDefEnd(const ClassDefPtr& p)
//
// Emit data members. Access visibility may be specified by metadata.
//
- bool inProtected = false;
+ bool inProtected = true;
DataMemberList dataMembers = p->dataMembers();
bool prot = p->hasMetaData("protected");
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp
index 121976a7433..ff4961353d4 100644
--- a/cpp/src/slice2cs/Gen.cpp
+++ b/cpp/src/slice2cs/Gen.cpp
@@ -1131,7 +1131,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
DataMemberList optionalMembers = p->orderedOptionalDataMembers();
DataMemberList classMembers = p->classDataMembers();
const bool basePreserved = p->inheritsMetaData("preserve-slice");
- const bool preserved = basePreserved || p->hasMetaData("preserve-slice");
+ const bool preserved = p->hasMetaData("preserve-slice");
ClassList bases = p->bases();
ClassDefPtr base;
@@ -1142,31 +1142,68 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
_out << sp << nl << "#region Marshaling support";
- _out << sp;
- if(!p->isInterface())
- {
- emitGeneratedCodeAttribute();
- }
- _out << nl << "public override void write__(IceInternal.BasicStream os__)";
- _out << sb;
- if(preserved)
+
+ if(preserved && !basePreserved)
{
+ _out << sp;
+ if(!p->isInterface())
+ {
+ emitGeneratedCodeAttribute();
+ }
+
+ _out << nl << "public override void write__(IceInternal.BasicStream os__)";
+ _out << sb;
_out << nl << "os__.startWriteObject(slicedData__);";
+ _out << nl << "writeImpl__(os__);";
+ _out << nl << "os__.endWriteObject();";
+ _out << eb;
+
+ _out << sp;
+ if(!p->isInterface())
+ {
+ emitGeneratedCodeAttribute();
+ }
+ _out << nl << "public override void read__(IceInternal.BasicStream is__)";
+ _out << sb;
+ _out << nl << "is__.startReadObject();";
+ _out << nl << "readImpl__(is__);";
+ _out << nl << "slicedData__ = is__.endReadObject(true);";
+ _out << eb;
+
+ if(stream)
+ {
+ _out << sp;
+ if(!p->isInterface())
+ {
+ emitGeneratedCodeAttribute();
+ }
+ _out << nl << "public override void write__(Ice.OutputStream outS__)";
+ _out << sb;
+ _out << nl << "outS__.startObject(slicedData__);";
+ _out << nl << "writeImpl__(outS__);";
+ _out << nl << "outS__.endObject();";
+ _out << eb;
+
+ _out << sp;
+ if(!p->isInterface())
+ {
+ emitGeneratedCodeAttribute();
+ }
+ _out << nl << "public override void read__(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << "inS__.startObject();";
+ _out << nl << "readImpl__(inS__);";
+ _out << nl << "slicedData__ = inS__.endObject(true);";
+ _out << eb;
+ }
}
- else
- {
- _out << nl << "os__.startWriteObject(null);";
- }
- _out << nl << "writeImpl__(os__);";
- _out << nl << "os__.endWriteObject();";
- _out << eb;
_out << sp;
if(!p->isInterface())
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void writeImpl__(IceInternal.BasicStream os__)";
+ _out << nl << "protected override void writeImpl__(IceInternal.BasicStream os__)";
_out << sb;
_out << nl << "os__.startWriteSlice(ice_staticId(), " << (!base ? "true" : "false") << ");";
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -1283,31 +1320,13 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
_out << eb;
}
+
_out << sp;
if(!p->isInterface())
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void read__(IceInternal.BasicStream is__)";
- _out << sb;
- _out << nl << "is__.startReadObject();";
- _out << nl << "readImpl__(is__);";
- if(preserved)
- {
- _out << nl << "slicedData__ = is__.endReadObject(true);";
- }
- else
- {
- _out << nl << "is__.endReadObject(false);";
- }
- _out << eb;
-
- _out << sp;
- if(!p->isInterface())
- {
- emitGeneratedCodeAttribute();
- }
- _out << nl << "public override void readImpl__(IceInternal.BasicStream is__)";
+ _out << nl << "protected override void readImpl__(IceInternal.BasicStream is__)";
_out << sb;
_out << nl << "is__.startReadSlice();";
int classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
@@ -1340,26 +1359,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- if(preserved)
- {
- _out << nl << "outS__.startObject(slicedData__);";
- }
- else
- {
- _out << nl << "outS__.startObject(null);";
- }
- _out << nl << "writeImpl__(outS__);";
- _out << nl << "outS__.endObject();";
- _out << eb;
-
- _out << sp;
- if(!p->isInterface())
- {
- emitGeneratedCodeAttribute();
- }
- _out << nl << "public " << (base ? "override" : "virtual") << " void writeImpl__(Ice.OutputStream outS__)";
+ _out << nl << "protected override void writeImpl__(Ice.OutputStream outS__)";
_out << sb;
_out << nl << "outS__.startSlice(ice_staticId(), " << (!base ? "true" : "false") << ");";
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -1385,26 +1385,7 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
{
emitGeneratedCodeAttribute();
}
- _out << nl << "public override void read__(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "inS__.startObject();";
- _out << nl << "readImpl__(inS__);";
- if(preserved)
- {
- _out << nl << "slicedData__ = inS__.endObject(true);";
- }
- else
- {
- _out << nl << "inS__.endObject(false);";
- }
- _out << eb;
-
- _out << sp;
- if(!p->isInterface())
- {
- emitGeneratedCodeAttribute();
- }
- _out << nl << "public " << (base ? "override" : "virtual") << " void readImpl__(Ice.InputStream inS__)";
+ _out << nl << "protected override void readImpl__(Ice.InputStream inS__)";
_out << sb;
_out << nl << "inS__.startSlice();";
classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
@@ -1428,36 +1409,6 @@ Slice::CsVisitor::writeDispatchAndMarshalling(const ClassDefPtr& p, bool stream)
}
_out << eb;
}
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- string scoped = p->scoped();
- _out << sp;
- if(!p->isInterface())
- {
- emitGeneratedCodeAttribute();
- }
- _out << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
-
- _out << sp;
- if(!p->isInterface())
- {
- emitGeneratedCodeAttribute();
- }
- _out << nl << "public override void read__(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
- }
if(preserved && !basePreserved)
{
@@ -3437,27 +3388,53 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
ExceptionPtr base = p->base();
const bool basePreserved = p->inheritsMetaData("preserve-slice");
- const bool preserved = basePreserved || p->hasMetaData("preserve-slice");
+ const bool preserved = p->hasMetaData("preserve-slice");
- _out << sp;
- emitGeneratedCodeAttribute();
- _out << nl << "public override void write__(IceInternal.BasicStream os__)";
- _out << sb;
- if(preserved)
+ if(preserved && !basePreserved)
{
+ _out << sp;
+ emitGeneratedCodeAttribute();
+ _out << nl << "public override void write__(IceInternal.BasicStream os__)";
+ _out << sb;
_out << nl << "os__.startWriteException(slicedData__);";
+ _out << nl << "writeImpl__(os__);";
+ _out << nl << "os__.endWriteException();";
+ _out << eb;
+
+ _out << sp;
+ emitGeneratedCodeAttribute();
+ _out << nl << "public override void read__(IceInternal.BasicStream is__)";
+ _out << sb;
+ _out << nl << "is__.startReadException();";
+ _out << nl << "readImpl__(is__);";
+ _out << nl << "slicedData__ = is__.endReadException(true);";
+ _out << eb;
+
+ if(_stream)
+ {
+ _out << sp;
+ emitGeneratedCodeAttribute();
+ _out << nl << "public override void write__(Ice.OutputStream outS__)";
+ _out << sb;
+ _out << nl << "outS__.startException(slicedData__);";
+ _out << nl << "writeImpl__(outS__);";
+ _out << nl << "outS__.endException();";
+ _out << eb;
+
+ _out << sp;
+ emitGeneratedCodeAttribute();
+ _out << nl << "public override void read__(Ice.InputStream inS__)";
+ _out << sb;
+ _out << nl << "inS__.startException();";
+ _out << nl << "readImpl__(inS__);";
+ _out << nl << "slicedData__ = inS__.endException(true);";
+ _out << eb;
+ }
}
- else
- {
- _out << nl << "os__.startWriteException(null);";
- }
- _out << nl << "writeImpl__(os__);";
- _out << nl << "os__.endWriteException();";
- _out << eb;
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void writeImpl__(IceInternal.BasicStream os__)";
+ _out << nl << "protected override void writeImpl__(IceInternal.BasicStream os__)";
_out << sb;
_out << nl << "os__.startWriteSlice(\"" << scoped << "\", " << (!base ? "true" : "false") << ");";
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
@@ -3567,23 +3544,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void read__(IceInternal.BasicStream is__)";
- _out << sb;
- _out << nl << "is__.startReadException();";
- _out << nl << "readImpl__(is__);";
- if(preserved)
- {
- _out << nl << "slicedData__ = is__.endReadException(true);";
- }
- else
- {
- _out << nl << "is__.endReadException(false);";
- }
- _out << eb;
-
- _out << sp;
- emitGeneratedCodeAttribute();
- _out << nl << "public override void readImpl__(IceInternal.BasicStream is__)";
+ _out << nl << "protected override void readImpl__(IceInternal.BasicStream is__)";
_out << sb;
_out << nl << "is__.startReadSlice();";
DataMemberList classMembers = p->classDataMembers();
@@ -3604,23 +3565,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- if(preserved)
- {
- _out << nl << "outS__.startException(slicedData__);";
- }
- else
- {
- _out << nl << "outS__.startException(null);";
- }
- _out << nl << "writeImpl__(outS__);";
- _out << nl << "outS__.endException();";
- _out << eb;
-
- _out << sp;
- emitGeneratedCodeAttribute();
- _out << nl << "public " << (base ? "override" : "virtual") << " void writeImpl__(Ice.OutputStream outS__)";
+ _out << nl << "protected override void writeImpl__(Ice.OutputStream outS__)";
_out << sb;
_out << nl << "outS__.startSlice(\"" << scoped << "\", " << (!base ? "true" : "false") << ");";
for(DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q)
@@ -3636,23 +3581,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
_out << sp;
emitGeneratedCodeAttribute();
- _out << nl << "public override void read__(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "inS__.startException();";
- _out << nl << "readImpl__(inS__);";
- if(preserved)
- {
- _out << nl << "slicedData__ = inS__.endException(true);";
- }
- else
- {
- _out << nl << "inS__.endException(false);";
- }
- _out << eb;
-
- _out << sp;
- emitGeneratedCodeAttribute();
- _out << nl << "public " << (base ? "override" : "virtual") << " void readImpl__(Ice.InputStream inS__)";
+ _out << nl << "protected override void readImpl__(Ice.InputStream inS__)";
_out << sb;
_out << nl << "inS__.startSlice();";
classMemberCount = static_cast<int>(allClassMembers.size() - classMembers.size());
@@ -3668,30 +3597,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
_out << eb;
}
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- _out << sp;
- emitGeneratedCodeAttribute();
- _out << nl << "public override void write__(Ice.OutputStream outS__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
-
- _out << sp;
- emitGeneratedCodeAttribute();
- _out << nl << "public override void read__(Ice.InputStream inS__)";
- _out << sb;
- _out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- _out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- _out << nl << "throw ex;";
- _out << eb;
- }
-
+
if(preserved && !basePreserved)
{
_out << sp << nl << "protected Ice.SlicedData slicedData__;";
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index c9f7f42e243..033e077302a 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -1335,23 +1335,50 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
DataMemberList members = p->dataMembers();
DataMemberList optionalMembers = p->orderedOptionalDataMembers();
bool basePreserved = p->inheritsMetaData("preserve-slice");
- bool preserved = basePreserved || p->hasMetaData("preserve-slice");
+ bool preserved = p->hasMetaData("preserve-slice");
- out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
- out << sb;
- if(preserved)
+ if(preserved && !basePreserved)
{
+ out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
+ out << sb;
out << nl << "__os.startWriteObject(__slicedData);";
+ out << nl << "__writeImpl(__os);";
+ out << nl << "__os.endWriteObject();";
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is)";
+ out << sb;
+ out << nl << "__is.startReadObject();";
+ out << nl << "__readImpl(__is);";
+ out << nl << "__slicedData = __is.endReadObject(true);";
+ out << eb;
+
+ if(stream)
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)";
+ out << sb;
+ if(preserved)
+ {
+ out << nl << "__outS.startObject(__slicedData);";
+ }
+ else
+ {
+ out << nl << "__outS.startObject(null);";
+ }
+ out << nl << "__writeImpl(__outS);";
+ out << nl << "__outS.endObject();";
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __inS)";
+ out << sb;
+ out << nl << "__inS.startObject();";
+ out << nl << "__readImpl(__inS);";
+ out << nl << "__slicedData = __inS.endObject(true);";
+ out << eb;
+ }
}
- else
- {
- out << nl << "__os.startWriteObject(null);";
- }
- out << nl << "__writeImpl(__os);";
- out << nl << "__os.endWriteObject();";
- out << eb;
- out << sp << nl << "public void" << nl << "__writeImpl(IceInternal.BasicStream __os)";
+ out << sp << nl << "protected void" << nl << "__writeImpl(IceInternal.BasicStream __os)";
out << sb;
out << nl << "__os.startWriteSlice(ice_staticId(), " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -1373,27 +1400,13 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
out << eb;
- out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is)";
- out << sb;
- out << nl << "__is.startReadObject();";
- out << nl << "__readImpl(__is);";
- if(preserved)
- {
- out << nl << "__slicedData = __is.endReadObject(true);";
- }
- else
- {
- out << nl << "__is.endReadObject(false);";
- }
- out << eb;
-
DataMemberList allClassMembers = p->allClassDataMembers();
if(allClassMembers.size() != 0)
{
writePatcher(out, package, allClassMembers, stream);
}
- out << sp << nl << "public void" << nl << "__readImpl(IceInternal.BasicStream __is)";
+ out << sp << nl << "protected void" << nl << "__readImpl(IceInternal.BasicStream __is)";
out << sb;
out << nl << "__is.startReadSlice();";
DataMemberList classMembers = p->classDataMembers();
@@ -1420,21 +1433,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
if(stream)
{
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)";
- out << sb;
- if(preserved)
- {
- out << nl << "__outS.startObject(__slicedData);";
- }
- else
- {
- out << nl << "__outS.startObject(null);";
- }
- out << nl << "__writeImpl(__outS);";
- out << nl << "__outS.endObject();";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__writeImpl(Ice.OutputStream __outS)";
+ out << sp << nl << "protected void" << nl << "__writeImpl(Ice.OutputStream __outS)";
out << sb;
out << nl << "__outS.startSlice(ice_staticId(), " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -1456,21 +1455,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
out << eb;
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __inS)";
- out << sb;
- out << nl << "__inS.startObject();";
- out << nl << "__readImpl(__inS);";
- if(preserved)
- {
- out << nl << "__slicedData = __inS.endObject(true);";
- }
- else
- {
- out << nl << "__inS.endObject(false);";
- }
- out << eb;
-
- out << sp << nl << "public void" << nl << "__readImpl(Ice.InputStream __inS)";
+ out << sp << nl << "protected void" << nl << "__readImpl(Ice.InputStream __inS)";
out << sb;
out << nl << "__inS.startSlice();";
iter = 0;
@@ -1493,27 +1478,7 @@ Slice::JavaVisitor::writeDispatchAndMarshalling(Output& out, const ClassDefPtr&
}
out << eb;
}
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- string scoped = p->scoped();
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __inS)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"type " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
- }
-
+
if(preserved && !basePreserved)
{
out << sp << nl << "protected Ice.SlicedData __slicedData;";
@@ -3248,27 +3213,48 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
string package = getPackage(p);
ExceptionPtr base = p->base();
bool basePreserved = p->inheritsMetaData("preserve-slice");
- bool preserved = basePreserved || p->hasMetaData("preserve-slice");
+ bool preserved = p->hasMetaData("preserve-slice");
DataMemberList members = p->dataMembers();
DataMemberList optionalMembers = p->orderedOptionalDataMembers();
int iter;
- out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
- out << sb;
- if(preserved)
+ if(preserved && !basePreserved)
{
+
+ out << sp << nl << "public void" << nl << "__write(IceInternal.BasicStream __os)";
+ out << sb;
out << nl << "__os.startWriteException(__slicedData);";
- }
- else
- {
- out << nl << "__os.startWriteException(null);";
- }
- out << nl << "__writeImpl(__os);";
- out << nl << "__os.endWriteException();";
- out << eb;
+ out << nl << "__writeImpl(__os);";
+ out << nl << "__os.endWriteException();";
+ out << eb;
+
+ out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is)";
+ out << sb;
+ out << nl << "__is.startReadException();";
+ out << nl << "__readImpl(__is);";
+ out << nl << "__slicedData = __is.endReadException(true);";
+ out << eb;
+
+ if(_stream)
+ {
+ out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)";
+ out << sb;
+ out << nl << "__outS.startException(__slicedData);";
+ out << nl << "__writeImpl(__outS);";
+ out << nl << "__outS.endException();";
+ out << eb;
- out << sp << nl << "public void" << nl << "__writeImpl(IceInternal.BasicStream __os)";
+ out << sp << nl << "public void" << nl << "__read(Ice.InputStream __inS)";
+ out << sb;
+ out << nl << "__inS.startException();";
+ out << nl << "__readImpl(__inS);";
+ out << nl << "__slicedData = __inS.endException(true);";
+ out << eb;
+ }
+ }
+
+ out << sp << nl << "protected void" << nl << "__writeImpl(IceInternal.BasicStream __os)";
out << sb;
out << nl << "__os.startWriteSlice(\"" << scoped << "\", " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -3289,27 +3275,13 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << nl << "super.__writeImpl(__os);";
}
out << eb;
-
- out << sp << nl << "public void" << nl << "__read(IceInternal.BasicStream __is)";
- out << sb;
- out << nl << "__is.startReadException();";
- out << nl << "__readImpl(__is);";
- if(preserved)
- {
- out << nl << "__slicedData = __is.endReadException(true);";
- }
- else
- {
- out << nl << "__is.endReadException(false);";
- }
- out << eb;
-
+
DataMemberList allClassMembers = p->allClassDataMembers();
if(allClassMembers.size() != 0)
{
writePatcher(out, package, allClassMembers, _stream);
}
- out << sp << nl << "public void" << nl << "__readImpl(IceInternal.BasicStream __is)";
+ out << sp << nl << "protected void" << nl << "__readImpl(IceInternal.BasicStream __is)";
out << sb;
out << nl << "__is.startReadSlice();";
iter = 0;
@@ -3336,21 +3308,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(_stream)
{
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)";
- out << sb;
- if(preserved)
- {
- out << nl << "__outS.startException(__slicedData);";
- }
- else
- {
- out << nl << "__outS.startException(null);";
- }
- out << nl << "__writeImpl(__outS);";
- out << nl << "__outS.endException();";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__writeImpl(Ice.OutputStream __outS)";
+ out << sp << nl << "protected void" << nl << "__writeImpl(Ice.OutputStream __outS)";
out << sb;
out << nl << "__outS.startSlice(\"" << scoped << "\", " << (!base ? "true" : "false") << ");";
iter = 0;
@@ -3372,21 +3330,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
out << eb;
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __inS)";
- out << sb;
- out << nl << "__inS.startException();";
- out << nl << "__readImpl(__inS);";
- if(preserved)
- {
- out << nl << "__slicedData = __inS.endException(true);";
- }
- else
- {
- out << nl << "__inS.endException(false);";
- }
- out << eb;
-
- out << sp << nl << "public void" << nl << "__readImpl(Ice.InputStream __inS)";
+ out << sp << nl << "protected void" << nl << "__readImpl(Ice.InputStream __inS)";
out << sb;
out << nl << "__inS.startSlice();";
iter = 0;
@@ -3409,26 +3353,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
}
out << eb;
}
- else
- {
- //
- // Emit placeholder functions to catch errors.
- //
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __outS)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
-
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __inS)";
- out << sb;
- out << nl << "Ice.MarshalException ex = new Ice.MarshalException();";
- out << nl << "ex.reason = \"exception " << scoped.substr(2) << " was not generated with stream support\";";
- out << nl << "throw ex;";
- out << eb;
- }
-
+
if(preserved && !basePreserved)
{
out << sp << nl << "protected Ice.SlicedData __slicedData;";
diff --git a/cpp/test/Ice/background/EndpointI.h b/cpp/test/Ice/background/EndpointI.h
index da8b5d7a726..c54018a73d8 100644
--- a/cpp/test/Ice/background/EndpointI.h
+++ b/cpp/test/Ice/background/EndpointI.h
@@ -44,6 +44,10 @@ public:
virtual bool operator==(const Ice::LocalObject&) const;
virtual bool operator<(const Ice::LocalObject&) const;
+#ifdef __SUNPRO_CC
+ using IceInternal::EndpointI::connectionId;
+#endif
+
protected:
virtual Ice::Int hashInit() const;
diff --git a/cs/src/Ice/Exception.cs b/cs/src/Ice/Exception.cs
index 477298b61de..009ee2735a1 100644
--- a/cs/src/Ice/Exception.cs
+++ b/cs/src/Ice/Exception.cs
@@ -158,22 +158,47 @@ namespace Ice
/// <param name="ex">The inner exception.</param>
public UserException(System.Exception ex) : base(ex) {}
- public abstract void write__(IceInternal.BasicStream os__);
- public abstract void writeImpl__(IceInternal.BasicStream os__);
- public abstract void read__(IceInternal.BasicStream is__);
- public abstract void readImpl__(IceInternal.BasicStream is__);
+ public virtual void write__(IceInternal.BasicStream os__)
+ {
+ os__.startWriteException(null);
+ writeImpl__(os__);
+ os__.endWriteException();
+ }
- public virtual void write__(Ice.OutputStream outS__)
+ public virtual void read__(IceInternal.BasicStream is__)
{
- Debug.Assert(false);
+ is__.startReadException();
+ readImpl__(is__);
+ is__.endReadException(false);
}
- public virtual void read__(Ice.InputStream inS__)
+ public virtual void write__(OutputStream os__)
{
- Debug.Assert(false);
+ os__.startException(null);
+ writeImpl__(os__);
+ os__.endException();
}
- }
+ public virtual void read__(InputStream is__)
+ {
+ is__.startException();
+ readImpl__(is__);
+ is__.endException(false);
+ }
+
+ protected abstract void writeImpl__(IceInternal.BasicStream os__);
+ protected abstract void readImpl__(IceInternal.BasicStream is__);
+
+ protected virtual void writeImpl__(OutputStream os__)
+ {
+ throw new MarshalException("exception was not generated with stream support");
+ }
+
+ protected virtual void readImpl__(InputStream is__)
+ {
+ throw new MarshalException("exception was not generated with stream support");
+ }
+ }
}
namespace IceInternal
diff --git a/cs/src/Ice/Object.cs b/cs/src/Ice/Object.cs
index ebb9786585a..67d79eee4b8 100644
--- a/cs/src/Ice/Object.cs
+++ b/cs/src/Ice/Object.cs
@@ -157,10 +157,8 @@ namespace Ice
DispatchStatus collocDispatch__(IceInternal.Direct request);
void write__(IceInternal.BasicStream os__);
- void writeImpl__(IceInternal.BasicStream os__);
void read__(IceInternal.BasicStream is__);
- void readImpl__(IceInternal.BasicStream is__);
-
+
void write__(OutputStream outS__);
void read__(InputStream inS__);
}
@@ -424,26 +422,48 @@ namespace Ice
public virtual void write__(IceInternal.BasicStream os__)
{
+ os__.startWriteObject(null);
+ writeImpl__(os__);
+ os__.endWriteObject();
}
- public virtual void writeImpl__(IceInternal.BasicStream os__)
+ public virtual void read__(IceInternal.BasicStream is__)
{
+ is__.startReadObject();
+ readImpl__(is__);
+ is__.endReadObject(false);
}
- public virtual void read__(IceInternal.BasicStream is__)
+ public virtual void write__(OutputStream os__)
+ {
+ os__.startObject(null);
+ writeImpl__(os__);
+ os__.endObject();
+ }
+
+ public virtual void read__(InputStream is__)
+ {
+ is__.startObject();
+ readImpl__(is__);
+ is__.endObject(false);
+ }
+
+ protected virtual void writeImpl__(IceInternal.BasicStream os__)
{
}
- public virtual void readImpl__(IceInternal.BasicStream is__)
+ protected virtual void readImpl__(IceInternal.BasicStream is__)
{
}
- public virtual void write__(OutputStream outS__)
+ protected virtual void writeImpl__(OutputStream os__)
{
+ throw new MarshalException("class was not generated with stream support");
}
- public virtual void read__(InputStream inS__)
+ protected virtual void readImpl__(InputStream is__)
{
+ throw new MarshalException("class was not generated with stream support");
}
private static string operationModeToString(OperationMode mode)
diff --git a/java/src/Ice/Object.java b/java/src/Ice/Object.java
index 20184f6657f..126c61cc0c1 100644
--- a/java/src/Ice/Object.java
+++ b/java/src/Ice/Object.java
@@ -158,10 +158,8 @@ public interface Object
DispatchStatus __collocDispatch(IceInternal.Direct request);
void __write(IceInternal.BasicStream __os);
- void __writeImpl(IceInternal.BasicStream __os);
void __read(IceInternal.BasicStream __is);
- void __readImpl(IceInternal.BasicStream __is);
-
+
void __write(OutputStream __outS);
void __read(InputStream __inS);
}
diff --git a/java/src/Ice/ObjectImpl.java b/java/src/Ice/ObjectImpl.java
index a1e0fb5c7a4..44a74e03bf1 100644
--- a/java/src/Ice/ObjectImpl.java
+++ b/java/src/Ice/ObjectImpl.java
@@ -351,33 +351,57 @@ public abstract class ObjectImpl implements Object, java.lang.Cloneable, java.io
}
public void
- __write(IceInternal.BasicStream __os)
+ __write(IceInternal.BasicStream os)
{
+ os.startWriteObject(null);
+ __writeImpl(os);
+ os.endWriteObject();
}
public void
- __writeImpl(IceInternal.BasicStream __os)
+ __read(IceInternal.BasicStream is)
{
+ is.startReadObject();
+ __readImpl(is);
+ is.endReadObject(false);
}
public void
- __read(IceInternal.BasicStream __is)
+ __write(OutputStream os)
{
+ os.startObject(null);
+ __writeImpl(os);
+ os.endObject();
}
public void
- __readImpl(IceInternal.BasicStream __is)
+ __read(InputStream is)
{
+ is.startObject();
+ __readImpl(is);
+ is.endObject(false);
}
- public void
- __write(Ice.OutputStream __outS)
+ protected void
+ __writeImpl(IceInternal.BasicStream os)
{
}
- public void
- __read(Ice.InputStream __inS)
+ protected void
+ __readImpl(IceInternal.BasicStream is)
+ {
+ }
+
+ protected void
+ __writeImpl(OutputStream os)
+ {
+ throw new MarshalException("class was not generated with stream support");
+ }
+
+ protected void
+ __readImpl(InputStream is)
{
+ throw new MarshalException("class was not generated with stream support");
}
private static String
diff --git a/java/src/Ice/UserException.java b/java/src/Ice/UserException.java
index 6beea1ed671..b7d46c40903 100644
--- a/java/src/Ice/UserException.java
+++ b/java/src/Ice/UserException.java
@@ -69,27 +69,53 @@ public abstract class UserException extends Exception implements Cloneable
return sw.toString();
}
- public abstract void
- __write(IceInternal.BasicStream __os);
-
- public abstract void
- __writeImpl(IceInternal.BasicStream __os);
-
- public abstract void
- __read(IceInternal.BasicStream __is);
+ public void
+ __write(IceInternal.BasicStream os)
+ {
+ os.startWriteException(null);
+ __writeImpl(os);
+ os.endWriteException();
+ }
- public abstract void
- __readImpl(IceInternal.BasicStream __is);
+ public void
+ __read(IceInternal.BasicStream is)
+ {
+ is.startReadException();
+ __readImpl(is);
+ is.endReadException(false);
+ }
public void
- __write(Ice.OutputStream __outS)
+ __write(Ice.OutputStream os)
{
- assert(false);
+ os.startException(null);
+ __writeImpl(os);
+ os.endException();
}
public void
- __read(Ice.InputStream __inS)
+ __read(Ice.InputStream is)
+ {
+ is.startException();
+ __readImpl(is);
+ is.endException(false);
+ }
+
+ protected abstract void
+ __writeImpl(IceInternal.BasicStream os);
+
+ protected abstract void
+ __readImpl(IceInternal.BasicStream is);
+
+ protected void
+ __writeImpl(OutputStream os)
+ {
+ throw new MarshalException("exception was not generated with stream support");
+ }
+
+ protected void
+ __readImpl(InputStream is)
{
- assert(false);
+ throw new MarshalException("exception was not generated with stream support");
}
}