summaryrefslogtreecommitdiff
path: root/cpp/src
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
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')
-rw-r--r--cpp/src/Slice/JavaUtil.cpp413
-rw-r--r--cpp/src/Slice/JavaUtil.h20
-rw-r--r--cpp/src/slice2java/Gen.cpp746
-rw-r--r--cpp/src/slice2java/Gen.h6
-rw-r--r--cpp/src/slice2java/GenCompat.cpp962
-rw-r--r--cpp/src/slice2java/GenCompat.h18
6 files changed, 1156 insertions, 1009 deletions
diff --git a/cpp/src/Slice/JavaUtil.cpp b/cpp/src/Slice/JavaUtil.cpp
index 0a20815d592..ba141e904c0 100644
--- a/cpp/src/Slice/JavaUtil.cpp
+++ b/cpp/src/Slice/JavaUtil.cpp
@@ -1299,19 +1299,25 @@ Slice::JavaCompatGenerator::typeToObjectString(const TypePtr& type,
void
Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
- const string& package,
- const TypePtr& type,
- OptionalMode mode,
- bool optionalMapping,
- int tag,
- const string& param,
- bool marshal,
- int& iter,
- bool holder,
- const StringList& metaData,
- const string& patchParams)
+ const string& package,
+ const TypePtr& type,
+ OptionalMode mode,
+ bool optionalMapping,
+ int tag,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool holder,
+ const string& customStream,
+ const StringList& metaData,
+ const string& patchParams)
{
- string stream = marshal ? "__os" : "__is";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
+
string v;
if(holder)
{
@@ -1585,9 +1591,9 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
}
else if(mode == OptionalMember)
{
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << stream << ".writeProxy(" << v << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -1634,26 +1640,26 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
out << nl << "if(" << v << " != null && " << v << ".isSet() && " << stream << ".writeOptional("
<< tag << ", " << getOptionalFormat(type) << "))";
out << sb;
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << typeS << "Helper.write(" << stream << ", " << v << ".get());";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
else
{
out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
}
else if(mode == OptionalMember)
{
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << typeS << "Helper.write(" << stream << ", " << v << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -1776,9 +1782,9 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
if(st->isVariableLength())
{
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << typeS << ".write(" << stream << ", " << val << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -1811,9 +1817,9 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
out << nl << stream << ".skipSize();";
}
- out << nl << typeS << " __tmpOpt = new " << typeS << "();";
- out << nl << "__tmpOpt.__read(" << stream << ");";
- out << nl << v << ".set(__tmpOpt);";
+ out << nl << typeS << " tmpOpt = new " << typeS << "();";
+ out << nl << "tmpOpt.read(" << stream << ");";
+ out << nl << v << ".set(tmpOpt);";
out << eb;
@@ -1928,9 +1934,9 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
if(keyType->isVariableLength() || valueType->isVariableLength())
{
string d = optionalParam && optionalMapping ? v + ".get()" : v;
- out << nl << "int __pos = " << stream << ".startSize();";
- writeDictionaryMarshalUnmarshalCode(out, package, dict, d, marshal, iter, true, metaData);
- out << nl << stream << ".endSize(__pos);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, d, marshal, iter, true, customStream, metaData);
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -1938,17 +1944,17 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam && optionalMapping)
{
- tmpName = "__optDict";
+ tmpName = "optDict";
out << nl << "final " << typeS << ' ' << tmpName << " = " << v << ".get();";
}
else
{
tmpName = v;
}
- out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
- out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
- << " + 5 : __optSize * " << wireSize << " + 1);";
- writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData);
+ out << nl << "final int optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
+ out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << wireSize
+ << " + 5 : optSize * " << wireSize << " + 1);";
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, customStream, metaData);
}
if(optionalParam)
@@ -1962,7 +1968,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
if(optionalParam)
{
- tmpName = "__optDict";
+ tmpName = "optDict";
out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
out << nl << typeS << ' ' << tmpName << ';';
@@ -1981,7 +1987,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
out << nl << stream << ".skipSize();";
}
- writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData);
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, customStream, metaData);
if(optionalParam)
{
@@ -1999,7 +2005,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
}
else
{
- writeDictionaryMarshalUnmarshalCode(out, package, dict, v, marshal, iter, true, metaData);
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, v, marshal, iter, true, customStream, metaData);
}
return;
}
@@ -2090,9 +2096,9 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
if(elemType->isVariableLength())
{
string s = optionalParam && optionalMapping ? v + ".get()" : v;
- out << nl << "int __pos = " << stream << ".startSize();";
- writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData);
- out << nl << stream << ".endSize(__pos);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, customStream, metaData);
+ out << nl << stream << ".endSize(pos);";
}
else if(findMetaData("java:type:", metaData, ignore) ||
findMetaData("java:type:", seq->getMetaData(), ignore))
@@ -2105,7 +2111,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam && optionalMapping)
{
- tmpName = "__optSeq";
+ tmpName = "optSeq";
out << nl << "final " << typeS << ' ' << tmpName << " = " << v << ".get();";
}
else
@@ -2115,11 +2121,11 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
if(wireSize > 1)
{
- out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
- out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
- << " + 5 : __optSize * " << wireSize << " + 1);";
+ out << nl << "final int optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
+ out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << wireSize
+ << " + 5 : optSize * " << wireSize << " + 1);";
}
- writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, customStream, metaData);
}
else if(findMetaData("java:protobuf:", seq->getMetaData(), ignore) ||
findMetaData("java:serializable:", seq->getMetaData(), ignore))
@@ -2128,7 +2134,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
// This just writes a byte sequence.
//
string s = optionalParam && optionalMapping ? v + ".get()" : v;
- writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, customStream, metaData);
}
else
{
@@ -2139,7 +2145,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam && optionalMapping)
{
- tmpName = "__optSeq";
+ tmpName = "optSeq";
out << nl << "final " << typeS << ' ' << tmpName << " = " << v << ".get();";
}
else
@@ -2149,12 +2155,12 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
if(wireSize > 1)
{
- out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".length;";
- out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
- << " + 5 : __optSize * " << wireSize << " + 1);";
+ out << nl << "final int optSize = " << tmpName << " == null ? 0 : " << tmpName << ".length;";
+ out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << wireSize
+ << " + 5 : optSize * " << wireSize << " + 1);";
}
- writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, customStream, metaData);
}
if(optionalParam)
@@ -2167,7 +2173,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam)
{
- tmpName = "__optSeq";
+ tmpName = "optSeq";
out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
out << nl << typeS << ' ' << tmpName << ';';
@@ -2199,7 +2205,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
}
}
- writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, customStream, metaData);
if(optionalParam)
{
@@ -2217,7 +2223,7 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
}
else
{
- writeSequenceMarshalUnmarshalCode(out, package, seq, v, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, v, marshal, iter, true, customStream, metaData);
}
return;
}
@@ -2237,15 +2243,21 @@ Slice::JavaCompatGenerator::writeMarshalUnmarshalCode(Output& out,
void
Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
- const string& package,
- const DictionaryPtr& dict,
- const string& param,
- bool marshal,
- int& iter,
- bool useHelper,
- const StringList& metaData)
+ const string& package,
+ const DictionaryPtr& dict,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool useHelper,
+ const string& customStream,
+ const StringList& metaData)
{
- string stream = marshal ? "__os" : "__is";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
+
string v = param;
string instanceType;
@@ -2305,14 +2317,14 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
out << nl << "if(" << v << " == null)";
out << sb;
- out << nl << "__os.writeSize(0);";
+ out << nl << "ostr.writeSize(0);";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__os.writeSize(" << v << ".size());";
+ out << nl << "ostr.writeSize(" << v << ".size());";
string keyObjectS = typeToObjectString(key, TypeModeIn, package);
string valueObjectS = typeToObjectString(value, TypeModeIn, package);
- out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
+ out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> e : " << v
<< ".entrySet())";
out << sb;
for(int i = 0; i < 2; i++)
@@ -2321,15 +2333,15 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
TypePtr type;
if(i == 0)
{
- arg = "__e.getKey()";
+ arg = "e.getKey()";
type = key;
}
else
{
- arg = "__e.getValue()";
+ arg = "e.getValue()";
type = value;
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, true, iter, false);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, true, iter, false, customStream);
}
out << eb;
out << eb;
@@ -2337,8 +2349,8 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
else
{
out << nl << v << " = new " << instanceType << "();";
- out << nl << "int __sz" << iterS << " = __is.readSize();";
- out << nl << "for(int __i" << iterS << " = 0; __i" << iterS << " < __sz" << iterS << "; __i" << iterS << "++)";
+ out << nl << "int sz" << iterS << " = " << stream << ".readSize();";
+ out << nl << "for(int i" << iterS << " = 0; i" << iterS << " < sz" << iterS << "; i" << iterS << "++)";
out << sb;
for(int i = 0; i < 2; i++)
{
@@ -2347,13 +2359,13 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
string typeS;
if(i == 0)
{
- arg = "__key";
+ arg = "key";
type = key;
typeS = keyS;
}
else
{
- arg = "__value";
+ arg = "value";
type = value;
typeS = valueS;
}
@@ -2364,9 +2376,9 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
string keyTypeStr = typeToObjectString(key, TypeModeIn, package);
string valueTypeStr = typeToObjectString(value, TypeModeIn, package);
writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, false,
- StringList(),
+ customStream, StringList(),
"new IceInternal.DictionaryPatcher<" + keyTypeStr + ", " + valueTypeStr +
- ">(" + v + ", " + typeS + ".class, __key)");
+ ">(" + v + ", " + typeS + ".class, key)");
}
else
{
@@ -2378,13 +2390,13 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
out << nl << typeS << ' ' << arg << ';';
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, false);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, false, customStream);
}
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
if(!(builtin && builtin->usesClasses()) && !ClassDeclPtr::dynamicCast(value))
{
- out << nl << "" << v << ".put(__key, __value);";
+ out << nl << "" << v << ".put(key, value);";
}
out << eb;
}
@@ -2392,15 +2404,20 @@ Slice::JavaCompatGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
void
Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
- const string& package,
- const SequencePtr& seq,
- const string& param,
- bool marshal,
- int& iter,
- bool useHelper,
- const StringList& metaData)
+ const string& package,
+ const SequencePtr& seq,
+ const string& param,
+ bool marshal,
+ int& iter,
+ bool useHelper,
+ const string& customStream,
+ const StringList& metaData)
{
- string stream = marshal ? "__os" : "__is";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
string v = param;
//
@@ -2443,9 +2460,9 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
out << nl << v << " = " << type << ".parseFrom(" << stream << ".readByteSeq());";
out << eb;
- out << nl << "catch(com.google.protobuf.InvalidProtocolBufferException __ex)";
+ out << nl << "catch(com.google.protobuf.InvalidProtocolBufferException ex)";
out << sb;
- out << nl << "throw new Ice.MarshalException(__ex);";
+ out << nl << "throw new Ice.MarshalException(ex);";
out << eb;
}
return;
@@ -2641,9 +2658,9 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
out << nl << stream << ".writeSize(" << v << ".size());";
string typeS = typeToString(type, TypeModeIn, package);
- out << nl << "for(" << typeS << " __elem : " << v << ')';
+ out << nl << "for(" << typeS << " elem : " << v << ')';
out << sb;
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", true, iter, false);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", true, iter, false, customStream);
out << eb;
out << eb; // else
}
@@ -2656,9 +2673,9 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
isObject = true;
}
out << nl << v << " = new " << instanceType << "();";
- out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize(" << type->minWireSize()
+ out << nl << "final int len" << iter << " = " << stream << ".readAndCheckSeqSize(" << type->minWireSize()
<< ");";
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int i" << iter << " = 0; i" << iter << " < len" << iter << "; i" << iter
<< "++)";
out << sb;
if(isObject)
@@ -2669,25 +2686,25 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << v << ".add(null);";
ostringstream patchParams;
patchParams << "new IceInternal.ListPatcher<" << origContentS << ">(" << v << ", " << origContentS
- << ".class, __i" << iter << ')';
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter,
- false, StringList(), patchParams.str());
+ << ".class, i" << iter << ')';
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", false, iter,
+ false, customStream, StringList(), patchParams.str());
}
else
{
if(StructPtr::dynamicCast(type))
{
- out << nl << cont << " __elem = null;";
+ out << nl << cont << " elem = null;";
}
else
{
- out << nl << cont << " __elem;";
+ out << nl << cont << " elem;";
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter, false);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", false, iter, false, customStream);
}
if(!isObject)
{
- out << nl << v << ".add(__elem);";
+ out << nl << v << ".add(elem);";
}
out << eb;
iter++;
@@ -2819,13 +2836,13 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << v << ".length);";
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
+ out << nl << "for(int i" << iter << " = 0; i" << iter << " < " << v << ".length; i" << iter
<< "++)";
out << sb;
ostringstream o;
- o << v << "[__i" << iter << "]";
+ o << v << "[i" << iter << "]";
iter++;
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), true, iter, false);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), true, iter, false, customStream);
out << eb;
out << eb;
}
@@ -2837,7 +2854,7 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
isObject = true;
}
- out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize("
+ out << nl << "final int len" << iter << " = " << stream << ".readAndCheckSeqSize("
<< type->minWireSize() << ");";
//
// We cannot allocate an array of a generic type, such as
@@ -2868,11 +2885,11 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << "[]";
}
- out << ")new " << nonGenericType << "[__len" << iter << "]";
+ out << ")new " << nonGenericType << "[len" << iter << "]";
}
else
{
- out << nl << v << " = new " << origContentS << "[__len" << iter << "]";
+ out << nl << v << " = new " << origContentS << "[len" << iter << "]";
}
int d = depth;
while(d--)
@@ -2880,22 +2897,23 @@ Slice::JavaCompatGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << "[]";
}
out << ';';
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int i" << iter << " = 0; i" << iter << " < len" << iter << "; i" << iter
<< "++)";
out << sb;
ostringstream o;
- o << v << "[__i" << iter << "]";
+ o << v << "[i" << iter << "]";
ostringstream patchParams;
if(isObject)
{
patchParams << "new IceInternal.SequencePatcher(" << v << ", " << origContentS
- << ".class, __i" << iter << ')';
+ << ".class, i" << iter << ')';
writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter,
- false, StringList(), patchParams.str());
+ false, customStream, StringList(), patchParams.str());
}
else
{
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter, false);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false,
+ iter, false, customStream);
}
out << eb;
iter++;
@@ -3361,15 +3379,15 @@ Slice::JavaGenerator::getStaticId(const TypePtr& type, const string& package) co
if(b && b->kind() == Builtin::KindObject)
{
- return "com.zeroc.Ice.Object.ice_staticId";
+ return "com.zeroc.Ice.Object.ice_staticId()";
}
else if(b && b->kind() == Builtin::KindValue)
{
- return "com.zeroc.Ice.Value.ice_staticId";
+ return "com.zeroc.Ice.Value.ice_staticId()";
}
else
{
- return getAbsolute(cl, package) + ".ice_staticId";
+ return getAbsolute(cl, package) + ".ice_staticId()";
}
}
@@ -3695,10 +3713,15 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
const string& param,
bool marshal,
int& iter,
+ const string& customStream,
const StringList& metaData,
const string& patchParams)
{
- const string stream = marshal ? "__os" : "__is";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
const bool optionalParam = mode == OptionalInParam || mode == OptionalOutParam || mode == OptionalReturnParam;
const BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
@@ -3952,9 +3975,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
else if(mode == OptionalMember)
{
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << stream << ".writeProxy(" << param << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -4001,26 +4024,26 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
out << nl << "if(" << param << " != null && " << param << ".isPresent() && " << stream
<< ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << stream << ".writeProxy(" << param << ".get());";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
else
{
out << nl << "if(" << stream << ".writeOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << stream << ".writeProxy(" << param << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
out << eb;
}
}
else if(mode == OptionalMember)
{
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << stream << ".writeProxy(" << param << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -4116,9 +4139,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
if(st->isVariableLength())
{
- out << nl << "int __pos = " << stream << ".startSize();";
+ out << nl << "int pos = " << stream << ".startSize();";
out << nl << typeS << ".write(" << stream << ", " << val << ");";
- out << nl << stream << ".endSize(__pos);";
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -4260,9 +4283,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
if(keyType->isVariableLength() || valueType->isVariableLength())
{
string d = optionalParam && optionalMapping ? param + ".get()" : param;
- out << nl << "int __pos = " << stream << ".startSize();";
- writeDictionaryMarshalUnmarshalCode(out, package, dict, d, marshal, iter, true, metaData);
- out << nl << stream << ".endSize(__pos);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, d, marshal, iter, true, customStream, metaData);
+ out << nl << stream << ".endSize(pos);";
}
else
{
@@ -4270,17 +4293,17 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam && optionalMapping)
{
- tmpName = "__optDict";
+ tmpName = "optDict";
out << nl << "final " << typeS << ' ' << tmpName << " = " << param << ".get();";
}
else
{
tmpName = param;
}
- out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
- out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
- << " + 5 : __optSize * " << wireSize << " + 1);";
- writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData);
+ out << nl << "final int optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
+ out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << wireSize
+ << " + 5 : optSize * " << wireSize << " + 1);";
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, customStream, metaData);
}
if(optionalParam)
@@ -4294,7 +4317,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
if(optionalParam)
{
- tmpName = "__optDict";
+ tmpName = "optDict";
out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
out << nl << typeS << ' ' << tmpName << ';';
@@ -4313,7 +4336,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
out << nl << stream << ".skipSize();";
}
- writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, metaData);
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, tmpName, marshal, iter, true, customStream, metaData);
if(optionalParam)
{
@@ -4328,7 +4351,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
else
{
- writeDictionaryMarshalUnmarshalCode(out, package, dict, param, marshal, iter, true, metaData);
+ writeDictionaryMarshalUnmarshalCode(out, package, dict, param, marshal, iter, true, customStream, metaData);
}
return;
}
@@ -4419,9 +4442,9 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
if(elemType->isVariableLength())
{
string s = optionalParam && optionalMapping ? param + ".get()" : param;
- out << nl << "int __pos = " << stream << ".startSize();";
- writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData);
- out << nl << stream << ".endSize(__pos);";
+ out << nl << "int pos = " << stream << ".startSize();";
+ writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, customStream, metaData);
+ out << nl << stream << ".endSize(pos);";
}
else if(findMetaData("java:type:", metaData, ignore) ||
findMetaData("java:type:", seq->getMetaData(), ignore))
@@ -4434,7 +4457,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam && optionalMapping)
{
- tmpName = "__optSeq";
+ tmpName = "optSeq";
out << nl << "final " << typeS << ' ' << tmpName << " = " << param << ".get();";
}
else
@@ -4444,11 +4467,11 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
if(wireSize > 1)
{
- out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
- out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
- << " + 5 : __optSize * " << wireSize << " + 1);";
+ out << nl << "final int optSize = " << tmpName << " == null ? 0 : " << tmpName << ".size();";
+ out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << wireSize
+ << " + 5 : optSize * " << wireSize << " + 1);";
}
- writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, customStream, metaData);
}
else if(findMetaData("java:protobuf:", seq->getMetaData(), ignore) ||
findMetaData("java:serializable:", seq->getMetaData(), ignore))
@@ -4457,7 +4480,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
// This just writes a byte sequence.
//
string s = optionalParam && optionalMapping ? param + ".get()" : param;
- writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, s, marshal, iter, true, customStream, metaData);
}
else
{
@@ -4468,7 +4491,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam && optionalMapping)
{
- tmpName = "__optSeq";
+ tmpName = "optSeq";
out << nl << "final " << typeS << ' ' << tmpName << " = " << param << ".get();";
}
else
@@ -4478,12 +4501,12 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
if(wireSize > 1)
{
- out << nl << "final int __optSize = " << tmpName << " == null ? 0 : " << tmpName << ".length;";
- out << nl << stream << ".writeSize(__optSize > 254 ? __optSize * " << wireSize
- << " + 5 : __optSize * " << wireSize << " + 1);";
+ out << nl << "final int optSize = " << tmpName << " == null ? 0 : " << tmpName << ".length;";
+ out << nl << stream << ".writeSize(optSize > 254 ? optSize * " << wireSize
+ << " + 5 : optSize * " << wireSize << " + 1);";
}
- writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, customStream, metaData);
}
if(optionalParam)
@@ -4496,7 +4519,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
string tmpName;
if(optionalParam)
{
- tmpName = "__optSeq";
+ tmpName = "optSeq";
out << nl << "if(" << stream << ".readOptional(" << tag << ", " << getOptionalFormat(type) << "))";
out << sb;
out << nl << typeS << ' ' << tmpName << ';';
@@ -4528,7 +4551,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
}
- writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, tmpName, marshal, iter, true, customStream, metaData);
if(optionalParam)
{
@@ -4543,7 +4566,7 @@ Slice::JavaGenerator::writeMarshalUnmarshalCode(Output& out,
}
else
{
- writeSequenceMarshalUnmarshalCode(out, package, seq, param, marshal, iter, true, metaData);
+ writeSequenceMarshalUnmarshalCode(out, package, seq, param, marshal, iter, true, customStream, metaData);
}
return;
}
@@ -4569,9 +4592,15 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
bool marshal,
int& iter,
bool useHelper,
+ const string& customStream,
const StringList& metaData)
{
- string stream = marshal ? "__os" : "__is";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
+
string v = param;
string instanceType;
@@ -4631,14 +4660,14 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
out << nl << "if(" << v << " == null)";
out << sb;
- out << nl << "__os.writeSize(0);";
+ out << nl << "ostr.writeSize(0);";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__os.writeSize(" << v << ".size());";
+ out << nl << "ostr.writeSize(" << v << ".size());";
string keyObjectS = typeToObjectString(key, TypeModeIn, package);
string valueObjectS = typeToObjectString(value, TypeModeIn, package);
- out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> __e : " << v
+ out << nl << "for(java.util.Map.Entry<" << keyObjectS << ", " << valueObjectS << "> e : " << v
<< ".entrySet())";
out << sb;
for(int i = 0; i < 2; i++)
@@ -4647,15 +4676,15 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
TypePtr type;
if(i == 0)
{
- arg = "__e.getKey()";
+ arg = "e.getKey()";
type = key;
}
else
{
- arg = "__e.getValue()";
+ arg = "e.getValue()";
type = value;
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, true, iter);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, true, iter, customStream);
}
out << eb;
out << eb;
@@ -4663,8 +4692,8 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
else
{
out << nl << v << " = new " << instanceType << "();";
- out << nl << "int __sz" << iterS << " = __is.readSize();";
- out << nl << "for(int __i" << iterS << " = 0; __i" << iterS << " < __sz" << iterS << "; __i" << iterS << "++)";
+ out << nl << "int sz" << iterS << " = " << stream << ".readSize();";
+ out << nl << "for(int i" << iterS << " = 0; i" << iterS << " < sz" << iterS << "; i" << iterS << "++)";
out << sb;
for(int i = 0; i < 2; i++)
{
@@ -4673,13 +4702,13 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
string typeS;
if(i == 0)
{
- arg = "__key";
+ arg = "key";
type = key;
typeS = keyS;
}
else
{
- arg = "__value";
+ arg = "value";
type = value;
typeS = valueS;
}
@@ -4689,10 +4718,10 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
string keyTypeStr = typeToObjectString(key, TypeModeIn, package);
string valueTypeStr = typeToObjectString(value, TypeModeIn, package);
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, StringList(),
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, customStream, StringList(),
"new com.zeroc.IceInternal.DictionaryPatcher<" + keyTypeStr + ", " +
valueTypeStr + ">(" + v + ", " + typeS + ".class, " + typeS +
- ".ice_staticId, __key)");
+ ".ice_staticId(), key)");
}
else
{
@@ -4704,13 +4733,13 @@ Slice::JavaGenerator::writeDictionaryMarshalUnmarshalCode(Output& out,
{
out << nl << typeS << ' ' << arg << ';';
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, arg, false, iter, customStream);
}
}
BuiltinPtr builtin = BuiltinPtr::dynamicCast(value);
if(!(builtin && builtin->usesClasses()) && !ClassDeclPtr::dynamicCast(value))
{
- out << nl << "" << v << ".put(__key, __value);";
+ out << nl << "" << v << ".put(key, value);";
}
out << eb;
}
@@ -4724,9 +4753,15 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
bool marshal,
int& iter,
bool useHelper,
+ const string& customStream,
const StringList& metaData)
{
- string stream = marshal ? "__os" : "__is";
+ string stream = customStream;
+ if(stream.empty())
+ {
+ stream = marshal ? "ostr" : "istr";
+ }
+
string v = param;
//
@@ -4769,9 +4804,9 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
out << nl << v << " = " << type << ".parseFrom(" << stream << ".readByteSeq());";
out << eb;
- out << nl << "catch(com.google.protobuf.InvalidProtocolBufferException __ex)";
+ out << nl << "catch(com.google.protobuf.InvalidProtocolBufferException ex)";
out << sb;
- out << nl << "throw new com.zeroc.Ice.MarshalException(__ex);";
+ out << nl << "throw new com.zeroc.Ice.MarshalException(ex);";
out << eb;
}
return;
@@ -4967,9 +5002,9 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
out << nl << stream << ".writeSize(" << v << ".size());";
string typeS = typeToString(type, TypeModeIn, package);
- out << nl << "for(" << typeS << " __elem : " << v << ')';
+ out << nl << "for(" << typeS << " elem : " << v << ')';
out << sb;
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", true, iter);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", true, iter, customStream);
out << eb;
out << eb; // else
}
@@ -4982,9 +5017,9 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
isObject = true;
}
out << nl << v << " = new " << instanceType << "();";
- out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize(" << type->minWireSize()
+ out << nl << "final int len" << iter << " = " << stream << ".readAndCheckSeqSize(" << type->minWireSize()
<< ");";
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int i" << iter << " = 0; i" << iter << " < len" << iter << "; i" << iter
<< "++)";
out << sb;
if(isObject)
@@ -4995,25 +5030,25 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << v << ".add(null);";
ostringstream patchParams;
patchParams << "new com.zeroc.IceInternal.ListPatcher<" << origContentS << ">(" << v << ", "
- << origContentS << ".class, " << origContentS << ".ice_staticId, __i" << iter << ')';
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter,
- StringList(), patchParams.str());
+ << origContentS << ".class, " << origContentS << ".ice_staticId(), i" << iter << ')';
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", false, iter,
+ customStream, StringList(), patchParams.str());
}
else
{
if(StructPtr::dynamicCast(type))
{
- out << nl << cont << " __elem = null;";
+ out << nl << cont << " elem = null;";
}
else
{
- out << nl << cont << " __elem;";
+ out << nl << cont << " elem;";
}
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "__elem", false, iter);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, "elem", false, iter, customStream);
}
if(!isObject)
{
- out << nl << v << ".add(__elem);";
+ out << nl << v << ".add(elem);";
}
out << eb;
iter++;
@@ -5145,13 +5180,13 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "else";
out << sb;
out << nl << stream << ".writeSize(" << v << ".length);";
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < " << v << ".length; __i" << iter
+ out << nl << "for(int i" << iter << " = 0; i" << iter << " < " << v << ".length; i" << iter
<< "++)";
out << sb;
ostringstream o;
- o << v << "[__i" << iter << "]";
+ o << v << "[i" << iter << "]";
iter++;
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), true, iter);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), true, iter, customStream);
out << eb;
out << eb;
}
@@ -5163,7 +5198,7 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
isObject = true;
}
- out << nl << "final int __len" << iter << " = " << stream << ".readAndCheckSeqSize("
+ out << nl << "final int len" << iter << " = " << stream << ".readAndCheckSeqSize("
<< type->minWireSize() << ");";
//
// We cannot allocate an array of a generic type, such as
@@ -5194,11 +5229,11 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
out << "[]";
}
- out << ")new " << nonGenericType << "[__len" << iter << "]";
+ out << ")new " << nonGenericType << "[len" << iter << "]";
}
else
{
- out << nl << v << " = new " << origContentS << "[__len" << iter << "]";
+ out << nl << v << " = new " << origContentS << "[len" << iter << "]";
}
int d = depth;
while(d--)
@@ -5206,23 +5241,23 @@ Slice::JavaGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << "[]";
}
out << ';';
- out << nl << "for(int __i" << iter << " = 0; __i" << iter << " < __len" << iter << "; __i" << iter
+ out << nl << "for(int i" << iter << " = 0; i" << iter << " < len" << iter << "; i" << iter
<< "++)";
out << sb;
ostringstream o;
- o << v << "[__i" << iter << "]";
+ o << v << "[i" << iter << "]";
if(isObject)
{
ostringstream patchParams;
patchParams << "new com.zeroc.IceInternal.SequencePatcher<" << origContentS << ">(" << v << ", "
- << origContentS << ".class, " << origContentS << ".ice_staticId, __i" << iter
+ << origContentS << ".class, " << origContentS << ".ice_staticId(), i" << iter
<< ')';
writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter,
- StringList(), patchParams.str());
+ customStream, StringList(), patchParams.str());
}
else
{
- writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter);
+ writeMarshalUnmarshalCode(out, package, type, OptionalNone, false, 0, o.str(), false, iter, customStream);
}
out << eb;
iter++;
diff --git a/cpp/src/Slice/JavaUtil.h b/cpp/src/Slice/JavaUtil.h
index d9375be077e..fcc77d30f63 100644
--- a/cpp/src/Slice/JavaUtil.h
+++ b/cpp/src/Slice/JavaUtil.h
@@ -168,21 +168,22 @@ protected:
};
void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode,
- bool, int, const std::string&, bool, int&, bool = false,
- const StringList& = StringList(), const std::string& patchParams = "");
+ bool, int, const std::string&, bool, int&, bool = false, const std::string& = "",
+ const StringList& = StringList(), const std::string& = "");
//
// Generate code to marshal or unmarshal a dictionary type.
//
void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&,
- const std::string&, bool, int&, bool,
- const StringList& = StringList());
+ const std::string&, bool, int&, bool,
+ const std::string& = "", const StringList& = StringList());
//
// Generate code to marshal or unmarshal a sequence type.
//
void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&,
- const std::string&, bool, int&, bool, const StringList& = StringList());
+ const std::string&, bool, int&, bool,
+ const std::string& = "", const StringList& = StringList());
//
// Search metadata for an entry with the given prefix and return the entire string.
@@ -334,21 +335,22 @@ protected:
};
void writeMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const TypePtr&, OptionalMode,
- bool, int, const std::string&, bool, int&, const StringList& = StringList(),
- const std::string& patchParams = "");
+ bool, int, const std::string&, bool, int&, const std::string& = "",
+ const StringList& = StringList(), const std::string& = "");
//
// Generate code to marshal or unmarshal a dictionary type.
//
void writeDictionaryMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const DictionaryPtr&,
const std::string&, bool, int&, bool,
- const StringList& = StringList());
+ const std::string& = "", const StringList& = StringList());
//
// Generate code to marshal or unmarshal a sequence type.
//
void writeSequenceMarshalUnmarshalCode(::IceUtilInternal::Output&, const std::string&, const SequencePtr&,
- const std::string&, bool, int&, bool, const StringList& = StringList());
+ const std::string&, bool, int&, bool,
+ const std::string& = "", const StringList& = StringList());
//
// Search metadata for an entry with the given prefix and return the entire string.
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;
}
diff --git a/cpp/src/slice2java/Gen.h b/cpp/src/slice2java/Gen.h
index 102a71633f9..5e6046bcd85 100644
--- a/cpp/src/slice2java/Gen.h
+++ b/cpp/src/slice2java/Gen.h
@@ -56,7 +56,7 @@ protected:
// Compose the parameter lists for an operation.
//
std::vector<std::string> getParams(const OperationPtr&, const std::string&);
- std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool);
+ std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool, bool = false);
//
// Compose the argument lists for an operation.
@@ -83,8 +83,8 @@ protected:
//
// Marshal/unmarshal a data member.
//
- void writeMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
- void writeUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
+ void writeMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&, bool = false);
+ void writeUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&, bool = false);
//
// Generate dispatch methods for a class or interface.
diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp
index 43205b19db6..d5894291f3e 100644
--- a/cpp/src/slice2java/GenCompat.cpp
+++ b/cpp/src/slice2java/GenCompat.cpp
@@ -75,6 +75,35 @@ opFormatTypeToString(const OperationPtr& op)
}
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;
+}
+
+string
+getEscapedParamName(const DataMemberList& params, const string& name)
+{
+ for(DataMemberList::const_iterator i = params.begin(); i != params.end(); ++i)
+ {
+ if((*i)->name() == name)
+ {
+ return name + "_";
+ }
+ }
+ return name;
+}
+
+
+string
getDeprecateReason(const ContainedPtr& p1, const ContainedPtr& p2, const string& type)
{
string deprecateMetadata, deprecateReason;
@@ -209,7 +238,7 @@ Slice::JavaCompatVisitor::getParams(const OperationPtr& op, const string& packag
}
vector<string>
-Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool final, bool optionalMapping)
+Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& package, bool final, bool optionalMapping, bool internal)
{
vector<string> params;
@@ -233,7 +262,7 @@ Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& p
{
typeString = "final " + typeString;
}
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ params.push_back(typeString + ' ' + (internal ? "iceP_" + (*q)->name() : fixKwd((*q)->name())));
}
return params;
@@ -241,7 +270,7 @@ Slice::JavaCompatVisitor::getParamsProxy(const OperationPtr& op, const string& p
vector<string>
Slice::JavaCompatVisitor::getInOutParams(const OperationPtr& op, const string& package, ParamDir paramType, bool /*proxy*/,
- bool optionalMapping)
+ bool optionalMapping, bool internal)
{
vector<string> params;
@@ -253,7 +282,7 @@ Slice::JavaCompatVisitor::getInOutParams(const OperationPtr& op, const string& p
bool optional = optionalMapping && (*q)->optional();
string typeString = typeToString((*q)->type(), paramType == InParam ? TypeModeIn : TypeModeOut, package,
(*q)->getMetaData(), true, optional);
- params.push_back(typeString + ' ' + fixKwd((*q)->name()));
+ params.push_back(typeString + ' ' + (internal ? "iceP_" + (*q)->name() : fixKwd((*q)->name())));
}
}
@@ -269,7 +298,7 @@ Slice::JavaCompatVisitor::getParamsAsync(const OperationPtr& op, const string& p
ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string classNameAsync = getAbsolute(cl, package, amd ? "AMD_" : "AMI_", '_' + name);
- params.insert(params.begin(), classNameAsync + " __cb");
+ params.insert(params.begin(), classNameAsync + " " + getEscapedParamName(op, "cb"));
return params;
}
@@ -284,7 +313,7 @@ Slice::JavaCompatVisitor::getParamsAsyncCB(const OperationPtr& op, const string&
{
string retS = typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
optionalMapping && op->returnIsOptional());
- params.push_back(retS + " __ret");
+ params.push_back(retS + " ret");
}
ParamDeclList paramList = op->parameters();
@@ -497,32 +526,45 @@ Slice::JavaCompatVisitor::getLambdaResponseCB(const OperationPtr& op, const stri
vector<string>
Slice::JavaCompatVisitor::getParamsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB,
- bool optionalMapping, bool inParams)
+ bool optionalMapping, bool inParams, bool internal)
{
vector<string> params;
+ string contextParamName = "context";
+ string responseCbParamName = "responseCb";
+ string userExceptionCbParamName = "userExceptionCb";
+ string exceptionCbParamName = "exceptionCb";
+ string sentCbParamName = "sentCb";
if(inParams)
{
- params = getInOutParams(op, package, InParam, false, optionalMapping);
+ params = getInOutParams(op, package, InParam, false, optionalMapping, internal);
+ if(!internal)
+ {
+ contextParamName = getEscapedParamName(op, contextParamName);
+ responseCbParamName = getEscapedParamName(op, responseCbParamName);
+ userExceptionCbParamName = getEscapedParamName(op, userExceptionCbParamName);
+ exceptionCbParamName = getEscapedParamName(op, exceptionCbParamName);
+ sentCbParamName = getEscapedParamName(op, sentCbParamName);
+ }
}
if(context)
{
- params.push_back("java.util.Map<String, String> __ctx");
+ params.push_back("java.util.Map<String, String> " + contextParamName);
}
- params.push_back(getLambdaResponseCB(op, package) + " __responseCb");
+ params.push_back(getLambdaResponseCB(op, package) + " " + responseCbParamName);
if(!op->throws().empty())
{
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> __userExceptionCb");
+ params.push_back("IceInternal.Functional_GenericCallback1<Ice.UserException> " + userExceptionCbParamName);
}
- params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> __exceptionCb");
+ params.push_back("IceInternal.Functional_GenericCallback1<Ice.Exception> " + exceptionCbParamName);
if(sentCB)
{
- params.push_back("IceInternal.Functional_BoolCallback __sentCb");
+ params.push_back("IceInternal.Functional_BoolCallback " + sentCbParamName);
}
return params;
@@ -532,16 +574,25 @@ vector<string>
Slice::JavaCompatVisitor::getArgsAsyncLambda(const OperationPtr& op, const string& package, bool context, bool sentCB)
{
vector<string> args = getInOutArgs(op, InParam);
- args.push_back(context ? "__ctx" : "null");
+
+ // "internal" is always false for this function
+
+ const string contextParamName = getEscapedParamName(op, "context");
+ const string responseCbParamName = getEscapedParamName(op, "responseCb");
+ const string userExceptionCbParamName = getEscapedParamName(op, "userExceptionCb");
+ const string exceptionCbParamName = getEscapedParamName(op, "exceptionCb");
+ const string sentCbParamName = getEscapedParamName(op, "sentCb");
+
+ args.push_back(context ? contextParamName : "null");
args.push_back(context ? "true" : "false");
- args.push_back("false"); // __synchronous
- args.push_back("__responseCb");
+ args.push_back("false"); // synchronous param
+ args.push_back(responseCbParamName);
if(!op->throws().empty())
{
- args.push_back("__userExceptionCb");
+ args.push_back(userExceptionCbParamName);
}
- args.push_back("__exceptionCb");
- args.push_back(sentCB ? "__sentCb" : "null");
+ args.push_back(exceptionCbParamName);
+ args.push_back(sentCB ? sentCbParamName : "null");
return args;
}
@@ -560,7 +611,7 @@ Slice::JavaCompatVisitor::getArgs(const OperationPtr& op)
}
vector<string>
-Slice::JavaCompatVisitor::getInOutArgs(const OperationPtr& op, ParamDir paramType)
+Slice::JavaCompatVisitor::getInOutArgs(const OperationPtr& op, ParamDir paramType, bool internal)
{
vector<string> args;
@@ -569,7 +620,7 @@ Slice::JavaCompatVisitor::getInOutArgs(const OperationPtr& op, ParamDir paramTyp
{
if((*q)->isOutParam() == (paramType == OutParam))
{
- args.push_back(fixKwd((*q)->name()));
+ args.push_back(internal ? "iceP_" + (*q)->name() : fixKwd((*q)->name()));
}
}
@@ -580,7 +631,7 @@ vector<string>
Slice::JavaCompatVisitor::getArgsAsync(const OperationPtr& op)
{
vector<string> args = getInOutArgs(op, InParam);
- args.insert(args.begin(), "__cb");
+ args.insert(args.begin(), getEscapedParamName(op, "cb"));
return args;
}
@@ -595,11 +646,11 @@ Slice::JavaCompatVisitor::getArgsAsyncCB(const OperationPtr& op)
BuiltinPtr builtin = BuiltinPtr::dynamicCast(ret);
if((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret))
{
- args.push_back("__ret.value");
+ args.push_back("ret.value");
}
else
{
- args.push_back("__ret");
+ args.push_back("ret");
}
}
@@ -625,9 +676,15 @@ Slice::JavaCompatVisitor::getArgsAsyncCB(const OperationPtr& op)
void
Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string& package, const ParamDeclList& params,
- const OperationPtr& op, int& iter, bool marshal, bool optionalMapping,
- bool dispatch)
+ const OperationPtr& op, int& iter, bool marshal, bool optionalMapping,
+ bool internal, const string& customRetName, bool dispatch)
{
+ string stream = "";
+ if(!internal)
+ {
+ stream = marshal ? "ostr_" : "istr_";
+ }
+
ParamDeclList optionals;
for(ParamDeclList::const_iterator pli = params.begin(); pli != params.end(); ++pli)
{
@@ -637,7 +694,7 @@ Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string&
}
else
{
- string paramName = fixKwd((*pli)->name());
+ string paramName = internal ? "iceP_" + (*pli)->name() : fixKwd((*pli)->name());
bool holder = marshal == dispatch;
string patchParams;
if(!marshal)
@@ -645,10 +702,16 @@ Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string&
patchParams = paramName;
}
writeMarshalUnmarshalCode(out, package, (*pli)->type(), OptionalNone, false, 0, paramName, marshal,
- iter, holder, (*pli)->getMetaData(), patchParams);
+ iter, holder, stream, (*pli)->getMetaData(), patchParams);
}
}
+ string retName = customRetName;
+ if(retName.empty())
+ {
+ retName = internal ? "ret" : "ret_";
+ }
+
TypePtr ret;
bool returnsObject = false;
@@ -667,27 +730,27 @@ Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string&
{
if(optional)
{
- out << nl << retS << " __ret = new " << retS << "();";
+ out << nl << retS << " " << retName << " = new " << retS << "();";
}
else if(returnsObject)
{
- out << nl << retS << "Holder __ret = new " << retS << "Holder();";
+ out << nl << retS << "Holder " << retName << " = new " << retS << "Holder();";
holder = true;
}
else if(StructPtr::dynamicCast(ret))
{
- out << nl << retS << " __ret = null;";
+ out << nl << retS << " " << retName << " = null;";
}
else
{
- out << nl << retS << " __ret;";
+ out << nl << retS << " " << retName << ";";
}
}
if(!op->returnIsOptional())
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, "__ret", marshal, iter, holder,
- op->getMetaData());
+ writeMarshalUnmarshalCode(out, package, ret, OptionalNone, false, 0, retName, marshal, iter, holder,
+ stream, op->getMetaData());
}
}
@@ -714,7 +777,7 @@ Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string&
if(checkReturnType && op->returnTag() < (*pli)->tag())
{
writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(),
- "__ret", marshal, iter, false, op->getMetaData());
+ retName, marshal, iter, false, stream, op->getMetaData());
checkReturnType = false;
}
@@ -722,13 +785,14 @@ Slice::JavaCompatVisitor::writeMarshalUnmarshalParams(Output& out, const string&
writeMarshalUnmarshalCode(out, package, (*pli)->type(),
(*pli)->isOutParam() ? OptionalOutParam : OptionalInParam, optionalMapping,
- (*pli)->tag(), fixKwd((*pli)->name()), marshal, iter, holder, (*pli)->getMetaData());
+ (*pli)->tag(), internal ? "iceP_" + (*pli)->name() : fixKwd((*pli)->name()),
+ marshal, iter, holder, stream, (*pli)->getMetaData());
}
if(checkReturnType)
{
- writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(), "__ret",
- marshal, iter, false, op->getMetaData());
+ writeMarshalUnmarshalCode(out, package, ret, OptionalReturnParam, optionalMapping, op->returnTag(), retName,
+ marshal, iter, false, stream, op->getMetaData());
}
}
@@ -757,27 +821,35 @@ Slice::JavaCompatVisitor::writeThrowsClause(const string& package, const Excepti
}
void
-Slice::JavaCompatVisitor::writeMarshalDataMember(Output& out, const string& package, const DataMemberPtr& member, int& iter)
+Slice::JavaCompatVisitor::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, false, member->getMetaData());
+ 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, false, stream, member->getMetaData());
}
else
{
- 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, false, member->getMetaData());
+ iter, false, "ostr_", member->getMetaData());
out << eb;
}
}
void
Slice::JavaCompatVisitor::writeUnmarshalDataMember(Output& out, const string& package, const DataMemberPtr& member,
- int& iter, bool needPatcher, int& patchIter)
+ int& iter, bool needPatcher, int& patchIter, bool forStruct)
{
string patchParams;
if(needPatcher)
@@ -793,23 +865,31 @@ Slice::JavaCompatVisitor::writeUnmarshalDataMember(Output& out, const string& pa
if(!member->optional())
{
- writeMarshalUnmarshalCode(out, package, member->type(), OptionalNone, false, 0, fixKwd(member->name()), false,
- iter, false, 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, false, stream, member->getMetaData(), patchParams);
}
else
{
- 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, false, member->getMetaData(), patchParams);
+ iter, false, "istr_", member->getMetaData(), patchParams);
out << eb;
}
}
void
Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const DataMemberList& classMembers,
- const DataMemberList& optionalMembers)
+ const DataMemberList& optionalMembers)
{
out << sp << nl << "private class Patcher implements Ice.ReadValueCallback";
out << sb;
@@ -817,7 +897,7 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
{
out << sp << nl << "Patcher(int member)";
out << sb;
- out << nl << "__member = member;";
+ out << nl << "_member = member;";
out << eb;
}
@@ -825,7 +905,7 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out << sb;
if(classMembers.size() > 1)
{
- out << nl << "switch(__member)";
+ out << nl << "switch(_member)";
out << sb;
}
int memberCount = 0;
@@ -849,11 +929,11 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out.inc();
if(b)
{
- out << nl << "__typeId = Ice.ObjectImpl.ice_staticId();";
+ out << nl << "_typeId = Ice.ObjectImpl.ice_staticId();";
}
else
{
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\";";
}
}
@@ -903,11 +983,11 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out.inc();
if(b)
{
- out << nl << "__typeId = Ice.ObjectImpl.ice_staticId();";
+ out << nl << "_typeId = Ice.ObjectImpl.ice_staticId();";
}
else
{
- out << nl << "__typeId = \"" << (*d)->type()->typeId() << "\";";
+ out << nl << "_typeId = \"" << (*d)->type()->typeId() << "\";";
}
}
@@ -950,7 +1030,7 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
out << sb;
if(classMembers.size() > 1)
{
- out << nl << "return __typeId;";
+ out << nl << "return _typeId;";
}
else
{
@@ -960,8 +1040,8 @@ Slice::JavaCompatVisitor::writePatcher(Output& out, const string& package, const
if(classMembers.size() > 1)
{
- out << sp << nl << "private int __member;";
- out << nl << "private String __typeId;";
+ out << sp << nl << "private int _member;";
+ out << nl << "private String _typeId;";
}
out << eb;
@@ -994,7 +1074,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
assert(scopedIter != ids.end());
StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter);
- out << sp << nl << "public static final String[] __ids =";
+ out << sp << nl << "private static final String[] _ids =";
out << sb;
for(StringList::const_iterator q = ids.begin(); q != ids.end();)
@@ -1009,37 +1089,37 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << sp << nl << "public boolean ice_isA(String s)";
out << sb;
- out << nl << "return java.util.Arrays.binarySearch(__ids, s) >= 0;";
+ out << nl << "return java.util.Arrays.binarySearch(_ids, s) >= 0;";
out << eb;
- out << sp << nl << "public boolean ice_isA(String s, Ice.Current __current)";
+ out << sp << nl << "public boolean ice_isA(String s, Ice.Current current)";
out << sb;
- out << nl << "return java.util.Arrays.binarySearch(__ids, s) >= 0;";
+ out << nl << "return java.util.Arrays.binarySearch(_ids, s) >= 0;";
out << eb;
out << sp << nl << "public String[] ice_ids()";
out << sb;
- out << nl << "return __ids;";
+ out << nl << "return _ids;";
out << eb;
- out << sp << nl << "public String[] ice_ids(Ice.Current __current)";
+ out << sp << nl << "public String[] ice_ids(Ice.Current current)";
out << sb;
- out << nl << "return __ids;";
+ out << nl << "return _ids;";
out << eb;
out << sp << nl << "public String ice_id()";
out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
+ out << nl << "return _ids[" << scopedPos << "];";
out << eb;
- out << sp << nl << "public String ice_id(Ice.Current __current)";
+ out << sp << nl << "public String ice_id(Ice.Current current)";
out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
+ out << nl << "return _ids[" << scopedPos << "];";
out << eb;
out << sp << nl << "public static String ice_staticId()";
out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
+ out << nl << "return _ids[" << scopedPos << "];";
out << eb;
OperationList ops = p->allOperations();
@@ -1185,8 +1265,8 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
{
out << nl << "/** @deprecated **/";
}
- out << nl << "public static boolean ___" << opName << '(' << name
- << " __obj, IceInternal.Incoming __inS, Ice.Current __current)";
+ out << nl << "public static boolean _iceD_" << opName << '(' << name
+ << " obj, IceInternal.Incoming inS, Ice.Current current)";
out.inc();
out << nl << "throws Ice.UserException";
out.dec();
@@ -1217,18 +1297,18 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
int iter;
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+ out << nl << "_iceCheckMode(" << sliceModeToIceMode(op->mode()) << ", current.mode);";
if(!inParams.empty())
{
//
// Unmarshal 'in' parameters.
//
- out << nl << "Ice.InputStream __is = __inS.startReadParams();";
+ out << nl << "Ice.InputStream istr = inS.startReadParams();";
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
+ string paramName = "iceP_" + (*pli)->name();
string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(),
true, (*pli)->optional());
if((*pli)->optional())
@@ -1253,20 +1333,20 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
}
}
iter = 0;
- writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true);
+ writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true, "", true);
if(op->sendsClasses(false))
{
- out << nl << "__is.readPendingValues();";
+ out << nl << "istr.readPendingValues();";
}
- out << nl << "__inS.endReadParams();";
+ out << nl << "inS.endReadParams();";
}
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) << ");";
}
//
@@ -1276,7 +1356,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
{
string typeS = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true,
optionalMapping && (*pli)->optional());
- out << nl << typeS << ' ' << fixKwd((*pli)->name()) << " = new " << typeS << "();";
+ out << nl << typeS << " iceP_" << (*pli)->name() << " = new " << typeS << "();";
}
//
@@ -1287,13 +1367,13 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
{
string retS = typeToString(ret, TypeModeReturn, package, opMetaData, true,
optionalMapping && op->returnIsOptional());
- out << retS << " __ret = ";
+ out << retS << " ret = ";
}
- out << "__obj." << fixKwd(opName) << '(';
+ out << "obj." << fixKwd(opName) << '(';
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
+ out << "iceP_" << (*pli)->name();
if(!(*pli)->optional())
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
@@ -1306,26 +1386,26 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
}
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
- out << fixKwd((*pli)->name()) << ", ";
+ out << "iceP_" << (*pli)->name() << ", ";
}
- out << "__current);";
+ out << "current);";
//
// Marshal 'out' parameters and return value.
//
if(!outParams.empty() || ret)
{
- out << nl << "Ice.OutputStream __os = __inS.startWriteParams();";
- writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, optionalMapping, true);
+ out << nl << "Ice.OutputStream ostr = inS.startWriteParams();";
+ writeMarshalUnmarshalParams(out, package, outParams, op, iter, true, optionalMapping, true, "", true);
if(op->returnsClasses(false))
{
- out << nl << "__os.writePendingValues();";
+ out << nl << "ostr.writePendingValues();";
}
- out << nl << "__inS.endWriteParams();";
+ out << nl << "inS.endWriteParams();";
}
else
{
- out << nl << "__inS.writeEmptyParams();";
+ out << nl << "inS.writeEmptyParams();";
}
out << nl << "return false;";
@@ -1345,19 +1425,19 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
int iter;
- out << nl << "__checkMode(" << sliceModeToIceMode(op->mode()) << ", __current.mode);";
+ out << nl << "_iceCheckMode(" << sliceModeToIceMode(op->mode()) << ", current.mode);";
if(!inParams.empty())
{
//
// Unmarshal 'in' parameters.
//
- out << nl << "Ice.InputStream __is = __inS.startReadParams();";
+ out << nl << "Ice.InputStream istr = inS.startReadParams();";
iter = 0;
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
TypePtr paramType = (*pli)->type();
- string paramName = fixKwd((*pli)->name());
+ string paramName = "iceP_" + (*pli)->name();
string typeS = typeToString(paramType, TypeModeIn, package, (*pli)->getMetaData(),
true, (*pli)->optional());
if((*pli)->optional())
@@ -1381,33 +1461,33 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
}
}
}
- writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true);
+ writeMarshalUnmarshalParams(out, package, inParams, 0, iter, false, true, true, "", true);
if(op->sendsClasses(false))
{
- out << nl << "__is.readPendingValues();";
+ out << nl << "istr.readPendingValues();";
}
- out << nl << "__inS.endReadParams();";
+ out << nl << "inS.endReadParams();";
}
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) << ");";
}
//
// Call on the servant.
//
string classNameAMD = "AMD_" + p->name();
- out << nl << classNameAMD << '_' << opName << " __cb = new _" << classNameAMD << '_' << opName
- << "(__inS);";
- out << nl << "__obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(__cb, " : "(");
+ out << nl << classNameAMD << '_' << opName << " cb = new _" << classNameAMD << '_' << opName
+ << "(inS);";
+ out << nl << "obj." << (amd ? opName + "_async" : fixKwd(opName)) << (amd ? "(cb, " : "(");
for(ParamDeclList::const_iterator pli = inParams.begin(); pli != inParams.end(); ++pli)
{
TypePtr paramType = (*pli)->type();
- out << fixKwd((*pli)->name());
+ out << "iceP_" << (*pli)->name();
if(!(*pli)->optional())
{
BuiltinPtr builtin = BuiltinPtr::dynamicCast(paramType);
@@ -1418,7 +1498,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
}
out << ", ";
}
- out << "__current);";
+ out << "current);";
out << nl << "return true;";
out << eb;
@@ -1437,7 +1517,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
allOpNames.sort();
allOpNames.unique();
- out << sp << nl << "private final static String[] __all =";
+ out << sp << nl << "private final static String[] _all =";
out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -1466,15 +1546,15 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
break;
}
}
- out << nl << "public boolean __dispatch(IceInternal.Incoming in, Ice.Current __current)";
+ out << nl << "public boolean _iceDispatch(IceInternal.Incoming in, Ice.Current current)";
out.inc();
out << nl << "throws Ice.UserException";
out.dec();
out << sb;
- out << nl << "int pos = java.util.Arrays.binarySearch(__all, __current.operation);";
+ out << nl << "int pos = java.util.Arrays.binarySearch(_all, current.operation);";
out << nl << "if(pos < 0)";
out << sb;
- out << nl << "throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
out << eb;
out << sp << nl << "switch(pos)";
out << sb;
@@ -1487,19 +1567,19 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << sb;
if(opName == "ice_id")
{
- out << nl << "return ___ice_id(this, in, __current);";
+ out << nl << "return _iceD_ice_id(this, in, current);";
}
else if(opName == "ice_ids")
{
- out << nl << "return ___ice_ids(this, in, __current);";
+ out << nl << "return _iceD_ice_ids(this, in, current);";
}
else if(opName == "ice_isA")
{
- out << nl << "return ___ice_isA(this, in, __current);";
+ out << nl << "return _iceD_ice_isA(this, in, current);";
}
else if(opName == "ice_ping")
{
- out << nl << "return ___ice_ping(this, in, __current);";
+ out << nl << "return _iceD_ice_ping(this, in, current);";
}
else
{
@@ -1515,7 +1595,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
assert(cl);
if(cl->scoped() == p->scoped())
{
- out << nl << "return ___" << opName << "(this, in, __current);";
+ out << nl << "return _iceD_" << opName << "(this, in, current);";
}
else
{
@@ -1528,7 +1608,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
{
base = getAbsolute(cl, package);
}
- out << nl << "return " << base << ".___" << opName << "(this, in, __current);";
+ out << nl << "return " << base << "._iceD_" << opName << "(this, in, current);";
}
break;
}
@@ -1538,7 +1618,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
}
out << eb;
out << sp << nl << "assert(false);";
- out << nl << "throw new Ice.OperationNotExistException(__current.id, __current.facet, __current.operation);";
+ out << nl << "throw new Ice.OperationNotExistException(current.id, current.facet, current.operation);";
out << eb;
//
@@ -1557,7 +1637,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
if(!attributesMap.empty())
{
- out << sp << nl << "private final static int[] __operationAttributes =";
+ out << sp << nl << "private final static int[] _operationAttributes =";
out << sb;
for(StringList::const_iterator q = allOpNames.begin(); q != allOpNames.end();)
{
@@ -1579,12 +1659,12 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
out << sp << nl << "public int ice_operationAttributes(String operation)";
out << sb;
- out << nl << "int pos = java.util.Arrays.binarySearch(__all, operation);";
+ out << nl << "int pos = java.util.Arrays.binarySearch(_all, operation);";
out << nl << "if(pos < 0)";
out << sb;
out << nl << "return -1;";
out << eb;
- out << sp << nl << "return __operationAttributes[pos];";
+ out << sp << nl << "return _operationAttributes[pos];";
out << eb;
}
}
@@ -1597,24 +1677,24 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
if(preserved && !basePreserved)
{
- out << sp << nl << "public void __write(Ice.OutputStream __os)";
+ out << sp << nl << "public void _iceWrite(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 << nl << "public void __read(Ice.InputStream __is)";
+ out << sp << nl << "public void _iceRead(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 << nl << "protected void __writeImpl(Ice.OutputStream __os)";
+ out << sp << nl << "protected void _iceWriteImpl(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)
{
@@ -1627,10 +1707,10 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
{
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;
@@ -1642,9 +1722,9 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
writePatcher(out, package, classMembers, optionalMembers);
}
- out << sp << nl << "protected void __readImpl(Ice.InputStream __is)";
+ out << sp << nl << "protected void _iceReadImpl(Ice.InputStream istr_)";
out << sb;
- out << nl << "__is.startSlice();";
+ out << nl << "istr_.startSlice();";
int patchIter = 0;
const bool needCustomPatcher = classMembers.size() > 1;
@@ -1660,16 +1740,16 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe
{
writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
}
- 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 Ice.SlicedData __slicedData;";
+ out << sp << nl << "protected Ice.SlicedData _iceSlicedData;";
}
}
@@ -1970,7 +2050,7 @@ Slice::JavaCompatVisitor::writeDocCommentAsync(Output& out, const OperationPtr&
if(i->find(returnTag) != string::npos)
{
foundReturn = true;
- out << nl << " * @param __ret (return value)" << i->substr(returnTag.length());
+ out << nl << " * @param ret (return value)" << i->substr(returnTag.length());
}
}
else
@@ -2099,7 +2179,7 @@ Slice::JavaCompatVisitor::writeDocCommentAMI(Output& out, const OperationPtr& p,
}
else
{
- out << nl << " * @param __result The asynchronous result object.";
+ out << nl << " * @param result The asynchronous result object.";
//
// Print @return, @throws, and @see tags.
//
@@ -2153,7 +2233,7 @@ Slice::JavaCompatVisitor::writeDocCommentParam(Output& out, const OperationPtr&
//
if(cb && paramType == InParam)
{
- out << nl << " * @param __cb The callback object for the operation.";
+ out << nl << " * @param cb The callback object for the operation.";
}
//
@@ -2419,9 +2499,11 @@ Slice::GenCompat::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurre
string deprecateReason = getDeprecateReason(*r, p, "operation");
string extraCurrent;
+ string currentParamName = getEscapedParamName(op, "current");
+
if(!noCurrent && !p->isLocal())
{
- extraCurrent = "@param __current The Current object for the invocation.";
+ extraCurrent = "@param " + currentParamName + " The Current object for the invocation.";
}
if(amd)
{
@@ -2434,7 +2516,7 @@ Slice::GenCompat::OpsVisitor::writeOperations(const ClassDefPtr& p, bool noCurre
out << nl << retS << ' ' << (amd ? opname + "_async" : fixKwd(opname)) << spar << params;
if(!noCurrent && !p->isLocal())
{
- out << "Ice.Current __current";
+ out << "Ice.Current " + currentParamName;
}
out << epar;
if(op->hasMetaData("UserException"))
@@ -2691,7 +2773,8 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "public abstract ";
}
- out << "Ice.AsyncResult begin_" << opname << spar << inParams << "Ice.Callback __cb" << epar << ';';
+ out << "Ice.AsyncResult begin_" << opname << spar << inParams << "Ice.Callback " + getEscapedParamName(op, "cb")
+ << epar << ';';
out << sp;
writeDocCommentAMI(out, op, InParam);
@@ -2700,10 +2783,9 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
{
out << "public abstract ";
}
- string cb = "Callback_" + name + "_" + opname + " __cb";
+ string cb = "Callback_" + name + "_" + opname + " " + getEscapedParamName(op, "cb");
out << "Ice.AsyncResult begin_" << opname << spar << inParams << cb << epar << ';';
-
out << sp;
writeDocCommentAMI(out, op, InParam);
out << nl;
@@ -2724,7 +2806,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << "public abstract ";
}
- out << retS << " end_" << opname << spar << outParams << "Ice.AsyncResult __result" << epar << ';';
+ out << retS << " end_" << opname << spar << outParams << "Ice.AsyncResult result" << epar << ';';
}
}
}
@@ -2873,7 +2955,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!p->isInterface() && p->allOperations().size() == 0 && !p->isLocal())
{
out << sp;
- out << nl << "private static class __F implements Ice.ValueFactory";
+ out << nl << "private static class _F implements Ice.ValueFactory";
out << sb;
out << nl << "public Ice.Object create(String type)";
out << sb;
@@ -2881,7 +2963,7 @@ Slice::GenCompat::TypesVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "return new " << fixKwd(name) << "();";
out << eb;
out << eb;
- out << nl << "private static Ice.ValueFactory _factory = new __F();";
+ out << nl << "private static Ice.ValueFactory _factory = new _F();";
out << sp;
out << nl << "public static Ice.ValueFactory" << nl << "ice_factory()";
out << sb;
@@ -3036,9 +3118,9 @@ Slice::GenCompat::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;
@@ -3132,7 +3214,8 @@ Slice::GenCompat::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
//
if(allDataMembers.size() < 254)
{
- paramDecl.push_back("Throwable __cause");
+ const string causeParamName = getEscapedParamName(allDataMembers, "cause");
+ paramDecl.push_back("Throwable " + causeParamName);
out << sp << nl << "public " << name << spar;
out << paramDecl << epar;
out << sb;
@@ -3147,12 +3230,12 @@ Slice::GenCompat::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
baseParamNames.push_back(fixKwd((*d)->name()));
}
}
- baseParamNames.push_back("__cause");
+ baseParamNames.push_back(causeParamName);
out << baseParamNames << epar << ';';
}
else
{
- out << nl << "super(__cause);";
+ out << nl << "super(" << causeParamName << ");";
}
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
@@ -3210,13 +3293,14 @@ Slice::GenCompat::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
//
if(allDataMembers.size() < 254)
{
- paramDecl.push_back("Throwable __cause");
+ const string causeParamName = getEscapedParamName(allDataMembers, "cause");
+ paramDecl.push_back("Throwable " + causeParamName);
out << sp << nl << "public " << name << spar;
out << paramDecl << epar;
out << sb;
if(!base)
{
- out << nl << "super(__cause);";
+ out << nl << "super(" << causeParamName << ");";
}
else
{
@@ -3227,7 +3311,7 @@ Slice::GenCompat::TypesVisitor::visitExceptionStart(const ExceptionPtr& p)
{
baseParamNames.push_back(fixKwd((*d)->name()));
}
- baseParamNames.push_back("__cause");
+ baseParamNames.push_back(causeParamName);
out << baseParamNames << epar << ';';
}
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
@@ -3278,24 +3362,24 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sp << nl << "public void" << nl << "_write(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 << nl << "public void" << nl << "__read(Ice.InputStream __is)";
+ out << sp << nl << "public void" << nl << "_read(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 << nl << "protected void" << nl << "__writeImpl(Ice.OutputStream __os)";
+ out << sp << nl << "protected void" << nl << "_writeImpl(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)
{
@@ -3308,10 +3392,10 @@ Slice::GenCompat::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;
@@ -3322,9 +3406,9 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
writePatcher(out, package, classMembers, optionalMembers);
}
- out << sp << nl << "protected void" << nl << "__readImpl(Ice.InputStream __is)";
+ out << sp << nl << "protected void" << nl << "_readImpl(Ice.InputStream istr_)";
out << sb;
- out << nl << "__is.startSlice();";
+ out << nl << "istr_.startSlice();";
iter = 0;
int patchIter = 0;
const bool needCustomPatcher = classMembers.size() > 1;
@@ -3339,10 +3423,10 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
}
- out << nl << "__is.endSlice();";
+ out << nl << "istr_.endSlice();";
if(base)
{
- out << nl << "super.__readImpl(__is);";
+ out << nl << "super._readImpl(istr_);";
}
out << eb;
@@ -3350,7 +3434,7 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
{
if(!base || (base && !base->usesClasses(false)))
{
- out << sp << nl << "public boolean" << nl << "__usesClasses()";
+ out << sp << nl << "public boolean" << nl << "_usesClasses()";
out << sb;
out << nl << "return true;";
out << eb;
@@ -3359,7 +3443,7 @@ Slice::GenCompat::TypesVisitor::visitExceptionEnd(const ExceptionPtr& p)
if(preserved && !basePreserved)
{
- out << sp << nl << "protected Ice.SlicedData __slicedData;";
+ out << sp << nl << "protected Ice.SlicedData _slicedData;";
}
}
@@ -3475,12 +3559,12 @@ Slice::GenCompat::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)
{
@@ -3498,7 +3582,7 @@ Slice::GenCompat::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;
@@ -3511,10 +3595,10 @@ Slice::GenCompat::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;
@@ -3538,10 +3622,10 @@ Slice::GenCompat::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;
@@ -3552,7 +3636,7 @@ Slice::GenCompat::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;
@@ -3560,10 +3644,10 @@ Slice::GenCompat::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;
@@ -3578,15 +3662,15 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
out << sp << nl << "public int" << nl << "hashCode()";
out << sb;
- out << nl << "int __h = 5381;";
- out << nl << "__h = IceInternal.HashUtil.hashAdd(__h, \"" << p->scoped() << "\");";
+ out << nl << "int h_ = 5381;";
+ out << nl << "h_ = 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 = IceInternal.HashUtil.hashAdd(__h, " << memberName << ");";
+ out << nl << "h_ = IceInternal.HashUtil.hashAdd(h_, " << memberName << ");";
}
- out << nl << "return __h;";
+ out << nl << "return h_;";
out << eb;
out << sp << nl << "public " << name << nl << "clone()";
@@ -3605,12 +3689,12 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
if(!p->isLocal())
{
- out << sp << nl << "public void" << nl << "__write(Ice.OutputStream __os)";
+ out << sp << nl << "public void" << nl << "write(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;
@@ -3621,40 +3705,40 @@ Slice::GenCompat::TypesVisitor::visitStructEnd(const StructPtr& p)
writePatcher(out, package, classMembers, DataMemberList());
}
- out << sp << nl << "public void" << nl << "__read(Ice.InputStream __is)";
+ out << sp << nl << "public void" << nl << "read(Ice.InputStream istr)";
out << sb;
iter = 0;
int patchIter = 0;
const bool needCustomPatcher = classMembers.size() > 1;
for(DataMemberList::const_iterator d = members.begin(); d != members.end(); ++d)
{
- writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter);
+ writeUnmarshalDataMember(out, package, *d, iter, needCustomPatcher, patchIter, true);
}
out << eb;
- out << sp << nl << "static public void" << nl << "write(Ice.OutputStream __os, " << name << " __v)";
+ out << sp << nl << "static public void" << nl << "write(Ice.OutputStream ostr, " << name << " v)";
out << sb;
- out << nl << "if(__v == null)";
+ out << nl << "if(v == null)";
out << sb;
- out << nl << "__nullMarshalValue.__write(__os);";
+ out << nl << "_nullMarshalValue.write(ostr);";
out << eb;
out << nl << "else";
out << sb;
- out << nl << "__v.__write(__os);";
+ out << nl << "v.write(ostr);";
out << eb;
out << eb;
- out << sp << nl << "static public " << name << nl << "read(Ice.InputStream __is, " << name << " __v)";
+ out << sp << nl << "static public " << name << nl << "read(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.__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 = ";
@@ -3735,7 +3819,7 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
if(optional)
{
- out << nl << "private boolean __has_" << p->name() << ';';
+ out << nl << "private boolean _" << p->name() << ';';
}
//
@@ -3781,7 +3865,7 @@ Slice::GenCompat::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.lang.IllegalStateException(\"" << name << " is not set\");";
out << eb;
@@ -3795,13 +3879,13 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << sp;
writeDocComment(out, p, deprecateReason);
out << nl << "public void"
- << nl << "set" << capName << '(' << s << " _" << name << ')';
+ << nl << "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;
//
@@ -3814,7 +3898,7 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << "public boolean"
<< nl << "has" << capName << "()";
out << sb;
- out << nl << "return __has_" << p->name() << ';';
+ out << nl << "return _" << p->name() << ';';
out << eb;
out << sp;
@@ -3822,7 +3906,7 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << "public void"
<< nl << "clear" << capName << "()";
out << sb;
- out << nl << "__has_" << p->name() << " = false;";
+ out << nl << "_" << p->name() << " = false;";
out << eb;
const string optType = typeToString(type, TypeModeMember, getPackage(contained), metaData, true, true);
@@ -3830,16 +3914,16 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << sp;
writeDocComment(out, p, deprecateReason);
out << nl << "public void"
- << nl << "optional" << capName << '(' << optType << " __v)";
+ << nl << "optional" << capName << '(' << optType << " v)";
out << sb;
- out << nl << "if(__v == null || !__v.isSet())";
+ out << nl << "if(v == null || !v.isSet())";
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 << name << " = __v.get();";
+ out << nl << "_" << p->name() << " = true;";
+ out << nl << name << " = v.get();";
out << eb;
out << eb;
@@ -3848,7 +3932,7 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << "public " << optType
<< nl << "optional" << capName << "()";
out << sb;
- out << nl << "if(__has_" << p->name() << ')';
+ out << nl << "if(_" << p->name() << ')';
out << sb;
out << nl << "return new " << optType << '(' << name << ");";
out << eb;
@@ -3881,7 +3965,7 @@ Slice::GenCompat::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.lang.IllegalStateException(\"" << name << " is not set\");";
out << eb;
@@ -3918,16 +4002,16 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << " **/";
}
out << nl << "public " << elem;
- out << nl << "get" << capName << "(int _index)";
+ out << nl << "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.lang.IllegalStateException(\"" << name << " is not set\");";
out << eb;
}
- out << nl << "return " << name << "[_index];";
+ out << nl << "return this." << name << "[index];";
out << eb;
//
@@ -3941,16 +4025,16 @@ Slice::GenCompat::TypesVisitor::visitDataMember(const DataMemberPtr& p)
out << nl << " **/";
}
out << nl << "public void";
- out << nl << "set" << capName << "(int _index, " << elem << " _val)";
+ out << nl << "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.lang.IllegalStateException(\"" << name << " is not set\");";
out << eb;
}
- out << nl << name << "[_index] = _val;";
+ out << nl << "this." << name << "[index] = val;";
out << eb;
}
}
@@ -3991,16 +4075,14 @@ Slice::GenCompat::TypesVisitor::visitEnum(const EnumPtr& p)
}
out << ';';
- out << sp << nl << "public int"
- << nl << "value()";
+ out << sp << nl << "public int value()";
out << sb;
- out << nl << "return __value;";
+ out << nl << "return _value;";
out << eb;
- out << sp << nl << "public static " << name
- << nl << "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)
@@ -4015,51 +4097,49 @@ Slice::GenCompat::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 << "__write(Ice.OutputStream __os)";
+ out << sp << nl << "public void write(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" << nl << "write(Ice.OutputStream __os, " << name << " __v)";
+ out << sp << nl << "public static void write(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 << nl << "read(Ice.InputStream __is)";
+ out << sp << nl << "public static " << name << " read(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
- << nl << "__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 Ice.MarshalException(\"enumerator value \" + __v + \" is out of range\");";
+ out << nl << "throw new 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();
@@ -4325,8 +4405,8 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
out << sb;
- string contextParam = "java.util.Map<String, String> __ctx";
- string explicitContextParam = "boolean __explicitCtx";
+ string contextParam = "java.util.Map<String, String> context";
+ string explicitContextParam = "boolean explicitCtx";
OperationList ops = p->allOperations();
for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r)
@@ -4336,7 +4416,7 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
out << sp;
- out << nl << "private static final String __" << op->name() << "_name = \"" << op->name() << "\";";
+ out << nl << "private static final String _" << op->name() << "_name = \"" << op->name() << "\";";
//
// Use the optional mapping by default.
@@ -4364,22 +4444,22 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
const string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional());
out << sp;
- out << nl << "public " << retS << " end_" << op->name() << spar << outParams << "Ice.AsyncResult __iresult"
+ out << nl << "public " << retS << " end_" << op->name() << spar << outParams << "Ice.AsyncResult iresult"
<< epar;
writeThrowsClause(package, throws);
out << sb;
if(op->returnsData())
{
- out << nl << "IceInternal.OutgoingAsync __result = IceInternal.OutgoingAsync.check(__iresult, this, __"
+ out << nl << "IceInternal.OutgoingAsync result_ = IceInternal.OutgoingAsync.check(iresult, this, _"
<< op->name() << "_name);";
out << nl << "try";
out << sb;
- out << nl << "if(!__result.__wait())";
+ out << nl << "if(!result_.waitForResponseOrUserEx())";
out << sb;
out << nl << "try";
out << sb;
- out << nl << "__result.throwUserException();";
+ out << nl << "result_.throwUserException();";
out << eb;
//
// Arrange exceptions into most-derived to least-derived order. If we don't
@@ -4394,20 +4474,20 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
#endif
for(ExceptionList::const_iterator eli = throws.begin(); eli != throws.end(); ++eli)
{
- out << nl << "catch(" << getAbsolute(*eli, package) << " __ex)";
+ out << nl << "catch(" << getAbsolute(*eli, package) << " ex_)";
out << sb;
- out << nl << "throw __ex;";
+ out << nl << "throw ex_;";
out << eb;
}
- out << nl << "catch(Ice.UserException __ex)";
+ out << nl << "catch(Ice.UserException ex_)";
out << sb;
- out << nl << "throw new Ice.UnknownUserException(__ex.ice_id(), __ex);";
+ out << nl << "throw new Ice.UnknownUserException(ex_.ice_id(), ex_);";
out << eb;
out << eb;
if(ret || !outParams.empty())
{
- out << nl << "Ice.InputStream __is = __result.startReadParams();";
+ out << nl << "Ice.InputStream istr_ = result_.startReadParams();";
const ParamDeclList paramList = op->parameters();
ParamDeclList pl;
for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
@@ -4417,16 +4497,16 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
pl.push_back(*pli);
}
}
- writeMarshalUnmarshalParams(out, package, pl, op, iter, false, true);
+ writeMarshalUnmarshalParams(out, package, pl, op, iter, false, true, false);
if(op->returnsClasses(false))
{
- out << nl << "__is.readPendingValues();";
+ out << nl << "istr_.readPendingValues();";
}
- out << nl << "__result.endReadParams();";
+ out << nl << "result_.endReadParams();";
}
else
{
- out << nl << "__result.readEmptyParams();";
+ out << nl << "result_.readEmptyParams();";
}
if(ret)
@@ -4435,32 +4515,32 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!op->returnIsOptional() &&
((builtin && builtin->kind() == Builtin::KindObject) || ClassDeclPtr::dynamicCast(ret)))
{
- out << nl << "return __ret.value;";
+ out << nl << "return ret_.value;";
}
else
{
- out << nl << "return __ret;";
+ out << nl << "return ret_;";
}
}
out << eb;
out << nl << "finally";
out << sb;
- out << nl << "if(__result != null)";
+ out << nl << "if(result_ != null)";
out << sb;
- out << nl << "__result.cacheMessageBuffers();";
+ out << nl << "result_.cacheMessageBuffers();";
out << eb;
out << eb;
}
else
{
- out << nl << "__end(__iresult, __" << op->name() << "_name);";
+ out << nl << "_end(iresult, _" << op->name() << "_name);";
}
out << eb;
//
- // The async callbacks implementation of __completed method delegate to the static
- // __<op-name>_completed method implemented bellow.
+ // The async callbacks implementation of _iceCompleted method delegate to the static
+ // _iceI_<op-name>_completed method implemented bellow.
//
if(op->returnsData())
{
@@ -4474,69 +4554,69 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
}
}
- out << sp << nl << "static public void __" << op->name() << "_completed("
- << getAsyncCallbackInterface(op, package) << " __cb, Ice.AsyncResult __result)";
+ out << sp << nl << "static public void _iceI_" << op->name() << "_completed("
+ << getAsyncCallbackInterface(op, package) << " cb, Ice.AsyncResult result)";
out << sb;
- out << nl << getAbsolute(cl, "", "", "Prx") << " __proxy = ("
- << getAbsolute(cl, "", "", "Prx") << ")__result.getProxy();";
+ out << nl << getAbsolute(cl, "", "", "Prx") << " _proxy = ("
+ << getAbsolute(cl, "", "", "Prx") << ")result.getProxy();";
TypePtr ret = op->returnType();
if(ret)
{
out << nl << typeToString(ret, TypeModeIn, package, op->getMetaData(), true,
op->returnIsOptional())
- << " __ret = " << (op->returnIsOptional() ? "null" : initValue(ret)) << ';';
+ << " ret = " << (op->returnIsOptional() ? "null" : initValue(ret)) << ';';
}
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
string ts = typeToString((*pli)->type(), TypeModeOut, package, (*pli)->getMetaData(), true,
(*pli)->optional());
- out << nl << ts << ' ' << fixKwd((*pli)->name()) << " = new " << ts << "();";
+ out << nl << ts << " iceP_" << (*pli)->name() << " = new " << ts << "();";
}
out << nl << "try";
out << sb;
out << nl;
if(op->returnType())
{
- out << "__ret = ";
+ out << "ret = ";
}
- out << "__proxy.end_" << op->name() << spar << getInOutArgs(op, OutParam) << "__result" << epar
+ out << "_proxy.end_" << op->name() << spar << getInOutArgs(op, OutParam, true) << "result" << epar
<< ';';
out << eb;
if(!throws.empty())
{
- out << nl << "catch(Ice.UserException __ex)";
+ out << nl << "catch(Ice.UserException ex)";
out << sb;
- out << nl << "__cb.exception(__ex);";
+ out << nl << "cb.exception(ex);";
out << nl << "return;";
out << eb;
}
- out << nl << "catch(Ice.LocalException __ex)";
+ out << nl << "catch(Ice.LocalException ex)";
out << sb;
- out << nl << "__cb.exception(__ex);";
+ out << nl << "cb.exception(ex);";
out << nl << "return;";
out << eb;
- out << nl << "catch(Ice.SystemException __ex)";
+ out << nl << "catch(Ice.SystemException ex)";
out << sb;
- out << nl << "__cb.exception(__ex);";
+ out << nl << "cb.exception(ex);";
out << nl << "return;";
out << eb;
- out << nl << "__cb.response" << spar;
+ out << nl << "cb.response" << spar;
if(op->returnType())
{
- out << "__ret";
+ out << "ret";
}
for(ParamDeclList::const_iterator pli = outParams.begin(); pli != outParams.end(); ++pli)
{
if((*pli)->optional())
{
- out << fixKwd((*pli)->name());
+ out << "iceP_" + (*pli)->name();
}
else
{
- out << fixKwd((*pli)->name()) + ".value";
+ out << "iceP_" + (*pli)->name() + ".value";
}
}
out << epar << ';';
@@ -4549,11 +4629,11 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(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 obj The untyped proxy.\n"
"@return A proxy for this type, or null if the object does not support this type.");
- out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj)";
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj)";
out << sb;
- out << nl << "return checkedCastImpl(__obj, ice_staticId(), " << name << "Prx.class, "
+ out << nl << "return checkedCastImpl(obj, ice_staticId(), " << name << "Prx.class, "
<< name << "PrxHelper.class);";
out << eb;
@@ -4561,12 +4641,12 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(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 << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, " << contextParam << ')';
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj, " << contextParam << ')';
out << sb;
- out << nl << "return checkedCastImpl(__obj, __ctx, ice_staticId(), " << name
+ out << nl << "return checkedCastImpl(obj, context, ice_staticId(), " << name
<< "Prx.class, " << name << "PrxHelper.class);";
out << eb;
@@ -4574,12 +4654,12 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(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 << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet)";
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj, String facet)";
out << sb;
- out << nl << "return checkedCastImpl(__obj, __facet, ice_staticId(), " << name
+ out << nl << "return checkedCastImpl(obj, facet, ice_staticId(), " << name
<< "Prx.class, " << name << "PrxHelper.class);";
out << eb;
@@ -4587,37 +4667,37 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(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 << "public static " << name << "Prx checkedCast(Ice.ObjectPrx __obj, String __facet, "
+ out << nl << "public static " << name << "Prx checkedCast(Ice.ObjectPrx obj, String facet, "
<< contextParam << ')';
out << sb;
- out << nl << "return checkedCastImpl(__obj, __facet, __ctx, ice_staticId(), " << name
+ out << nl << "return checkedCastImpl(obj, facet, context, ice_staticId(), " << name
<< "Prx.class, " << name << "PrxHelper.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 << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj)";
+ out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx obj)";
out << sb;
- out << nl << "return uncheckedCastImpl(__obj, " << name << "Prx.class, " << name
+ out << nl << "return uncheckedCastImpl(obj, " << name << "Prx.class, " << name
<< "PrxHelper.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 << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx __obj, String __facet)";
+ out << nl << "public static " << name << "Prx uncheckedCast(Ice.ObjectPrx obj, String facet)";
out << sb;
- out << nl << "return uncheckedCastImpl(__obj, __facet, " << name << "Prx.class, " << name
+ out << nl << "return uncheckedCastImpl(obj, facet, " << name << "Prx.class, " << name
<< "PrxHelper.class);";
out << eb;
@@ -4635,7 +4715,7 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
assert(scopedIter != ids.end());
StringList::difference_type scopedPos = ::IceUtilInternal::distance(firstIter, scopedIter);
- out << sp << nl << "public static final String[] __ids =";
+ out << sp << nl << "private static final String[] _ids =";
out << sb;
for(StringList::const_iterator q = ids.begin(); q != ids.end();)
@@ -4655,21 +4735,21 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p)
"@return The Slice type ID.");
out << nl << "public static String ice_staticId()";
out << sb;
- out << nl << "return __ids[" << scopedPos << "];";
+ out << nl << "return _ids[" << scopedPos << "];";
out << eb;
- out << sp << nl << "public static void write(Ice.OutputStream __os, " << name << "Prx v)";
+ out << sp << nl << "public static void write(Ice.OutputStream ostr, " << name << "Prx v)";
out << sb;
- out << nl << "__os.writeProxy(v);";
+ out << nl << "ostr.writeProxy(v);";
out << eb;
- out << sp << nl << "public static " << name << "Prx read(Ice.InputStream __is)";
+ out << sp << nl << "public static " << name << "Prx read(Ice.InputStream istr)";
out << sb;
- out << nl << "Ice.ObjectPrx proxy = __is.readProxy();";
+ out << nl << "Ice.ObjectPrx proxy = istr.readProxy();";
out << nl << "if(proxy != null)";
out << sb;
out << nl << name << "PrxHelper result = new " << name << "PrxHelper();";
- out << nl << "result.__copyFrom(proxy);";
+ out << nl << "result._copyFrom(proxy);";
out << nl << "return result;";
out << eb;
out << nl << "return null;";
@@ -4776,10 +4856,10 @@ Slice::GenCompat::HelperVisitor::visitSequence(const SequencePtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << typeS << " __v)";
+ out << nl << "public static void" << nl << "write(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;
@@ -4787,12 +4867,12 @@ Slice::GenCompat::HelperVisitor::visitSequence(const SequencePtr& p)
{
out << nl << "@SuppressWarnings(\"unchecked\")";
}
- out << nl << "public static " << typeS << nl << "read(Ice.InputStream __is)";
+ out << nl << "public static " << typeS << nl << "read(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;
@@ -4828,19 +4908,19 @@ Slice::GenCompat::HelperVisitor::visitDictionary(const DictionaryPtr& p)
out << sp << nl << "public final class " << name << "Helper";
out << sb;
- out << nl << "public static void" << nl << "write(Ice.OutputStream __os, " << formalType << " __v)";
+ out << nl << "public static void" << nl << "write(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
- << nl << "read(Ice.InputStream __is)";
+ << nl << "read(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;
@@ -4849,13 +4929,15 @@ Slice::GenCompat::HelperVisitor::visitDictionary(const DictionaryPtr& p)
void
Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const string& package, const OperationPtr& op,
- bool optionalMapping)
+ bool optionalMapping)
{
const string name = p->name();
Output& out = output();
- const string contextParam = "java.util.Map<String, String> __ctx";
- const string explicitContextParam = "boolean __explicitCtx";
+ const string contextParamName = getEscapedParamName(op, "context");
+ const string contextParam = "java.util.Map<String, String> " + contextParamName;
+ const string contextParamInternal = "java.util.Map<String, String> context";
+ const string explicitContextParam = "boolean explicitCtx";
const ContainerPtr container = op->container();
const ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
@@ -4864,6 +4946,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
const string retS = typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, op->returnIsOptional());
vector<string> params = getParamsProxy(op, package, false, optionalMapping);
+ vector<string> paramsInternal = getParamsProxy(op, package, false, optionalMapping, true);
vector<string> args = getArgs(op);
ParamDeclList inParams;
@@ -4897,7 +4980,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
{
out << "return ";
}
- out << opName << spar << args << "null" << "false" << epar << ';';
+ out << "_iceI_" << op->name() << spar << args << "null" << "false" << epar << ';';
out << eb;
out << sp << nl << "public " << retS << ' ' << opName << spar << params << contextParam << epar;
@@ -4908,11 +4991,11 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
{
out << "return ";
}
- out << opName << spar << args << "__ctx" << "true" << epar << ';';
+ out << "_iceI_" << op->name() << spar << args << contextParamName << "true" << epar << ';';
out << eb;
out << sp;
- out << nl << "private " << retS << ' ' << opName << spar << params << contextParam
+ out << nl << "private " << retS << " _iceI_" << op->name() << spar << paramsInternal << contextParamInternal
<< explicitContextParam << epar;
writeThrowsClause(package, throws);
out << sb;
@@ -4920,7 +5003,7 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
// This code replaces the synchronous calls with chained AMI calls.
if(op->returnsData())
{
- out << nl << "__checkTwowayOnly(__" << op->name() << "_name);";
+ out << nl << "_checkTwowayOnly(_" << op->name() << "_name);";
}
if(ret)
@@ -4933,21 +5016,21 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
}
out << "end_" << op->name() << "(";
- vector<string> inOutArgs = getInOutArgs(op, OutParam);
+ vector<string> inOutArgs = getInOutArgs(op, OutParam, true);
if(!inOutArgs.empty()) {
for(vector<string>::const_iterator p = inOutArgs.begin(); p != inOutArgs.end(); ++p) {
out << *p << ", ";
}
}
- vector<string> inArgs = getInOutArgs(op, InParam);
- out << "begin_" << op->name() << "(";
+ vector<string> inArgs = getInOutArgs(op, InParam, true);
+ out << "_iceI_begin_" << op->name() << "(";
if(!inArgs.empty())
{
for(vector<string>::const_iterator p = inArgs.begin(); p != inArgs.end(); ++p) {
out << *p << ", ";
}
}
- out << "__ctx, __explicitCtx, true, null));";
+ out << "context, explicitCtx, true, null));";
out << eb;
{
@@ -4956,7 +5039,8 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
//
vector<string> inParams = getInOutParams(op, package, InParam, true, optionalMapping);
vector<string> inArgs = getInOutArgs(op, InParam);
- const string callbackParam = "Ice.Callback __cb";
+ const string callbackParamName = getEscapedParamName(op, "cb");
+ const string callbackParam = "Ice.Callback " + callbackParamName;
const ParamDeclList paramList = op->parameters();
int iter;
@@ -4965,26 +5049,26 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
//
out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null" << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "null" << epar
<< ';';
out << eb;
out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "null" << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false" << "null" << epar
<< ';';
out << eb;
out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << callbackParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << callbackParamName << epar
<< ';';
out << eb;
out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
<< callbackParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false" << callbackParamName << epar
<< ';';
out << eb;
@@ -5000,19 +5084,19 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
ContainerPtr container = op->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string opClassName = getAbsolute(cl, package, "Callback_", '_' + op->name());
- typeSafeCallbackParam = opClassName + " __cb";
+ typeSafeCallbackParam = opClassName + " " + getEscapedParamName(op, "cb");
out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << typeSafeCallbackParam
<< epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << "__cb" << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << "null" << "false" << "false" << callbackParamName << epar
<< ';';
out << eb;
out << sp << nl << "public Ice.AsyncResult begin_" << op->name() << spar << inParams << contextParam
<< typeSafeCallbackParam << epar;
out << sb;
- out << nl << "return begin_" << op->name() << spar << inArgs << "__ctx" << "true" << "false" << "__cb" << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << inArgs << contextParamName << "true" << "false" << callbackParamName << epar
<< ';';
out << eb;
@@ -5023,14 +5107,14 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << nl << "public Ice.AsyncResult begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, false, false, optionalMapping));
out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package) << epar << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package) << epar << ';';
out << eb;
out << sp;
out << nl << "public Ice.AsyncResult begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, false, true, optionalMapping));
out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, false, true) << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package, false, true) << epar
<< ';';
out << eb;
@@ -5038,26 +5122,26 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << nl << "public Ice.AsyncResult begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, true, false, optionalMapping));
out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true) << epar << ';';
+ out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true) << epar << ';';
out << eb;
out << sp;
out << nl << "public Ice.AsyncResult begin_" << op->name();
writeParamList(out, getParamsAsyncLambda(op, package, true, true, optionalMapping));
out << sb;
- out << nl << "return begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true, true) << epar
+ out << nl << "return _iceI_begin_" << op->name() << spar << getArgsAsyncLambda(op, package, true, true) << epar
<< ';';
out << eb;
- vector<string> params = inParams;
- params.push_back(contextParam);
- params.push_back("boolean __explicitCtx");
- params.push_back("boolean __synchronous");
- vector<string> asyncParams = getParamsAsyncLambda(op, package, false, true, optionalMapping, false);
+ vector<string> params = getInOutParams(op, package, InParam, true, optionalMapping, true);
+ params.push_back("java.util.Map<String, String> context");
+ params.push_back("boolean explicitCtx");
+ params.push_back("boolean synchronous");
+ vector<string> asyncParams = getParamsAsyncLambda(op, package, false, true, optionalMapping, false, true);
copy(asyncParams.begin(), asyncParams.end(), back_inserter(params));
out << sp;
- out << nl << "private Ice.AsyncResult begin_" << op->name();
+ out << nl << "private Ice.AsyncResult _iceI_begin_" << op->name();
writeParamList(out, params);
out << sb;
@@ -5065,12 +5149,12 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
if(!op->returnsData())
{
- params = getInOutArgs(op, InParam);
- params.push_back("__ctx");
- params.push_back("__explicitCtx");
- params.push_back("__synchronous");
- params.push_back("new IceInternal.Functional_OnewayCallback(__responseCb, __exceptionCb, __sentCb)");
- out << nl << "return begin_" << op->name();
+ params = getInOutArgs(op, InParam, true);
+ params.push_back("context");
+ params.push_back("explicitCtx");
+ params.push_back("synchronous");
+ params.push_back("new IceInternal.Functional_OnewayCallback(responseCb, exceptionCb, sentCb)");
+ out << nl << "return _iceI_begin_" << op->name();
writeParamList(out, params);
out << ';';
}
@@ -5097,57 +5181,57 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << "userExceptionCb, ";
}
out << "exceptionCb, sentCb);";
- out << nl << "__responseCb = responseCb;";
+ out << nl << "_responseCb = responseCb;";
out << eb;
out << sp;
out << nl << "public void response" << spar << getParamsAsyncCB(op, package, false, true) << epar;
out << sb;
- out << nl << "if(__responseCb != null)";
+ out << nl << "if(_responseCb != null)";
out << sb;
- out << nl << "__responseCb.apply" << spar;
+ out << nl << "_responseCb.apply" << spar;
if(ret)
{
- out << "__ret";
+ out << "ret";
}
out << getInOutArgs(op, OutParam) << epar << ';';
out << eb;
out << eb;
out << sp;
- out << nl << "public final void __completed(Ice.AsyncResult __result)";
+ out << nl << "public final void _iceCompleted(Ice.AsyncResult result)";
out << sb;
- out << nl << p->name() << "PrxHelper.__" << op->name() << "_completed(this, __result);";
+ out << nl << p->name() << "PrxHelper._iceI_" << op->name() << "_completed(this, result);";
out << eb;
out << sp;
- out << nl << "private final " << getLambdaResponseCB(op, package) << " __responseCb;";
+ out << nl << "private final " << getLambdaResponseCB(op, package) << " _responseCb;";
out << eb;
- out << nl << "return begin_" << op->name() << spar << getInOutArgs(op, InParam) << "__ctx"
- << "__explicitCtx"
- << "__synchronous"
- << (throws.empty() ? "new CB(__responseCb, __exceptionCb, __sentCb)" :
- "new CB(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)")
+ out << nl << "return _iceI_begin_" << op->name() << spar << getInOutArgs(op, InParam, true) << "context"
+ << "explicitCtx"
+ << "synchronous"
+ << (throws.empty() ? "new CB(responseCb, exceptionCb, sentCb)" :
+ "new CB(responseCb, userExceptionCb, exceptionCb, sentCb)")
<< epar << ';';
}
else
{
- params = getInOutArgs(op, InParam);
- params.push_back("__ctx");
- params.push_back("__explicitCtx");
- params.push_back("__synchronous");
+ params = getInOutArgs(op, InParam, true);
+ params.push_back("context");
+ params.push_back("explicitCtx");
+ params.push_back("synchronous");
const string baseClass = getAsyncCallbackBaseClass(op, true);
- out << nl << "return begin_" << op->name();
+ out << nl << "return _iceI_begin_" << op->name();
writeParamList(out, params, false, false);
out << nl
- << (throws.empty() ? "new " + baseClass + "(__responseCb, __exceptionCb, __sentCb)" :
- "new " + baseClass + "(__responseCb, __userExceptionCb, __exceptionCb, __sentCb)");
+ << (throws.empty() ? "new " + baseClass + "(responseCb, exceptionCb, sentCb)" :
+ "new " + baseClass + "(responseCb, userExceptionCb, exceptionCb, sentCb)");
out.inc();
out << sb;
- out << nl << "public final void __completed(Ice.AsyncResult __result)";
+ out << nl << "public final void _iceCompleted(Ice.AsyncResult result)";
out << sb;
- out << nl << p->name() << "PrxHelper.__" << op->name() << "_completed(this, __result);";
+ out << nl << p->name() << "PrxHelper._iceI_" << op->name() << "_completed(this, result);";
out << eb;
out << eb;
out << ");";
@@ -5157,34 +5241,34 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
out << eb;
//
- // Implementation of begin method
+ // Implementation of _iceI_begin method
//
- params = inParams;
- params.push_back(contextParam);
- params.push_back("boolean __explicitCtx");
- params.push_back("boolean __synchronous");
- params.push_back("IceInternal.CallbackBase __cb");
+ params = getInOutParams(op, package, InParam, true, optionalMapping, true);
+ params.push_back("java.util.Map<String, String> context");
+ params.push_back("boolean explicitCtx");
+ params.push_back("boolean synchronous");
+ params.push_back("IceInternal.CallbackBase cb");
out << sp;
- out << nl << "private Ice.AsyncResult begin_" << op->name();
+ out << nl << "private Ice.AsyncResult _iceI_begin_" << op->name();
writeParamList(out, params);
out << sb;
if(op->returnsData())
{
- out << nl << "__checkAsyncTwowayOnly(__" << op->name() << "_name);";
+ out << nl << "_checkAsyncTwowayOnly(_" << op->name() << "_name);";
}
- out << nl << "IceInternal.OutgoingAsync __result = getOutgoingAsync(__" << op->name()
- << "_name, __cb);";
+ out << nl << "IceInternal.OutgoingAsync result = getOutgoingAsync(_" << op->name()
+ << "_name, cb);";
out << nl << "try";
out << sb;
- out << nl << "__result.prepare(__" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode())
- << ", __ctx, __explicitCtx, __synchronous);";
+ out << nl << "result.prepare(_" << op->name() << "_name, " << sliceModeToIceMode(op->sendMode())
+ << ", context, explicitCtx, synchronous);";
iter = 0;
if(!inArgs.empty())
{
- out << nl << "Ice.OutputStream __os = __result.startWriteParams(" << opFormatTypeToString(op) << ");";
+ out << nl << "Ice.OutputStream ostr = result.startWriteParams(" << opFormatTypeToString(op) << ");";
ParamDeclList pl;
for(ParamDeclList::const_iterator pli = paramList.begin(); pli != paramList.end(); ++pli)
{
@@ -5193,25 +5277,25 @@ Slice::GenCompat::HelperVisitor::writeOperation(const ClassDefPtr& p, const stri
pl.push_back(*pli);
}
}
- writeMarshalUnmarshalParams(out, package, pl, 0, iter, true, optionalMapping);
+ writeMarshalUnmarshalParams(out, package, pl, 0, iter, true, optionalMapping, true);
if(op->sendsClasses(false))
{
- out << nl << "__os.writePendingValues();";
+ out << nl << "ostr.writePendingValues();";
}
- out << nl << "__result.endWriteParams();";
+ out << nl << "result.endWriteParams();";
}
else
{
- out << nl << "__result.writeEmptyParams();";
+ out << nl << "result.writeEmptyParams();";
}
- out << nl << "__result.invoke();";
+ out << nl << "result.invoke();";
out << eb;
- out << nl << "catch(Ice.Exception __ex)";
+ out << nl << "catch(Ice.Exception ex)";
out << sb;
- out << nl << "__result.abort(__ex);";
+ out << nl << "result.abort(ex);";
out << eb;
- out << nl << "return __result;";
+ out << nl << "return result;";
out << eb;
}
}
@@ -5293,12 +5377,13 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
throws.unique();
string deprecateReason = getDeprecateReason(p, cl, "operation");
- string contextDoc = "@param __ctx The Context map to send with the invocation.";
- string contextParam = "java.util.Map<String, String> __ctx";
- string lambdaResponseDoc = "@param __responseCb The lambda response callback.";
- string lambdaUserExDoc = "@param __userExceptionCb The lambda user exception callback.";
- string lambdaExDoc = "@param __exceptionCb The lambda exception callback.";
- string lambdaSentDoc = "@param __sentCb The lambda sent callback.";
+ string contextDoc = "@param context The Context map to send with the invocation.";
+ string contextParamName = getEscapedParamName(p, "context");
+ string contextParam = "java.util.Map<String, String> " + contextParamName;
+ string lambdaResponseDoc = "@param responseCb The lambda response callback.";
+ string lambdaUserExDoc = "@param userExceptionCb The lambda user exception callback.";
+ string lambdaExDoc = "@param exceptionCb The lambda exception callback.";
+ string lambdaSentDoc = "@param sentCb The lambda sent callback.";
const bool optional = p->sendsOptionals();
@@ -5346,8 +5431,8 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
// Start with the type-unsafe begin methods.
//
vector<string> inParams = getInOutParams(p, package, InParam, true, true);
- string callbackParam = "Ice.Callback __cb";
- string callbackDoc = "@param __cb The asynchronous callback object.";
+ string callbackParam = "Ice.Callback " + getEscapedParamName(p, "cb");
+ string callbackDoc = "@param cb The asynchronous callback object.";
out << sp;
writeDocCommentAMI(out, p, InParam);
@@ -5378,7 +5463,7 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string opClassName = getAbsolute(cl, package, "Callback_", '_' + p->name());
- typeSafeCallbackParam = opClassName + " __cb";
+ typeSafeCallbackParam = opClassName + " " + getEscapedParamName(p, "cb");
out << sp;
writeDocCommentAMI(out, p, InParam, callbackDoc);
@@ -5444,7 +5529,7 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
out << sp;
writeDocCommentAMI(out, p, OutParam);
- out << nl << "public " << retS << " end_" << p->name() << spar << outParams << "Ice.AsyncResult __result"
+ out << nl << "public " << retS << " end_" << p->name() << spar << outParams << "Ice.AsyncResult result"
<< epar;
writeThrowsClause(package, throws);
out << ';';
@@ -5456,8 +5541,8 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
// Write overloaded versions of the methods using required params.
//
vector<string> inParams = getInOutParams(p, package, InParam, true, false);
- string callbackParam = "Ice.Callback __cb";
- string callbackDoc = "@param __cb The asynchronous callback object.";
+ string callbackParam = "Ice.Callback " + getEscapedParamName(p, "cb");
+ string callbackDoc = "@param cb The asynchronous callback object.";
out << sp;
writeDocCommentAMI(out, p, InParam);
@@ -5520,7 +5605,7 @@ Slice::GenCompat::ProxyVisitor::visitOperation(const OperationPtr& p)
ContainerPtr container = p->container();
ClassDefPtr cl = ClassDefPtr::dynamicCast(container);
string opClassName = getAbsolute(cl, package, "Callback_", '_' + p->name());
- typeSafeCallbackParam = opClassName + " __cb";
+ typeSafeCallbackParam = opClassName + " " + getEscapedParamName(p, "cb");
out << sp;
writeDocCommentAMI(out, p, InParam, callbackDoc);
@@ -5559,14 +5644,6 @@ Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "public abstract class _" << name << "Disp extends Ice.ObjectImpl implements " << fixKwd(name);
out << sb;
- out << sp << nl << "protected void" << nl << "ice_copyStateFrom(Ice.Object __obj)";
- out.inc();
- out << nl << "throws java.lang.CloneNotSupportedException";
- out.dec();
- out << sb;
- out << nl << "throw new java.lang.CloneNotSupportedException();";
- out << eb;
-
writeDispatchAndMarshalling(out, p);
//
@@ -5707,9 +5784,12 @@ Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
out << nl << "@SuppressWarnings(\"deprecation\")";
}
out << nl << "public " << (hasAMD ? string("void") : retS) << ' ' << opName << spar << params;
+
+ const string currentParamName = getEscapedParamName((*r), "current");
+
if(!p->isLocal())
{
- out << "Ice.Current __current";
+ out << "Ice.Current " + currentParamName;
}
out << epar;
@@ -5735,7 +5815,7 @@ Slice::GenCompat::DispatcherVisitor::visitClassDefStart(const ClassDefPtr& p)
out << "_ice_delegate." << opName << spar << args;
if(!p->isLocal())
{
- out << "__current";
+ out << currentParamName;
}
out << epar << ';';
out << eb;
@@ -5952,7 +6032,8 @@ Slice::GenCompat::BaseImplVisitor::writeOperation(Output& out, const string& pac
{
vector<string> paramsAMD = getParamsAsync(op, package, true, true);
- out << sp << nl << "public void " << opName << "_async" << spar << paramsAMD << "Ice.Current __current"
+ out << sp << nl << "public void " << opName << "_async" << spar << paramsAMD
+ << "Ice.Current " + getEscapedParamName(op, "current")
<< epar;
ExceptionList throws = op->throws();
@@ -5974,7 +6055,7 @@ Slice::GenCompat::BaseImplVisitor::writeOperation(Output& out, const string& pac
out << sb;
- string result = "__r";
+ string result = "r";
ParamDeclList paramList = op->parameters();
for(ParamDeclList::const_iterator q = paramList.begin(); q != paramList.end(); ++q)
{
@@ -5997,7 +6078,7 @@ Slice::GenCompat::BaseImplVisitor::writeOperation(Output& out, const string& pac
}
}
- out << nl << "__cb.ice_response(";
+ out << nl << "cb.ice_response(";
if(ret)
{
out << result;
@@ -6022,9 +6103,10 @@ Slice::GenCompat::BaseImplVisitor::writeOperation(Output& out, const string& pac
else
{
out << sp << nl << "public " << retS << nl << fixKwd(opName) << spar << params;
+
if(!local)
{
- out << "Ice.Current __current";
+ out << "Ice.Current " + getEscapedParamName(op, "current");
}
out << epar;
@@ -6278,9 +6360,9 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
out.dec();
out << sb;
- out << sp << nl << "public final void __completed(Ice.AsyncResult __result)";
+ out << sp << nl << "public final void _iceCompleted(Ice.AsyncResult result)";
out << sb;
- out << nl << cl->name() << "PrxHelper.__" << p->name() << "_completed(this, __result);";
+ out << nl << cl->name() << "PrxHelper._iceI_" << p->name() << "_completed(this, result);";
out << eb;
out << eb;
@@ -6357,11 +6439,11 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p)
iter = 0;
if(ret || !outParams.empty())
{
- out << nl << "Ice.OutputStream __os = this.startWriteParams();";
- writeMarshalUnmarshalParams(out, classPkg, outParams, p, iter, true, optionalMapping, false);
+ out << nl << "Ice.OutputStream ostr_ = this.startWriteParams();";
+ writeMarshalUnmarshalParams(out, classPkg, outParams, p, iter, true, optionalMapping, false, "ret", false);
if(p->returnsClasses(false))
{
- out << nl << "__os.writePendingValues();";
+ out << nl << "ostr_.writePendingValues();";
}
out << nl << "this.endWriteParams();";
}
diff --git a/cpp/src/slice2java/GenCompat.h b/cpp/src/slice2java/GenCompat.h
index a55841a43c9..dde47bc772a 100644
--- a/cpp/src/slice2java/GenCompat.h
+++ b/cpp/src/slice2java/GenCompat.h
@@ -35,8 +35,8 @@ protected:
// Compose the parameter lists for an operation.
//
std::vector<std::string> getParams(const OperationPtr&, const std::string&, bool, bool);
- std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool, bool);
- std::vector<std::string> getInOutParams(const OperationPtr&, const std::string&, ParamDir, bool, bool);
+ std::vector<std::string> getParamsProxy(const OperationPtr&, const std::string&, bool, bool, bool = false);
+ std::vector<std::string> getInOutParams(const OperationPtr&, const std::string&, ParamDir, bool, bool, bool = false);
std::vector<std::string> getParamsAsync(const OperationPtr&, const std::string&, bool, bool);
std::vector<std::string> getParamsAsyncCB(const OperationPtr&, const std::string&, bool, bool);
@@ -46,20 +46,22 @@ protected:
std::vector<std::string> getParamsAsyncLambda(const OperationPtr&, const std::string&,
bool context = false, bool sentCB = false,
bool optionalMapping = false,
- bool inParams = true);
+ bool inParams = true,
+ bool internal = false);
std::vector<std::string> getArgsAsyncLambda(const OperationPtr&, const std::string&,
- bool context = false, bool sentCB = false);
+ bool context = false,
+ bool sentCB = false);
//
// Compose the argument lists for an operation.
//
std::vector<std::string> getArgs(const OperationPtr&);
- std::vector<std::string> getInOutArgs(const OperationPtr&, ParamDir);
+ std::vector<std::string> getInOutArgs(const OperationPtr&, ParamDir, bool = false);
std::vector<std::string> getArgsAsync(const OperationPtr&);
std::vector<std::string> getArgsAsyncCB(const OperationPtr&);
void writeMarshalUnmarshalParams(::IceUtilInternal::Output&, const std::string&, const ParamDeclList&,
- const OperationPtr&, int&, bool, bool, bool = false);
+ const OperationPtr&, int&, bool, bool, bool, const std::string& = "", bool = false);
//
// Generate a throws clause containing only non-local exceptions.
@@ -75,9 +77,9 @@ protected:
//
// Marshal/unmarshal a data member.
//
- void writeMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
+ void writeMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&, bool = false);
void writeUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&,
- bool, int&);
+ bool, int&, bool = false);
void writeStreamMarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&);
void writeStreamUnmarshalDataMember(::IceUtilInternal::Output&, const std::string&, const DataMemberPtr&, int&,
bool, int&);