summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java/Gen.cpp
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-11-17 13:37:27 -0500
committerBernard Normier <bernard@zeroc.com>2016-11-17 13:37:27 -0500
commit9fe9ffb11554bcbb6f4a32bcae70d9ffbb3b40ab (patch)
treed766a020835106766c07cf12f11a309764969c20 /cpp/src/slice2java/Gen.cpp
parentICE-7417 - Rename data directory (diff)
downloadice-9fe9ffb11554bcbb6f4a32bcae70d9ffbb3b40ab.tar.bz2
ice-9fe9ffb11554bcbb6f4a32bcae70d9ffbb3b40ab.tar.xz
ice-9fe9ffb11554bcbb6f4a32bcae70d9ffbb3b40ab.zip
Replaced double-underscores in java and java-compat
Diffstat (limited to 'cpp/src/slice2java/Gen.cpp')
-rw-r--r--cpp/src/slice2java/Gen.cpp746
1 files changed, 386 insertions, 360 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 8c3769c0fb6..0e196df0626 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -70,6 +70,21 @@ opFormatTypeToString(const OperationPtr& op)
return format;
}
+string
+getEscapedParamName(const OperationPtr& p, const string& name)
+{
+ ParamDeclList params = p->parameters();
+
+ for(ParamDeclList::const_iterator i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->name() == name)
+ {
+ return name + "_";
+ }
+ }
+ return name;
+}
+
bool
isDeprecated(const ContainedPtr& p1, const ContainedPtr& p2)
{
@@ -292,20 +307,20 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s
ParamDeclList required, optional;
op->outParameters(required, optional);
- out << sp << nl << "public void write(com.zeroc.Ice.OutputStream __os)";
+ out << sp << nl << "public void write(com.zeroc.Ice.OutputStream ostr)";
out << sb;
int iter = 0;
for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
const string paramName = fixKwd((*pli)->name());
- writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter,
+ writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter, "",
(*pli)->getMetaData());
}
if(ret && !op->returnIsOptional())
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, true, iter, op->getMetaData());
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, true, iter, "", op->getMetaData());
}
//
@@ -318,24 +333,24 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s
if(checkReturnType && op->returnTag() < (*pli)->tag())
{
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true,
- iter, op->getMetaData());
+ iter, "", op->getMetaData());
checkReturnType = false;
}
const string paramName = fixKwd((*pli)->name());
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName,
- true, iter, (*pli)->getMetaData());
+ true, iter, "", (*pli)->getMetaData());
}
if(checkReturnType)
{
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter,
- op->getMetaData());
+ "", op->getMetaData());
}
out << eb;
- out << sp << nl << "public void read(com.zeroc.Ice.InputStream __is)";
+ out << sp << nl << "public void read(com.zeroc.Ice.InputStream istr)";
out << sb;
iter = 0;
@@ -344,13 +359,13 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s
const string paramName = fixKwd((*pli)->name());
const string patchParams = getPatcher((*pli)->type(), package, paramName, false);
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, false, iter,
- (*pli)->getMetaData(), patchParams);
+ "", (*pli)->getMetaData(), patchParams);
}
if(ret && !op->returnIsOptional())
{
const string patchParams = getPatcher(ret, package, retval, false);
- writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, false, iter, op->getMetaData(),
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, false, iter, "", op->getMetaData(),
patchParams);
}
@@ -365,21 +380,21 @@ Slice::JavaVisitor::writeResultType(Output& out, const OperationPtr& op, const s
{
const string patchParams = getPatcher(ret, package, retval, true);
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, false,
- iter, op->getMetaData(), patchParams);
+ iter, "", op->getMetaData(), patchParams);
checkReturnType = false;
}
const string paramName = fixKwd((*pli)->name());
const string patchParams = getPatcher((*pli)->type(), package, paramName, true);
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName,
- false, iter, (*pli)->getMetaData(), patchParams);
+ false, iter, "", (*pli)->getMetaData(), patchParams);
}
if(checkReturnType)
{
const string patchParams = getPatcher(ret, package, retval, true);
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, false,
- iter, op->getMetaData(), patchParams);
+ iter, "", op->getMetaData(), patchParams);
}
out << eb;
@@ -402,7 +417,9 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
const ClassDefPtr cl = ClassDefPtr::dynamicCast(op->container());
assert(cl);
const ParamDeclList outParams = op->outParameters();
- const string retval = "__ret";
+ const string retval = getEscapedParamName(op, "returnValue");
+ const string currentParamName = getEscapedParamName(op, "current");
+ const string currentParam = "com.zeroc.Ice.Current " + currentParamName;
out << sp;
@@ -429,7 +446,7 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
writeDocCommentLines(out, q->second);
}
}
- out << nl << " * @param __current The Current object for the invocation.";
+ out << nl << " * @param " << currentParamName << " The Current object for the invocation.";
out << nl << " **/";
}
@@ -444,10 +461,10 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
out << (typeToString((*p)->type(), TypeModeIn, package, (*p)->getMetaData(), true, (*p)->optional(),
cl->isLocal()) + " " + fixKwd((*p)->name()));
}
- out << "com.zeroc.Ice.Current __current" << epar;
+ out << currentParam << epar;
out << sb;
- out << nl << "__os = com.zeroc.IceInternal.Incoming.createResponseOutputStream(__current);";
- out << nl << "__os.startEncapsulation(__current.encoding, " << opFormatTypeToString(op) << ");";
+ out << nl << "_ostr = com.zeroc.IceInternal.Incoming.createResponseOutputStream(" << currentParamName << ");";
+ out << nl << "_ostr.startEncapsulation(" << currentParamName << ".encoding, " << opFormatTypeToString(op) << ");";
ParamDeclList required, optional;
op->outParameters(required, optional);
@@ -456,12 +473,13 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
{
const string paramName = fixKwd((*pli)->name());
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true, iter,
- (*pli)->getMetaData());
+ "_ostr", (*pli)->getMetaData());
}
if(ret && !op->returnIsOptional())
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, true, iter, op->getMetaData());
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retval, true, iter, "_ostr",
+ op->getMetaData());
}
//
@@ -474,27 +492,27 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
if(checkReturnType && op->returnTag() < (*pli)->tag())
{
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true,
- iter, op->getMetaData());
+ iter, "_ostr", op->getMetaData());
checkReturnType = false;
}
const string paramName = fixKwd((*pli)->name());
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalOutParam, true, (*pli)->tag(), paramName,
- true, iter, (*pli)->getMetaData());
+ true, iter, "_ostr", (*pli)->getMetaData());
}
if(checkReturnType)
{
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, true, op->returnTag(), retval, true, iter,
- op->getMetaData());
+ "_ostr", op->getMetaData());
}
if(op->returnsClasses(false))
{
- out << nl << "__os.writePendingValues();";
+ out << nl << "_ostr.writePendingValues();";
}
- out << nl << "__os.endEncapsulation();";
+ out << nl << "_ostr.endEncapsulation();";
out << eb;
@@ -502,11 +520,11 @@ Slice::JavaVisitor::writeMarshaledResultType(Output& out, const OperationPtr& op
out << nl << "@Override"
<< nl << "public com.zeroc.Ice.OutputStream getOutputStream()"
<< sb
- << nl << "return __os;"
+ << nl << "return _ostr;"
<< eb;
out << sp;
- out << nl << "private com.zeroc.Ice.OutputStream __os;";
+ out << nl << "private com.zeroc.Ice.OutputStream _ostr;";
out << eb;
}
@@ -528,7 +546,7 @@ Slice::JavaVisitor::allocatePatcher(Output& out, const TypePtr& type, const stri
}
out << nl << "com.zeroc.IceInternal.Patcher<" << clsName << "> " << name << " = new com.zeroc.IceInternal.Patcher<"
- << clsName << ">(" << clsName << ".class, " << clsName << ".ice_staticId);";
+ << clsName << ">(" << clsName << ".class, " << clsName << ".ice_staticId());";
}
string
@@ -550,14 +568,14 @@ Slice::JavaVisitor::getPatcher(const TypePtr& type, const string& package, const
}
ostr << "new com.zeroc.IceInternal.Patcher<" << clsName << ">(" << clsName << ".class, "
- << clsName << ".ice_staticId, " << "__v -> ";
+ << clsName << ".ice_staticId(), " << "v -> ";
if(optionalMapping)
{
- ostr << dest << " = java.util.Optional.ofNullable(__v)";
+ ostr << dest << " = java.util.Optional.ofNullable(v)";
}
else
{
- ostr << dest << " = __v";
+ ostr << dest << " = v";
}
ostr << ')';
}
@@ -610,7 +628,7 @@ Slice::JavaVisitor::getParams(const OperationPtr& op, const string& package)
}
vector<string>
-Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool optionalMapping)
+Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool optionalMapping, bool internal)
{
vector<string> params;
@@ -619,7 +637,7 @@ Slice::JavaVisitor::getParamsProxy(const OperationPtr& op, const string& package
{
const string typeString = typeToString((*q)->type(), TypeModeIn, package, (*q)->getMetaData(), true,
optionalMapping && (*q)->optional());
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ params.push_back(typeString + ' ' + (internal ? "iceP_" + (*q)->name() : fixKwd((*q)->name())));
}
return params;
@@ -640,18 +658,14 @@ Slice::JavaVisitor::getArgs(const OperationPtr& op)
}
vector<string>
-Slice::JavaVisitor::getInArgs(const OperationPtr& op, bool patcher)
+Slice::JavaVisitor::getInArgs(const OperationPtr& op, bool internal)
{
vector<string> args;
ParamDeclList paramList = op->inParameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
- string s = fixKwd((*q)->name());
- if(patcher && isValue((*q)->type()))
- {
- s += ".value";
- }
+ string s = internal ? "iceP_" + (*q)->name() : fixKwd((*q)->name());
args.push_back(s);
}
@@ -667,9 +681,9 @@ Slice::JavaVisitor::writeMarshalProxyParams(Output& out, const string& package,
op->inParameters(required, optional);
for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
- string paramName = fixKwd((*pli)->name());
+ string paramName = "iceP_" + (*pli)->name();
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, true,
- iter, (*pli)->getMetaData());
+ iter, "", (*pli)->getMetaData());
}
//
@@ -678,12 +692,12 @@ Slice::JavaVisitor::writeMarshalProxyParams(Output& out, const string& package,
for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
{
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalInParam, optionalMapping,
- (*pli)->tag(), fixKwd((*pli)->name()), true, iter, (*pli)->getMetaData());
+ (*pli)->tag(), "iceP_" + (*pli)->name(), true, iter, "", (*pli)->getMetaData());
}
if(op->sendsClasses(false))
{
- out << nl << "__os.writePendingValues();";
+ out << nl << "ostr.writePendingValues();";
}
}
@@ -692,16 +706,16 @@ Slice::JavaVisitor::writeUnmarshalProxyResults(Output& out, const string& packag
{
const ParamDeclList outParams = op->outParameters();
const TypePtr ret = op->returnType();
- const string name = "__ret";
+ const string name = "ret";
if(op->returnsMultipleValues())
{
string resultType = getResultType(op, package, false, false);
out << nl << resultType << ' ' << name << " = new " << resultType << "();";
- out << nl << name << ".read(__is);";
+ out << nl << name << ".read(istr);";
if(op->returnsClasses(false))
{
- out << nl << "__is.readPendingValues();";
+ out << nl << "istr.readPendingValues();";
}
out << nl << "return " << name << ';';
}
@@ -744,7 +758,7 @@ Slice::JavaVisitor::writeUnmarshalProxyResults(Output& out, const string& packag
out << nl << resultType << ' ' << name << ';';
}
writeMarshalUnmarshalCode(out, package, type, ret ? OptionalReturnParam : OptionalOutParam, true,
- tag, name, false, iter, metaData, name);
+ tag, name, false, iter, "", metaData, name);
}
else
{
@@ -760,12 +774,12 @@ Slice::JavaVisitor::writeUnmarshalProxyResults(Output& out, const string& packag
{
out << nl << resultType << ' ' << name << ';';
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, name, false, iter, metaData, name);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, name, false, iter, "", metaData, name);
}
if(op->returnsClasses(false))
{
- out << nl << "__is.readPendingValues();";
+ out << nl << "istr.readPendingValues();";
}
if(optional && val)
@@ -789,7 +803,7 @@ Slice::JavaVisitor::writeMarshalServantResults(Output& out, const string& packag
{
if(op->returnsMultipleValues())
{
- out << nl << param << ".write(__os);";
+ out << nl << param << ".write(ostr);";
}
else
{
@@ -818,12 +832,12 @@ Slice::JavaVisitor::writeMarshalServantResults(Output& out, const string& packag
}
int iter = 0;
- writeMarshalUnmarshalCode(out, package, type, mode, true, tag, param, true, iter, metaData);
+ writeMarshalUnmarshalCode(out, package, type, mode, true, tag, param, true, iter, "", metaData);
}
if(op->returnsClasses(false))
{
- out << nl << "__os.writePendingValues();";
+ out << nl << "ostr.writePendingValues();";
}
}
@@ -852,26 +866,34 @@ Slice::JavaVisitor::writeThrowsClause(const string& package, const ExceptionList
}
void
-Slice::JavaVisitor::writeMarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter)
+Slice::JavaVisitor::writeMarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter, bool forStruct)
{
- if(!member->optional())
- {
- writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()),
- true, iter, member->getMetaData());
- }
- else
+ if(member->optional())
{
- out << nl << "if(__has_" << member->name() << " && __os.writeOptional(" << member->tag() << ", "
+ assert(!forStruct);
+ out << nl << "if(_" << member->name() << " && ostr_.writeOptional(" << member->tag() << ", "
<< getOptionalFormat(member->type()) << "))";
out << sb;
writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), true,
- iter, member->getMetaData());
+ iter, "ostr_", member->getMetaData());
out << eb;
}
+ else
+ {
+ string stream = forStruct ? "" : "ostr_";
+ string memberName = fixKwd(member->name());
+ if(forStruct)
+ {
+ memberName = "this." + memberName;
+ }
+
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, memberName,
+ true, iter, stream, member->getMetaData());
+ }
}
void
-Slice::JavaVisitor::writeUnmarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter)
+Slice::JavaVisitor::writeUnmarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter, bool forStruct)
{
// TBD: Handle passing interface-by-value
@@ -879,17 +901,25 @@ Slice::JavaVisitor::writeUnmarshalDataMember(Output& out, const string& package,
if(member->optional())
{
- out << nl << "if(__has_" << member->name() << " = __is.readOptional(" << member->tag() << ", "
+ assert(!forStruct);
+ out << nl << "if(_" << member->name() << " = istr_.readOptional(" << member->tag() << ", "
<< getOptionalFormat(member->type()) << "))";
out << sb;
writeMarshalUnmarshalCode(out, package, member->type(), OptionalMember, false, 0, fixKwd(member->name()), false,
- iter, member->getMetaData(), patchParams);
+ iter, "istr_", member->getMetaData(), patchParams);
out << eb;
}
else
{
- writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), false,
- iter, member->getMetaData(), patchParams);
+ string stream = forStruct ? "" : "istr_";
+ string memberName = fixKwd(member->name());
+ if(forStruct)
+ {
+ memberName = "this." + memberName;
+ }
+
+ writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, memberName, false,
+ iter, stream, member->getMetaData(), patchParams);
}
}
@@ -922,6 +952,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
vector<string> params = getParams(op, package);
+ const string currentParam = "com.zeroc.Ice.Current " + getEscapedParamName(op, "current");
const bool amd = p->hasMetaData("amd") || op->hasMetaData("amd");
@@ -939,14 +970,14 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
if(amd)
{
out << nl << "java.util.concurrent.CompletionStage<" << getResultType(op, package, true, true) << "> "
- << op->name() << "Async" << spar << params << "com.zeroc.Ice.Current __current" << epar;
+ << op->name() << "Async" << spar << params << currentParam << epar;
writeThrowsClause(package, throws);
out << ';';
}
else
{
out << nl << getResultType(op, package, false, true) << ' ' << fixKwd(op->name()) << spar << params
- << "com.zeroc.Ice.Current __current" << epar;
+ << currentParam << epar;
writeThrowsClause(package, throws);
out << ';';
}
@@ -966,7 +997,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
assert(scopedIter != ids.end());
#endif
- out << sp << nl << "static final String[] __ids =";
+ out << sp << nl << "static final String[] _iceIds =";
out << sb;
for(StringList::const_iterator q = ids.begin(); q != ids.end();)
@@ -979,12 +1010,12 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
out << eb << ';';
- out << sp << nl << "@Override" << nl << "default String[] ice_ids(com.zeroc.Ice.Current __current)";
+ out << sp << nl << "@Override" << nl << "default String[] ice_ids(com.zeroc.Ice.Current current)";
out << sb;
- out << nl << "return __ids;";
+ out << nl << "return _iceIds;";
out << eb;
- out << sp << nl << "@Override" << nl << "default String ice_id(com.zeroc.Ice.Current __current)";
+ out << sp << nl << "@Override" << nl << "default String ice_id(com.zeroc.Ice.Current current)";
out << sb;
out << nl << "return ice_staticId();";
out << eb;
@@ -994,11 +1025,11 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sb;
if(p->isInterface())
{
- out << nl << "return ice_staticId;";
+ out << nl << "return \"" << p->scoped() << "\";";
}
else
{
- out << nl << "return " << fixKwd(p->name()) << ".ice_staticId;";
+ out << nl << "return " << fixKwd(p->name()) << ".ice_staticId();";
}
out << eb;
@@ -1020,7 +1051,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
{
out << nl << "@Deprecated";
}
- out << nl << "static java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> ___" << opName << '(';
+ out << nl << "static java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> _iceD_" << opName << '(';
if(p->isInterface())
{
out << name;
@@ -1029,7 +1060,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
{
out << '_' << p->name() << "Disp";
}
- out << " __obj, final com.zeroc.IceInternal.Incoming __inS, com.zeroc.Ice.Current __current)";
+ out << " obj, final com.zeroc.IceInternal.Incoming inS, com.zeroc.Ice.Current current)";
if(!op->throws().empty())
{
out.inc();
@@ -1045,7 +1076,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
const ParamDeclList inParams = op->inParameters();
const ParamDeclList outParams = op->outParameters();
- out << nl << "com.zeroc.Ice.Object.__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+ out << nl << "com.zeroc.Ice.Object._iceCheckMode(" << sliceModeToIceMode(op->mode()) << ", current.mode);";
if(!inParams.empty())
{
@@ -1054,18 +1085,18 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
//
// Declare 'in' parameters.
//
- out << nl << "com.zeroc.Ice.InputStream __is = __inS.startReadParams();";
+ out << nl << "com.zeroc.Ice.InputStream istr = inS.startReadParams();";
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
const TypePtr paramType = (*pli)->type();
if(isValue(paramType))
{
- allocatePatcher(out, paramType, package, "__" + (*pli)->name());
+ allocatePatcher(out, paramType, package, "icePP_" + (*pli)->name());
values.push_back(*pli);
}
else
{
- const string paramName = fixKwd((*pli)->name());
+ const string paramName = "iceP_" + (*pli)->name();
const string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(), true,
(*pli)->optional());
if((*pli)->optional())
@@ -1094,66 +1125,66 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
int iter = 0;
for(ParamDeclList::const_iterator pli = required.begin(); pli != required.end(); ++pli)
{
- const string paramName = isValue((*pli)->type()) ? ("__" + (*pli)->name()) : fixKwd((*pli)->name());
+ const string paramName = isValue((*pli)->type()) ? ("icePP_" + (*pli)->name()) : "iceP_" + (*pli)->name();
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, false,
- iter, (*pli)->getMetaData(), paramName);
+ iter, "", (*pli)->getMetaData(), paramName);
}
for(ParamDeclList::const_iterator pli = optional.begin(); pli != optional.end(); ++pli)
{
- const string paramName = isValue((*pli)->type()) ? ("__" + (*pli)->name()) : fixKwd((*pli)->name());
+ const string paramName = isValue((*pli)->type()) ? ("icePP_" + (*pli)->name()) : "iceP_" + (*pli)->name();
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalInParam, true, (*pli)->tag(),
- paramName, false, iter, (*pli)->getMetaData(), paramName);
+ paramName, false, iter, "", (*pli)->getMetaData(), paramName);
}
if(op->sendsClasses(false))
{
- out << nl << "__is.readPendingValues();";
+ out << nl << "istr.readPendingValues();";
}
- out << nl << "__inS.endReadParams();";
+ out << nl << "inS.endReadParams();";
for(ParamDeclList::const_iterator pli = values.begin(); pli != values.end(); ++pli)
{
const TypePtr paramType = (*pli)->type();
- const string paramName = fixKwd((*pli)->name());
+ const string paramName = "iceP_" + (*pli)->name();
const string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(), true,
(*pli)->optional());
if((*pli)->optional())
{
- out << nl << typeS << ' ' << paramName << " = java.util.Optional.ofNullable(__" << (*pli)->name()
+ out << nl << typeS << ' ' << paramName << " = java.util.Optional.ofNullable(icePP_" << (*pli)->name()
<< ".value);";
}
else
{
- out << nl << typeS << ' ' << paramName << " = __" << (*pli)->name() << ".value;";
+ out << nl << typeS << ' ' << paramName << " = icePP_" << (*pli)->name() << ".value;";
}
}
}
else
{
- out << nl << "__inS.readEmptyParams();";
+ out << nl << "inS.readEmptyParams();";
}
if(op->format() != DefaultFormat)
{
- out << nl << "__inS.setFormat(" << opFormatTypeToString(op) << ");";
+ out << nl << "inS.setFormat(" << opFormatTypeToString(op) << ");";
}
if(amd)
{
if(op->hasMarshaledResult())
{
- out << nl << "return __inS.setMarshaledResultFuture(__obj." << opName << "Async" << spar
- << getInArgs(op) << "__current" << epar << ");";
+ out << nl << "return inS.setMarshaledResultFuture(obj." << opName << "Async" << spar
+ << getInArgs(op, true) << "current" << epar << ");";
}
else
{
- out << nl << "return __inS.setResultFuture(__obj." << opName << "Async" << spar << getInArgs(op)
- << "__current" << epar;
+ out << nl << "return inS.setResultFuture(obj." << opName << "Async" << spar << getInArgs(op, true)
+ << "current" << epar;
if(ret || !outParams.empty())
{
- out << ", (__os, __ret) ->";
+ out << ", (ostr, ret) ->";
out.inc();
out << sb;
- writeMarshalServantResults(out, package, op, "__ret");
+ writeMarshalServantResults(out, package, op, "ret");
out << eb;
out.dec();
}
@@ -1168,27 +1199,27 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << nl;
if(ret || !outParams.empty())
{
- out << getResultType(op, package, false, true) << " __ret = ";
+ out << getResultType(op, package, false, true) << " ret = ";
}
- out << "__obj." << fixKwd(opName) << spar << getInArgs(op) << "__current" << epar << ';';
+ out << "obj." << fixKwd(opName) << spar << getInArgs(op, true) << "current" << epar << ';';
//
// Marshal 'out' parameters and return value.
//
if(op->hasMarshaledResult())
{
- out << nl << "return __inS.setMarshaledResult(__ret);";
+ out << nl << "return inS.setMarshaledResult(ret);";
}
else if(ret || !outParams.empty())
{
- out << nl << "com.zeroc.Ice.OutputStream __os = __inS.startWriteParams();";
- writeMarshalServantResults(out, package, op, "__ret");
- out << nl << "__inS.endWriteParams(__os);";
- out << nl << "return __inS.setResult(__os);";
+ out << nl << "com.zeroc.Ice.OutputStream ostr = inS.startWriteParams();";
+ writeMarshalServantResults(out, package, op, "ret");
+ out << nl << "inS.endWriteParams(ostr);";
+ out << nl << "return inS.setResult(ostr);";
}
else
{
- out << nl << "return __inS.setResult(__inS.writeEmptyParams());";
+ out << nl << "return inS.setResult(inS.writeEmptyParams());";
}
}
@@ -1207,7 +1238,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
allOpNames.sort();
allOpNames.unique();
- out << sp << nl << "final static String[] __ops =";
+ out << sp << nl << "final static String[] _iceOps =";
out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -1236,17 +1267,17 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
}
}
out << nl << "@Override" << nl
- << "default java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> __dispatch("
- << "com.zeroc.IceInternal.Incoming in, com.zeroc.Ice.Current __current)";
+ << "default java.util.concurrent.CompletionStage<com.zeroc.Ice.OutputStream> _iceDispatch("
+ << "com.zeroc.IceInternal.Incoming in, com.zeroc.Ice.Current current)";
out.inc();
out << nl << "throws com.zeroc.Ice.UserException";
out.dec();
out << sb;
- out << nl << "int pos = java.util.Arrays.binarySearch(__ops, __current.operation);";
+ out << nl << "int pos = java.util.Arrays.binarySearch(_iceOps, current.operation);";
out << nl << "if(pos < 0)";
out << sb;
out << nl << "throw new "
- << "com.zeroc.Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ << "com.zeroc.Ice.OperationNotExistException(current.id, current.facet, current.operation);";
out << eb;
out << sp << nl << "switch(pos)";
out << sb;
@@ -1259,19 +1290,19 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sb;
if(opName == "ice_id")
{
- out << nl << "return com.zeroc.Ice.Object.___ice_id(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object._iceD_ice_id(this, in, current);";
}
else if(opName == "ice_ids")
{
- out << nl << "return com.zeroc.Ice.Object.___ice_ids(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object._iceD_ice_ids(this, in, current);";
}
else if(opName == "ice_isA")
{
- out << nl << "return com.zeroc.Ice.Object.___ice_isA(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object._iceD_ice_isA(this, in, current);";
}
else if(opName == "ice_ping")
{
- out << nl << "return com.zeroc.Ice.Object.___ice_ping(this, in, __current);";
+ out << nl << "return com.zeroc.Ice.Object._iceD_ice_ping(this, in, current);";
}
else
{
@@ -1287,7 +1318,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
assert(cl);
if(cl->scoped() == p->scoped())
{
- out << nl << "return ___" << opName << "(this, in, __current);";
+ out << nl << "return _iceD_" << opName << "(this, in, current);";
}
else
{
@@ -1300,7 +1331,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
{
base = getAbsolute(cl, package, "_", "Disp");
}
- out << nl << "return " << base << ".___" << opName << "(this, in, __current);";
+ out << nl << "return " << base << "._iceD_" << opName << "(this, in, current);";
}
break;
}
@@ -1311,7 +1342,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << eb;
out << sp << nl << "assert(false);";
out << nl << "throw new "
- << "com.zeroc.Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ << "com.zeroc.Ice.OperationNotExistException(current.id, current.facet, current.operation);";
out << eb;
//
@@ -1330,7 +1361,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
if(!attributesMap.empty())
{
- out << sp << nl << "final static int[] __operationAttributes =";
+ out << sp << nl << "final static int[] _iceOperationAttributes =";
out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -1352,12 +1383,12 @@ Slice::JavaVisitor::writeDispatch(Output& out, const ClassDefPtr& p)
out << sp << nl << "@Override" << nl << "default int ice_operationAttributes(String operation)";
out << sb;
- out << nl << "int pos = java.util.Arrays.binarySearch(__ops, operation);";
+ out << nl << "int pos = java.util.Arrays.binarySearch(_iceOps, operation);";
out << nl << "if(pos < 0)";
out << sb;
out << nl << "return -1;";
out << eb;
- out << sp << nl << "return __operationAttributes[pos];";
+ out << sp << nl << "return _iceOperationAttributes[pos];";
out << eb;
}
}
@@ -1386,28 +1417,28 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
{
out << sp;
out << nl << "@Override";
- out << nl << "public void __write(com.zeroc.Ice.OutputStream __os)";
+ out << nl << "public void _iceWrite(com.zeroc.Ice.OutputStream ostr)";
out << sb;
- out << nl << "__os.startValue(__slicedData);";
- out << nl << "__writeImpl(__os);";
- out << nl << "__os.endValue();";
+ out << nl << "ostr.startValue(_iceSlicedData);";
+ out << nl << "_iceWriteImpl(ostr);";
+ out << nl << "ostr.endValue();";
out << eb;
out << sp;
out << nl << "@Override";
- out << nl << "public void __read(com.zeroc.Ice.InputStream __is)";
+ out << nl << "public void _iceRead(com.zeroc.Ice.InputStream istr)";
out << sb;
- out << nl << "__is.startValue();";
- out << nl << "__readImpl(__is);";
- out << nl << "__slicedData = __is.endValue(true);";
+ out << nl << "istr.startValue();";
+ out << nl << "_iceReadImpl(istr);";
+ out << nl << "_iceSlicedData = istr.endValue(true);";
out << eb;
}
out << sp;
out << nl << "@Override";
- out << nl << "protected void __writeImpl(com.zeroc.Ice.OutputStream __os)";
+ out << nl << "protected void _iceWriteImpl(com.zeroc.Ice.OutputStream ostr_)";
out << sb;
- out << nl << "__os.startSlice(ice_staticId, " << p->compactId() << (!base ? ", true" : ", false") << ");";
+ out << nl << "ostr_.startSlice(ice_staticId(), " << p->compactId() << (!base ? ", true" : ", false") << ");";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -1420,10 +1451,10 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
{
writeMarshalDataMember(out, package, *d, iter);
}
- out << nl << "__os.endSlice();";
+ out << nl << "ostr_.endSlice();";
if(base)
{
- out << nl << "super.__writeImpl(__os);";
+ out << nl << "super._iceWriteImpl(ostr_);";
}
out << eb;
@@ -1432,9 +1463,9 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "protected void __readImpl(com.zeroc.Ice.InputStream __is)";
+ out << nl << "protected void _iceReadImpl(com.zeroc.Ice.InputStream istr_)";
out << sb;
- out << nl << "__is.startSlice();";
+ out << nl << "istr_.startSlice();";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -1449,16 +1480,16 @@ Slice::JavaVisitor::writeMarshaling(Output& out, const ClassDefPtr& p)
writeUnmarshalDataMember(out, package, *d, iter);
}
- out << nl << "__is.endSlice();";
+ out << nl << "istr_.endSlice();";
if(base)
{
- out << nl << "super.__readImpl(__is);";
+ out << nl << "super._iceReadImpl(istr_);";
}
out << eb;
if(preserved && !basePreserved)
{
- out << sp << nl << "protected com.zeroc.Ice.SlicedData __slicedData;";
+ out << sp << nl << "protected com.zeroc.Ice.SlicedData _iceSlicedData;";
}
}
@@ -1875,7 +1906,7 @@ Slice::JavaVisitor::writeProxyDocComment(Output& out, const OperationPtr& p, con
return;
}
- const string contextParam = " * @param __ctx The Context map to send with the invocation.";
+ const string contextParam = " * @param context The Context map to send with the invocation.";
out << nl << "/**";
if(!dc->overview.empty())
@@ -1989,7 +2020,9 @@ Slice::JavaVisitor::writeServantDocComment(Output& out, const OperationPtr& p, c
return;
}
- const string currentParam = " * @param __current The Current object for the invocation.";
+ const ParamDeclList paramList = p->inParameters();
+ const string currentParamName = getEscapedParamName(p, "current");
+ const string currentParam = " * @param " + currentParamName + " The Current object for the invocation.";
out << nl << "/**";
if(!dc->overview.empty())
@@ -2001,7 +2034,6 @@ Slice::JavaVisitor::writeServantDocComment(Output& out, const OperationPtr& p, c
//
// Show in-params in order of declaration, but only those with docs.
//
- const ParamDeclList paramList = p->inParameters();
for(ParamDeclList::const_iterator i = paramList.begin(); i != paramList.end(); ++i)
{
const string name = (*i)->name();
@@ -2493,24 +2525,17 @@ Slice::Gen::TypesVisitor::visitClassDefEnd(const ClassDefPtr& p)
if(!p->isLocal())
{
- out << sp << nl;
- if(!p->isInterface())
- {
- out << "public ";
- }
- out << "static final String ice_staticId = \"" << p->scoped() << "\";";
-
if(!p->isInterface())
{
out << sp << nl << "public static String ice_staticId()";
out << sb;
- out << nl << "return ice_staticId;";
+ out << nl << "return \"" << p->scoped() << "\";";
out << eb;
out << sp << nl << "@Override";
out << nl << "public String ice_id()";
out << sb;
- out << nl << "return ice_staticId;";
+ out << nl << "return ice_staticId();";
out << eb;
}
}
@@ -2715,9 +2740,9 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
out << eb;
out << sp;
- out << nl << "public " << name << "(Throwable __cause)";
+ out << nl << "public " << name << "(Throwable cause)";
out << sb;
- out << nl << "super(__cause);";
+ out << nl << "super(cause);";
writeDataMemberInitializers(out, members, package);
out << eb;
@@ -2812,7 +2837,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
//
if(allDataMembers.size() < 254)
{
- paramDecl.push_back("Throwable __cause");
+ paramDecl.push_back("Throwable cause");
out << sp << nl << "public " << name << spar;
out << paramDecl << epar;
out << sb;
@@ -2827,12 +2852,12 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
baseParamNames.push_back(fixKwd((*d)->name()));
}
}
- baseParamNames.push_back("__cause");
+ baseParamNames.push_back("cause");
out << baseParamNames << epar << ';';
}
else
{
- out << nl << "super(__cause);";
+ out << nl << "super(cause);";
}
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -2891,13 +2916,13 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
//
if(allDataMembers.size() < 254)
{
- paramDecl.push_back("Throwable __cause");
+ paramDecl.push_back("Throwable cause");
out << sp << nl << "public " << name << spar;
out << paramDecl << epar;
out << sb;
if(!base)
{
- out << nl << "super(__cause);";
+ out << nl << "super(cause);";
}
else
{
@@ -2908,7 +2933,7 @@ Slice::Gen::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
baseParamNames.push_back(fixKwd((*d)->name()));
}
- baseParamNames.push_back("__cause");
+ baseParamNames.push_back("cause");
out << baseParamNames << epar << ';';
}
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -2960,28 +2985,28 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
out << sp;
out << nl << "@Override";
- out << nl << "public void __write(com.zeroc.Ice.OutputStream __os)";
+ out << nl << "public void _write(com.zeroc.Ice.OutputStream ostr)";
out << sb;
- out << nl << "__os.startException(__slicedData);";
- out << nl << "__writeImpl(__os);";
- out << nl << "__os.endException();";
+ out << nl << "ostr.startException(_slicedData);";
+ out << nl << "_writeImpl(ostr);";
+ out << nl << "ostr.endException();";
out << eb;
out << sp;
out << nl << "@Override";
- out << nl << "public void __read(com.zeroc.Ice.InputStream __is)";
+ out << nl << "public void _read(com.zeroc.Ice.InputStream istr)";
out << sb;
- out << nl << "__is.startException();";
- out << nl << "__readImpl(__is);";
- out << nl << "__slicedData = __is.endException(true);";
+ out << nl << "istr.startException();";
+ out << nl << "_readImpl(istr);";
+ out << nl << "_slicedData = istr.endException(true);";
out << eb;
}
out << sp;
out << nl << "@Override";
- out << nl << "protected void __writeImpl(com.zeroc.Ice.OutputStream __os)";
+ out << nl << "protected void _writeImpl(com.zeroc.Ice.OutputStream ostr_)";
out << sb;
- out << nl << "__os.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
+ out << nl << "ostr_.startSlice(\"" << scoped << "\", -1, " << (!base ? "true" : "false") << ");";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -2994,10 +3019,10 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
writeMarshalDataMember(out, package, *d, iter);
}
- out << nl << "__os.endSlice();";
+ out << nl << "ostr_.endSlice();";
if(base)
{
- out << nl << "super.__writeImpl(__os);";
+ out << nl << "super._writeImpl(ostr_);";
}
out << eb;
@@ -3006,9 +3031,9 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
out << sp;
out << nl << "@Override";
- out << nl << "protected void __readImpl(com.zeroc.Ice.InputStream __is)";
+ out << nl << "protected void _readImpl(com.zeroc.Ice.InputStream istr_)";
out << sb;
- out << nl << "__is.startSlice();";
+ out << nl << "istr_.startSlice();";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -3021,10 +3046,10 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
writeUnmarshalDataMember(out, package, *d, iter);
}
- out << nl << "__is.endSlice();";
+ out << nl << "istr_.endSlice();";
if(base)
{
- out << nl << "super.__readImpl(__is);";
+ out << nl << "super._readImpl(istr_);";
}
out << eb;
@@ -3034,7 +3059,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
out << sp;
out << nl << "@Override";
- out << nl << "public boolean __usesClasses()";
+ out << nl << "public boolean _usesClasses()";
out << sb;
out << nl << "return true;";
out << eb;
@@ -3043,7 +3068,7 @@ Slice::Gen::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "protected com.zeroc.Ice.SlicedData __slicedData;";
+ out << sp << nl << "protected com.zeroc.Ice.SlicedData _slicedData;";
}
}
@@ -3165,12 +3190,12 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sb;
out << nl << "return true;";
out << eb;
- out << nl << typeS << " _r = null;";
+ out << nl << typeS << " r = null;";
out << nl << "if(rhs instanceof " << typeS << ")";
out << sb;
- out << nl << "_r = (" << typeS << ")rhs;";
+ out << nl << "r = (" << typeS << ")rhs;";
out << eb;
- out << sp << nl << "if(_r != null)";
+ out << sp << nl << "if(r != null)";
out << sb;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -3188,7 +3213,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
case Builtin::KindFloat:
case Builtin::KindDouble:
{
- out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << nl << "if(this." << memberName << " != r." << memberName << ')';
out << sb;
out << nl << "return false;";
out << eb;
@@ -3201,10 +3226,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
case Builtin::KindLocalObject:
case Builtin::KindValue:
{
- out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << nl << "if(this." << memberName << " != r." << memberName << ')';
out << sb;
- out << nl << "if(" << memberName << " == null || _r." << memberName << " == null || !"
- << memberName << ".equals(_r." << memberName << "))";
+ out << nl << "if(this." << memberName << " == null || r." << memberName << " == null || !this."
+ << memberName << ".equals(r." << memberName << "))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -3228,10 +3253,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
{
if(hasTypeMetaData(seq, (*d)->getMetaData()))
{
- out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << nl << "if(this." << memberName << " != r." << memberName << ')';
out << sb;
- out << nl << "if(" << memberName << " == null || _r." << memberName << " == null || !"
- << memberName << ".equals(_r." << memberName << "))";
+ out << nl << "if(this." << memberName << " == null || r." << memberName << " == null || !this."
+ << memberName << ".equals(r." << memberName << "))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -3242,7 +3267,7 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
//
// Arrays.equals() handles null values.
//
- out << nl << "if(!java.util.Arrays.equals(" << memberName << ", _r." << memberName << "))";
+ out << nl << "if(!java.util.Arrays.equals(this." << memberName << ", r." << memberName << "))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -3250,10 +3275,10 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
else
{
- out << nl << "if(" << memberName << " != _r." << memberName << ')';
+ out << nl << "if(this." << memberName << " != r." << memberName << ')';
out << sb;
- out << nl << "if(" << memberName << " == null || _r." << memberName << " == null || !"
- << memberName << ".equals(_r." << memberName << "))";
+ out << nl << "if(this." << memberName << " == null || r." << memberName << " == null || !this."
+ << memberName << ".equals(r." << memberName << "))";
out << sb;
out << nl << "return false;";
out << eb;
@@ -3268,15 +3293,15 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sp << nl << "public int hashCode()";
out << sb;
- out << nl << "int __h = 5381;";
- out << nl << "__h = com.zeroc.IceInternal.HashUtil.hashAdd(__h, \"" << p->scoped() << "\");";
+ out << nl << "int h_ = 5381;";
+ out << nl << "h_ = com.zeroc.IceInternal.HashUtil.hashAdd(h_, \"" << p->scoped() << "\");";
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
string memberName = fixKwd((*d)->name());
- out << nl << "__h = com.zeroc.IceInternal.HashUtil.hashAdd(__h, " << memberName << ");";
+ out << nl << "h_ = com.zeroc.IceInternal.HashUtil.hashAdd(h_, " << memberName << ");";
}
- out << nl << "return __h;";
+ out << nl << "return h_;";
out << eb;
out << sp << nl << "public " << name << " clone()";
@@ -3295,49 +3320,49 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void ice_write(com.zeroc.Ice.OutputStream __os)";
+ out << sp << nl << "public void write(com.zeroc.Ice.OutputStream ostr)";
out << sb;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
- writeMarshalDataMember(out, package, *d, iter);
+ writeMarshalDataMember(out, package, *d, iter, true);
}
out << eb;
DataMemberList classMembers = p->classDataMembers();
- out << sp << nl << "public void ice_read(com.zeroc.Ice.InputStream __is)";
+ out << sp << nl << "public void read(com.zeroc.Ice.InputStream istr)";
out << sb;
iter = 0;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
- writeUnmarshalDataMember(out, package, *d, iter);
+ writeUnmarshalDataMember(out, package, *d, iter, true);
}
out << eb;
- out << sp << nl << "static public void write(com.zeroc.Ice.OutputStream __os, " << name << " __v)";
+ out << sp << nl << "static public void write(com.zeroc.Ice.OutputStream ostr, " << name << " v)";
out << sb;
- out << nl << "if(__v == null)";
+ out << nl << "if(v == null)";
out << sb;
- out << nl << "__nullMarshalValue.ice_write(__os);";
+ out << nl << "_nullMarshalValue.write(ostr);";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__v.ice_write(__os);";
+ out << nl << "v.write(ostr);";
out << eb;
out << eb;
- out << sp << nl << "static public " << name << " read(com.zeroc.Ice.InputStream __is, " << name << " __v)";
+ out << sp << nl << "static public " << name << " read(com.zeroc.Ice.InputStream istr, " << name << " v)";
out << sb;
- out << nl << "if(__v == null)";
+ out << nl << "if(v == null)";
out << sb;
- out << nl << " __v = new " << name << "();";
+ out << nl << " v = new " << name << "();";
out << eb;
- out << nl << "__v.ice_read(__is);";
- out << nl << "return __v;";
+ out << nl << "v.read(istr);";
+ out << nl << "return v;";
out << eb;
- out << nl << nl << "private static final " << name << " __nullMarshalValue = new " << name << "();";
+ out << nl << nl << "private static final " << name << " _nullMarshalValue = new " << name << "();";
}
out << sp << nl << "public static final long serialVersionUID = ";
@@ -3444,7 +3469,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
if(optional)
{
- out << nl << "private boolean __has_" << p->name() << ';';
+ out << nl << "private boolean _" << p->name() << ';';
}
//
@@ -3492,7 +3517,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << sb;
if(optional)
{
- out << nl << "if(!__has_" << p->name() << ')';
+ out << nl << "if(!_" << p->name() << ')';
out << sb;
out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
@@ -3509,13 +3534,13 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
out << nl << "@Deprecated";
}
- out << nl << "public void set" << capName << '(' << s << " _" << name << ')';
+ out << nl << "public void set" << capName << '(' << s << " " << name << ')';
out << sb;
if(optional)
{
- out << nl << "__has_" << p->name() << " = true;";
+ out << nl << "_" << p->name() << " = true;";
}
- out << nl << name << " = _" << name << ';';
+ out << nl << "this." << name << " = " << name << ';';
out << eb;
//
@@ -3531,7 +3556,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
}
out << nl << "public boolean has" << capName << "()";
out << sb;
- out << nl << "return __has_" << p->name() << ';';
+ out << nl << "return _" << p->name() << ';';
out << eb;
out << sp;
@@ -3542,7 +3567,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
}
out << nl << "public void clear" << capName << "()";
out << sb;
- out << nl << "__has_" << p->name() << " = false;";
+ out << nl << "_" << p->name() << " = false;";
out << eb;
const string optType =
@@ -3554,30 +3579,30 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
out << nl << "@Deprecated";
}
- out << nl << "public void optional" << capName << '(' << optType << " __v)";
+ out << nl << "public void optional" << capName << '(' << optType << " v)";
out << sb;
- out << nl << "if(__v == null || !__v.isPresent())";
+ out << nl << "if(v == null || !v.isPresent())";
out << sb;
- out << nl << "__has_" << p->name() << " = false;";
+ out << nl << "_" << p->name() << " = false;";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__has_" << p->name() << " = true;";
+ out << nl << "_" << p->name() << " = true;";
if(b && b->kind() == Builtin::KindInt)
{
- out << nl << name << " = __v.getAsInt();";
+ out << nl << name << " = v.getAsInt();";
}
else if(b && b->kind() == Builtin::KindLong)
{
- out << nl << name << " = __v.getAsLong();";
+ out << nl << name << " = v.getAsLong();";
}
else if(b && b->kind() == Builtin::KindDouble)
{
- out << nl << name << " = __v.getAsDouble();";
+ out << nl << name << " = v.getAsDouble();";
}
else
{
- out << nl << name << " = __v.get();";
+ out << nl << name << " = v.get();";
}
out << eb;
out << eb;
@@ -3590,7 +3615,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
}
out << nl << "public " << optType << " optional" << capName << "()";
out << sb;
- out << nl << "if(__has_" << p->name() << ')';
+ out << nl << "if(_" << p->name() << ')';
out << sb;
if(classType)
{
@@ -3653,7 +3678,7 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << sb;
if(optional)
{
- out << nl << "if(!__has_" << p->name() << ')';
+ out << nl << "if(!_" << p->name() << ')';
out << sb;
out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
@@ -3688,16 +3713,16 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
out << nl << "@Deprecated";
}
- out << nl << "public " << elem << " get" << capName << "(int _index)";
+ out << nl << "public " << elem << " get" << capName << "(int index)";
out << sb;
if(optional)
{
- out << nl << "if(!__has_" << p->name() << ')';
+ out << nl << "if(!_" << p->name() << ')';
out << sb;
out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
}
- out << nl << "return " << name << "[_index];";
+ out << nl << "return this." << name << "[index];";
out << eb;
//
@@ -3708,16 +3733,16 @@ Slice::Gen::TypesVisitor::visitDataMember(const DataMemberPtr& p)
{
out << nl << "@Deprecated";
}
- out << nl << "public void set" << capName << "(int _index, " << elem << " _val)";
+ out << nl << "public void set" << capName << "(int index, " << elem << " val)";
out << sb;
if(optional)
{
- out << nl << "if(!__has_" << p->name() << ')';
+ out << nl << "if(!_" << p->name() << ')';
out << sb;
out << nl << "throw new java.util.NoSuchElementException(\"" << name << " is not set\");";
out << eb;
}
- out << nl << name << "[_index] = _val;";
+ out << nl << "this." << name << "[index] = val;";
out << eb;
}
}
@@ -3769,12 +3794,12 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << sp << nl << "public int value()";
out << sb;
- out << nl << "return __value;";
+ out << nl << "return _value;";
out << eb;
- out << sp << nl << "public static " << name << " valueOf(int __v)";
+ out << sp << nl << "public static " << name << " valueOf(int v)";
out << sb;
- out << nl << "switch(__v)";
+ out << nl << "switch(v)";
out << sb;
out.dec();
for(EnumeratorList::const_iterator en = enumerators.begin(); en != enumerators.end(); ++en)
@@ -3789,50 +3814,49 @@ Slice::Gen::TypesVisitor::visitEnum(const EnumPtr& p)
out << nl << "return null;";
out << eb;
- out << sp << nl << "private"
- << nl << name << "(int __v)";
+ out << sp << nl << "private " << name << "(int v)";
out << sb;
- out << nl << "__value = __v;";
+ out << nl << "_value = v;";
out << eb;
if(!p->isLocal())
{
- out << sp << nl << "public void" << nl << "ice_write(com.zeroc.Ice.OutputStream __os)";
+ out << sp << nl << "public void write(com.zeroc.Ice.OutputStream ostr)";
out << sb;
- out << nl << "__os.writeEnum(value(), " << p->maxValue() << ");";
+ out << nl << "ostr.writeEnum(_value, " << p->maxValue() << ");";
out << eb;
- out << sp << nl << "public static void write(com.zeroc.Ice.OutputStream __os, " << name << " __v)";
+ out << sp << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, " << name << " v)";
out << sb;
- out << nl << "if(__v == null)";
+ out << nl << "if(v == null)";
out << sb;
string firstEnum = fixKwd(enumerators.front()->name());
- out << nl << "__os.writeEnum(" << absolute << '.' << firstEnum << ".value(), " << p->maxValue() << ");";
+ out << nl << "ostr.writeEnum(" << absolute << '.' << firstEnum << ".value(), " << p->maxValue() << ");";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__os.writeEnum(__v.value(), " << p->maxValue() << ");";
+ out << nl << "ostr.writeEnum(v.value(), " << p->maxValue() << ");";
out << eb;
out << eb;
- out << sp << nl << "public static " << name << " read(com.zeroc.Ice.InputStream __is)";
+ out << sp << nl << "public static " << name << " read(com.zeroc.Ice.InputStream istr)";
out << sb;
- out << nl << "int __v = __is.readEnum(" << p->maxValue() << ");";
- out << nl << "return __validate(__v);";
+ out << nl << "int v = istr.readEnum(" << p->maxValue() << ");";
+ out << nl << "return validate(v);";
out << eb;
- out << sp << nl << "private static " << name << " __validate(int __v)";
+ out << sp << nl << "private static " << name << " validate(int v)";
out << sb;
- out << nl << "final " << name << " __e = valueOf(__v);";
- out << nl << "if(__e == null)";
+ out << nl << "final " << name << " e = valueOf(v);";
+ out << nl << "if(e == null)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.MarshalException(\"enumerator value \" + __v + \" is out of range\");";
+ out << nl << "throw new com.zeroc.Ice.MarshalException(\"enumerator value \" + v + \" is out of range\");";
out << eb;
- out << nl << "return __e;";
+ out << nl << "return e;";
out << eb;
}
- out << sp << nl << "private final int __value;";
+ out << sp << nl << "private final int _value;";
out << eb;
close();
@@ -4014,10 +4038,10 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream __os, " << typeS << " __v)";
+ out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, " << typeS << " v)";
out << sb;
iter = 0;
- writeSequenceMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
+ writeSequenceMarshalUnmarshalCode(out, package, p, "v", true, iter, false);
out << eb;
out << sp;
@@ -4025,12 +4049,12 @@ Slice::Gen::HelperVisitor::visitSequence(const SequencePtr& p)
{
out << nl << "@SuppressWarnings(\"unchecked\")";
}
- out << nl << "public static " << typeS << " read(com.zeroc.Ice.InputStream __is)";
+ out << nl << "public static " << typeS << " read(com.zeroc.Ice.InputStream istr)";
out << sb;
- out << nl << typeS << " __v;";
+ out << nl << typeS << " v;";
iter = 0;
- writeSequenceMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
- out << nl << "return __v;";
+ writeSequenceMarshalUnmarshalCode(out, package, p, "v", false, iter, false);
+ out << nl << "return v;";
out << eb;
out << eb;
@@ -4066,18 +4090,18 @@ Slice::Gen::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void write(com.zeroc.Ice.OutputStream __os, " << formalType << " __v)";
+ out << nl << "public static void write(com.zeroc.Ice.OutputStream ostr, " << formalType << " v)";
out << sb;
iter = 0;
- writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", true, iter, false);
+ writeDictionaryMarshalUnmarshalCode(out, package, p, "v", true, iter, false);
out << eb;
- out << sp << nl << "public static " << formalType << " read(com.zeroc.Ice.InputStream __is)";
+ out << sp << nl << "public static " << formalType << " read(com.zeroc.Ice.InputStream istr)";
out << sb;
- out << nl << formalType << " __v;";
+ out << nl << formalType << " v;";
iter = 0;
- writeDictionaryMarshalUnmarshalCode(out, package, p, "__v", false, iter, false);
- out << nl << "return __v;";
+ writeDictionaryMarshalUnmarshalCode(out, package, p, "v", false, iter, false);
+ out << nl << "return v;";
out << eb;
out << eb;
@@ -4165,17 +4189,17 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
DocCommentPtr dc = parseDocComment(p);
- const string contextParam = "java.util.Map<String, String> __ctx";
+ const string contextParam = "java.util.Map<String, String> context";
out << sp;
writeDocComment(out,
"Contacts the remote server to verify that the object implements this type.\n"
"Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
+ "@param obj The untyped proxy.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj)";
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, ice_staticId, " << p->name()
+ out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, ice_staticId(), " << p->name()
<< "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
@@ -4183,12 +4207,12 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
writeDocComment(out,
"Contacts the remote server to verify that the object implements this type.\n"
"Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@param __ctx The Context map to send with the invocation.\n"
+ "@param obj The untyped proxy.\n"
+ "@param context The Context map to send with the invocation.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj, " << contextParam << ')';
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj, " << contextParam << ')';
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, __ctx, ice_staticId, " << p->name()
+ out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, context, ice_staticId(), " << p->name()
<< "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
@@ -4196,12 +4220,12 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
writeDocComment(out,
"Contacts the remote server to verify that a facet of the object implements this type.\n"
"Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@param __facet The name of the desired facet.\n"
+ "@param obj The untyped proxy.\n"
+ "@param facet The name of the desired facet.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj, String __facet)";
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj, String facet)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, __facet, ice_staticId, " << p->name()
+ out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, facet, ice_staticId(), " << p->name()
<< "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
@@ -4209,37 +4233,37 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
writeDocComment(out,
"Contacts the remote server to verify that a facet of the object implements this type.\n"
"Raises a local exception if a communication error occurs.\n"
- "@param __obj The untyped proxy.\n"
- "@param __facet The name of the desired facet.\n"
- "@param __ctx The Context map to send with the invocation.\n"
+ "@param obj The untyped proxy.\n"
+ "@param facet The name of the desired facet.\n"
+ "@param context The Context map to send with the invocation.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx __obj, String __facet, "
+ out << nl << "static " << p->name() << "Prx checkedCast(com.zeroc.Ice.ObjectPrx obj, String facet, "
<< contextParam << ')';
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx.__checkedCast(__obj, __facet, __ctx, ice_staticId, " << p->name()
+ out << nl << "return com.zeroc.Ice.ObjectPrx._checkedCast(obj, facet, context, ice_staticId(), " << p->name()
<< "Prx.class, _" << p->name() << "PrxI.class);";
out << eb;
out << sp;
writeDocComment(out,
"Downcasts the given proxy to this type without contacting the remote server.\n"
- "@param __obj The untyped proxy.\n"
+ "@param obj The untyped proxy.\n"
"@return A proxy for this type.");
- out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx __obj)";
+ out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx obj)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx.__uncheckedCast(__obj, " << p->name() << "Prx.class, _"
+ out << nl << "return com.zeroc.Ice.ObjectPrx._uncheckedCast(obj, " << p->name() << "Prx.class, _"
<< p->name() << "PrxI.class);";
out << eb;
out << sp;
writeDocComment(out,
"Downcasts the given proxy to this type without contacting the remote server.\n"
- "@param __obj The untyped proxy.\n"
- "@param __facet The name of the desired facet.\n"
+ "@param obj The untyped proxy.\n"
+ "@param facet The name of the desired facet.\n"
"@return A proxy for this type.");
- out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx __obj, String __facet)";
+ out << nl << "static " << p->name() << "Prx uncheckedCast(com.zeroc.Ice.ObjectPrx obj, String facet)";
out << sb;
- out << nl << "return com.zeroc.Ice.ObjectPrx.__uncheckedCast(__obj, __facet, " << p->name() << "Prx.class, _"
+ out << nl << "return com.zeroc.Ice.ObjectPrx._uncheckedCast(obj, facet, " << p->name() << "Prx.class, _"
<< p->name() << "PrxI.class);";
out << eb;
@@ -4251,7 +4275,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_context(java.util.Map<String, String> newContext)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_context(newContext);";
+ out << nl << "return (" << p->name() << "Prx)_ice_context(newContext);";
out << eb;
out << sp;
@@ -4262,7 +4286,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_adapterId(String newAdapterId)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_adapterId(newAdapterId);";
+ out << nl << "return (" << p->name() << "Prx)_ice_adapterId(newAdapterId);";
out << eb;
out << sp;
@@ -4273,7 +4297,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_endpoints(com.zeroc.Ice.Endpoint[] newEndpoints)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_endpoints(newEndpoints);";
+ out << nl << "return (" << p->name() << "Prx)_ice_endpoints(newEndpoints);";
out << eb;
out << sp;
@@ -4284,7 +4308,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_locatorCacheTimeout(int newTimeout)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_locatorCacheTimeout(newTimeout);";
+ out << nl << "return (" << p->name() << "Prx)_ice_locatorCacheTimeout(newTimeout);";
out << eb;
out << sp;
@@ -4295,7 +4319,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_invocationTimeout(int newTimeout)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_invocationTimeout(newTimeout);";
+ out << nl << "return (" << p->name() << "Prx)_ice_invocationTimeout(newTimeout);";
out << eb;
out << sp;
@@ -4306,7 +4330,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_connectionCached(boolean newCache)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_connectionCached(newCache);";
+ out << nl << "return (" << p->name() << "Prx)_ice_connectionCached(newCache);";
out << eb;
out << sp;
@@ -4317,7 +4341,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_endpointSelection(com.zeroc.Ice.EndpointSelectionType newType)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_endpointSelection(newType);";
+ out << nl << "return (" << p->name() << "Prx)_ice_endpointSelection(newType);";
out << eb;
out << sp;
@@ -4330,7 +4354,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_secure(boolean b)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_secure(b);";
+ out << nl << "return (" << p->name() << "Prx)_ice_secure(b);";
out << eb;
out << sp;
@@ -4341,7 +4365,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_encodingVersion(com.zeroc.Ice.EncodingVersion e)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_encodingVersion(e);";
+ out << nl << "return (" << p->name() << "Prx)_ice_encodingVersion(e);";
out << eb;
out << sp;
@@ -4354,7 +4378,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_preferSecure(boolean b)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_preferSecure(b);";
+ out << nl << "return (" << p->name() << "Prx)_ice_preferSecure(b);";
out << eb;
out << sp;
@@ -4365,7 +4389,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_router(com.zeroc.Ice.RouterPrx router)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_router(router);";
+ out << nl << "return (" << p->name() << "Prx)_ice_router(router);";
out << eb;
out << sp;
@@ -4376,7 +4400,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_locator(com.zeroc.Ice.LocatorPrx locator)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_locator(locator);";
+ out << nl << "return (" << p->name() << "Prx)_ice_locator(locator);";
out << eb;
out << sp;
@@ -4387,7 +4411,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_collocationOptimized(boolean b)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_collocationOptimized(b);";
+ out << nl << "return (" << p->name() << "Prx)_ice_collocationOptimized(b);";
out << eb;
out << sp;
@@ -4397,7 +4421,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_twoway()";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_twoway();";
+ out << nl << "return (" << p->name() << "Prx)_ice_twoway();";
out << eb;
out << sp;
@@ -4407,7 +4431,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_oneway()";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_oneway();";
+ out << nl << "return (" << p->name() << "Prx)_ice_oneway();";
out << eb;
out << sp;
@@ -4417,7 +4441,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_batchOneway()";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_batchOneway();";
+ out << nl << "return (" << p->name() << "Prx)_ice_batchOneway();";
out << eb;
out << sp;
@@ -4427,7 +4451,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_datagram()";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_datagram();";
+ out << nl << "return (" << p->name() << "Prx)_ice_datagram();";
out << eb;
out << sp;
@@ -4437,7 +4461,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_batchDatagram()";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_batchDatagram();";
+ out << nl << "return (" << p->name() << "Prx)_ice_batchDatagram();";
out << eb;
out << sp;
@@ -4448,7 +4472,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_compress(boolean co)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_compress(co);";
+ out << nl << "return (" << p->name() << "Prx)_ice_compress(co);";
out << eb;
out << sp;
@@ -4459,7 +4483,7 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_timeout(int t)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_timeout(t);";
+ out << nl << "return (" << p->name() << "Prx)_ice_timeout(t);";
out << eb;
out << sp;
@@ -4470,15 +4494,13 @@ Slice::Gen::ProxyVisitor::visitClassDefEnd(const ClassDefPtr& p)
out << nl << "@Override";
out << nl << "default " << p->name() << "Prx ice_connectionId(String connectionId)";
out << sb;
- out << nl << "return (" << p->name() << "Prx)__ice_connectionId(connectionId);";
+ out << nl << "return (" << p->name() << "Prx)_ice_connectionId(connectionId);";
out << eb;
out << sp;
- out << nl << "final static String ice_staticId = \"" << p->scoped() << "\";";
- out << sp;
out << nl << "static String ice_staticId()";
out << sb;
- out << nl << "return ice_staticId;";
+ out << nl << "return \"" << p->scoped() << "\";";
out << eb;
out << eb;
@@ -4541,8 +4563,9 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
throws.sort(Slice::DerivedToBaseCompare());
#endif
- const string contextDoc = "@param __ctx The Context map to send with the invocation.";
- const string contextParam = "java.util.Map<String, String> __ctx";
+ const string contextParamName = getEscapedParamName(p, "context");
+ const string contextDoc = "@param " + contextParamName +" The Context map to send with the invocation.";
+ const string contextParam = "java.util.Map<String, String> " + contextParamName;
const string noExplicitContextArg = "com.zeroc.Ice.ObjectPrx.noExplicitContext";
DocCommentPtr dc = parseDocComment(p);
@@ -4583,7 +4606,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
out << "return ";
}
- out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__wait();";
+ out << "_iceI_" << p->name() << "Async" << spar << args << contextParamName << "true" << epar << ".waitForResponse();";
}
else
{
@@ -4594,19 +4617,19 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
out << "return ";
}
- out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__waitUserEx();";
+ out << "_iceI_" << p->name() << "Async" << spar << args << contextParamName << "true" << epar << ".waitForResponseOrUserEx();";
out << eb;
for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
{
string exS = getAbsolute(*t, package);
- out << nl << "catch(" << exS << " __ex)";
+ out << nl << "catch(" << exS << " ex)";
out << sb;
- out << nl << "throw __ex;";
+ out << nl << "throw ex;";
out << eb;
}
- out << nl << "catch(com.zeroc.Ice.UserException __ex)";
+ out << nl << "catch(com.zeroc.Ice.UserException ex)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.UnknownUserException(__ex.ice_id(), __ex);";
+ out << nl << "throw new com.zeroc.Ice.UnknownUserException(ex.ice_id(), ex);";
out << eb;
}
out << eb;
@@ -4649,7 +4672,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
out << "return ";
}
- out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__wait();";
+ out << "_iceI_" << p->name() << "Async" << spar << args << contextParamName << "true" << epar << ".waitForResponse();";
}
else
{
@@ -4660,19 +4683,19 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
{
out << "return ";
}
- out << "__" << p->name() << "Async" << spar << args << "__ctx" << "true" << epar << ".__waitUserEx();";
+ out << "_iceI_" << p->name() << "Async" << spar << args << contextParamName << "true" << epar << ".waitForResponseOrUserEx();";
out << eb;
for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
{
string exS = getAbsolute(*t, package);
- out << nl << "catch(" << exS << " __ex)";
+ out << nl << "catch(" << exS << " ex)";
out << sb;
- out << nl << "throw __ex;";
+ out << nl << "throw ex;";
out << eb;
}
- out << nl << "catch(com.zeroc.Ice.UserException __ex)";
+ out << nl << "catch(com.zeroc.Ice.UserException ex)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.UnknownUserException(__ex.ice_id(), __ex);";
+ out << nl << "throw new com.zeroc.Ice.UnknownUserException(ex.ice_id(), ex);";
out << eb;
}
out << eb;
@@ -4692,7 +4715,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
out << nl << "default " << future << ' ' << p->name() << "Async" << spar << params << epar;
out << sb;
- out << nl << "return __" << p->name() << "Async" << spar << args << noExplicitContextArg << "false" << epar << ';';
+ out << nl << "return _iceI_" << p->name() << "Async" << spar << args << noExplicitContextArg << "false" << epar << ';';
out << eb;
out << sp;
@@ -4704,26 +4727,27 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
out << nl << "default " << future << ' ' << p->name() << "Async" << spar << params << contextParam << epar;
out << sb;
- out << nl << "return __" << p->name() << "Async" << spar << args << "__ctx" << "false" << epar << ';';
+ out << nl << "return _iceI_" << p->name() << "Async" << spar << args << "context" << "false" << epar << ';';
out << eb;
const string futureImpl = getFutureImplType(p, package);
out << sp;
- out << nl << "default " << futureImpl << " __" << p->name() << "Async" << spar << params << contextParam
- << "boolean __sync" << epar;
+ out << nl << "default " << futureImpl << " _iceI_" << p->name() << "Async" << spar << getParamsProxy(p, package, false, true)
+ << "java.util.Map<String, String> context"
+ << "boolean sync" << epar;
out << sb;
- out << nl << futureImpl << " __f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
- << sliceModeToIceMode(p->sendMode()) << ", __sync, "
- << (throws.empty() ? "null" : "__" + p->name() + "_ex") << ");";
+ out << nl << futureImpl << " f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
+ << sliceModeToIceMode(p->sendMode()) << ", sync, "
+ << (throws.empty() ? "null" : "_iceE_" + p->name()) << ");";
- out << nl << "__f.invoke(";
+ out << nl << "f.invoke(";
out.useCurrentPosAsIndent();
- out << (p->returnsData() ? "true" : "false") << ", __ctx, " << opFormatTypeToString(p)
+ out << (p->returnsData() ? "true" : "false") << ", context, " << opFormatTypeToString(p)
<< ", ";
if(!p->inParameters().empty())
{
- out << "__os -> {";
+ out << "ostr -> {";
out.inc();
writeMarshalProxyParams(out, package, p, false);
out.dec();
@@ -4736,7 +4760,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << ", ";
if(returnsParams)
{
- out << "__is -> {";
+ out << "istr -> {";
out.inc();
writeUnmarshalProxyResults(out, package, p);
out.dec();
@@ -4748,12 +4772,12 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
out.restoreIndent();
out << ");";
- out << nl << "return __f;";
+ out << nl << "return f;";
out << eb;
if(!throws.empty())
{
- out << sp << nl << "static final Class<?>[] __" << p->name() << "_ex =";
+ out << sp << nl << "static final Class<?>[] _iceE_" << p->name() << " =";
out << sb;
for(ExceptionList::const_iterator t = throws.begin(); t != throws.end(); ++t)
{
@@ -4779,7 +4803,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
out << nl << "default " << future << ' ' << p->name() << "Async" << spar << paramsOpt << epar;
out << sb;
- out << nl << "return __" << p->name() << "Async" << spar << args << noExplicitContextArg << "false" << epar
+ out << nl << "return _iceI_" << p->name() << "Async" << spar << args << noExplicitContextArg << "false" << epar
<< ';';
out << eb;
@@ -4792,23 +4816,24 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
out << nl << "default " << future << ' ' << p->name() << "Async" << spar << paramsOpt << contextParam << epar;
out << sb;
- out << nl << "return __" << p->name() << "Async" << spar << args << "__ctx" << "false" << epar << ';';
+ out << nl << "return _iceI_" << p->name() << "Async" << spar << args << contextParamName << "false" << epar << ';';
out << eb;
out << sp;
- out << nl << "default " << futureImpl << " __" << p->name() << "Async" << spar << paramsOpt << contextParam
- << "boolean __sync" << epar;
+ out << nl << "default " << futureImpl << " _iceI_" << p->name() << "Async" << spar << getParamsProxy(p, package, true, true)
+ << "java.util.Map<String, String> context"
+ << "boolean sync" << epar;
out << sb;
- out << nl << futureImpl << " __f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
- << sliceModeToIceMode(p->sendMode()) << ", __sync, "
- << (throws.empty() ? "null" : "__" + p->name() + "_ex") << ");";
+ out << nl << futureImpl << " f = new com.zeroc.IceInternal.OutgoingAsync<>(this, \"" << p->name() << "\", "
+ << sliceModeToIceMode(p->sendMode()) << ", sync, "
+ << (throws.empty() ? "null" : "_iceE_" + p->name()) << ");";
- out << nl << "__f.invoke(";
+ out << nl << "f.invoke(";
out.useCurrentPosAsIndent();
- out << (p->returnsData() ? "true" : "false") << ", __ctx, " << opFormatTypeToString(p) << ", ";
+ out << (p->returnsData() ? "true" : "false") << ", context, " << opFormatTypeToString(p) << ", ";
if(!p->inParameters().empty())
{
- out << "__os -> {";
+ out << "ostr -> {";
out.inc();
writeMarshalProxyParams(out, package, p, true);
out.dec();
@@ -4821,7 +4846,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
out << ", ";
if(returnsParams)
{
- out << "__is -> {";
+ out << "istr -> {";
out.inc();
writeUnmarshalProxyResults(out, package, p);
out.dec();
@@ -4833,7 +4858,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p)
}
out.restoreIndent();
out << ");";
- out << nl << "return __f;";
+ out << nl << "return f;";
out << eb;
}
}
@@ -5064,7 +5089,7 @@ Slice::Gen::ImplVisitor::initResult(Output& out, const string& package, const Op
if(op->hasMarshaledResult())
{
- out << nl << retS << " __r = new " << retS << spar;
+ out << nl << retS << " r = new " << retS << spar;
const ParamDeclList outParams = op->outParameters();
if(op->returnType())
{
@@ -5074,16 +5099,16 @@ Slice::Gen::ImplVisitor::initResult(Output& out, const string& package, const Op
{
out << getDefaultValue(package, (*p)->type(), (*p)->optional());
}
- out << "__current" << epar << ';';
+ out << "current" << epar << ';';
}
else if(op->returnsMultipleValues())
{
- out << nl << retS << " __r = new " << retS << "();";
+ out << nl << retS << " r = new " << retS << "();";
string retval = "returnValue";
const ParamDeclList outParams = op->outParameters();
for(ParamDeclList::const_iterator p = outParams.begin(); p != outParams.end(); ++p)
{
- out << nl << "__r." << fixKwd((*p)->name()) << " = "
+ out << nl << "r." << fixKwd((*p)->name()) << " = "
<< getDefaultValue(package, (*p)->type(), (*p)->optional()) << ';';
if((*p)->name() == "returnValue")
{
@@ -5092,7 +5117,7 @@ Slice::Gen::ImplVisitor::initResult(Output& out, const string& package, const Op
}
if(op->returnType())
{
- out << nl << "__r." << retval << " = "
+ out << nl << "r." << retval << " = "
<< getDefaultValue(package, op->returnType(), op->returnIsOptional()) << ';';
}
}
@@ -5112,7 +5137,7 @@ Slice::Gen::ImplVisitor::initResult(Output& out, const string& package, const Op
}
if(type)
{
- out << nl << retS << " __r = " << getDefaultValue(package, type, optional) << ';';
+ out << nl << retS << " r = " << getDefaultValue(package, type, optional) << ';';
}
else
{
@@ -5135,6 +5160,7 @@ Slice::Gen::ImplVisitor::writeOperation(Output& out, const string& package, cons
const ContainerPtr container = op->container();
const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
const vector<string> params = getParams(op, package);
+ const string currentParam = "com.zeroc.Ice.Current " + getEscapedParamName(op, "current");
if(local)
{
@@ -5155,7 +5181,7 @@ Slice::Gen::ImplVisitor::writeOperation(Output& out, const string& package, cons
out << sb;
if(initResult(out, package, op))
{
- out << nl << "return __r;";
+ out << nl << "return r;";
}
out << eb;
@@ -5179,12 +5205,12 @@ Slice::Gen::ImplVisitor::writeOperation(Output& out, const string& package, cons
out << sp;
out << nl << "@Override";
out << nl << "public java.util.concurrent.CompletionStage<" << retS << "> " << opName << "Async" << spar
- << params << "com.zeroc.Ice.Current __current" << epar;
+ << params << currentParam << epar;
writeThrowsClause(package, throws);
out << sb;
if(initResult(out, package, op))
{
- out << nl << "return java.util.concurrent.CompletableFuture.completedFuture(__r);";
+ out << nl << "return java.util.concurrent.CompletableFuture.completedFuture(r);";
}
else
{
@@ -5197,12 +5223,12 @@ Slice::Gen::ImplVisitor::writeOperation(Output& out, const string& package, cons
out << sp;
out << nl << "@Override";
out << nl << "public " << getResultType(op, package, false, true) << ' ' << fixKwd(opName) << spar << params
- << "com.zeroc.Ice.Current __current" << epar;
+ << currentParam << epar;
writeThrowsClause(package, throws);
out << sb;
if(initResult(out, package, op))
{
- out << nl << "return __r;";
+ out << nl << "return r;";
}
out << eb;
}