diff options
author | Joe George <joe@zeroc.com> | 2017-06-15 16:57:20 -0400 |
---|---|---|
committer | Joe George <joe@zeroc.com> | 2017-06-15 17:11:49 -0400 |
commit | 529f4ec3b3b957a7c5612a85204d4f38f216cda4 (patch) | |
tree | f4385d046359279a0ee989a4aa6e688762eec8fd /cpp/src/slice2java | |
parent | Fix (ICE-8067) - Increase timeout in IceStorm/single (diff) | |
download | ice-529f4ec3b3b957a7c5612a85204d4f38f216cda4.tar.bz2 ice-529f4ec3b3b957a7c5612a85204d4f38f216cda4.tar.xz ice-529f4ec3b3b957a7c5612a85204d4f38f216cda4.zip |
ICE-8051 - Suppress deprecation warnings
Diffstat (limited to 'cpp/src/slice2java')
-rw-r--r-- | cpp/src/slice2java/GenCompat.cpp | 51 |
1 files changed, 40 insertions, 11 deletions
diff --git a/cpp/src/slice2java/GenCompat.cpp b/cpp/src/slice2java/GenCompat.cpp index 9eda496546d..ff59af9df2a 100644 --- a/cpp/src/slice2java/GenCompat.cpp +++ b/cpp/src/slice2java/GenCompat.cpp @@ -118,6 +118,19 @@ getDeprecateReason(const ContainedPtr& p1, const ContainedPtr& p2, const string& return deprecateReason; } +bool +writeSuppressDeprecation(Output& out, const ContainedPtr& p1, const ContainedPtr& p2 = 0) +{ + string deprecateMetadata; + if(p1->findMetaData("deprecate", deprecateMetadata) || + (p2 != 0 && p2->findMetaData("deprecate", deprecateMetadata))) + { + out << nl << "@SuppressWarnings(\"deprecation\")"; + return true; + } + return false; +} + string initValue(const TypePtr& p) { @@ -1221,6 +1234,7 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe if(generateOperation) { out << sp; + writeSuppressDeprecation(out, op, cl); out << nl << "public final " << typeToString(ret, TypeModeReturn, package, op->getMetaData(), true, optionalMapping && op->returnIsOptional()) @@ -1250,14 +1264,10 @@ Slice::JavaCompatVisitor::writeDispatchAndMarshalling(Output& out, const ClassDe ContainerPtr container = op->container(); ClassDefPtr cl = ClassDefPtr::dynamicCast(container); assert(cl); - string deprecateReason = getDeprecateReason(op, cl, "operation"); string opName = op->name(); out << sp; - if(!deprecateReason.empty()) - { - out << nl << "/** @deprecated **/"; - } + writeSuppressDeprecation(out, op); out << nl << "public static boolean _iceD_" << opName << '(' << name << " obj, IceInternal.Incoming inS, Ice.Current current)"; out.inc(); @@ -4389,11 +4399,17 @@ Slice::GenCompat::HolderVisitor::writeHolder(const TypePtr& p) open(absolute, file); Output& out = output(); - - string typeS = typeToString(p, TypeModeIn, getPackage(contained)); - out << sp << nl << "public final class " << name << "Holder"; BuiltinPtr builtin = BuiltinPtr::dynamicCast(p); ClassDeclPtr cl = ClassDeclPtr::dynamicCast(p); + + out << sp; + if(cl) + { + writeSuppressDeprecation(out, cl->definition()); + } + + string typeS = typeToString(p, TypeModeIn, getPackage(contained)); + out << nl << "public final class " << name << "Holder"; if(!p->isLocal() && ((builtin && builtin->kind() == Builtin::KindObject) || cl)) { out << " extends Ice.ObjectHolderBase<" << typeS << ">"; @@ -4480,6 +4496,7 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) open(getAbsolute(p, "", "", "PrxHelper"), p->file()); Output& out = output(); + OperationList ops = p->allOperations(); // // A proxy helper class serves two purposes: it implements the @@ -4489,6 +4506,18 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << sp; writeDocComment(out, getDeprecateReason(p, 0, p->isInterface() ? "interface" : "class"), "Provides type-specific helper functions."); + + if(!writeSuppressDeprecation(out, p)) + { + for(OperationList::iterator r = ops.begin(); r != ops.end(); ++r) + { + if(writeSuppressDeprecation(out, (*r))) + { + break; + } + } + } + out << nl << "public final class " << name << "PrxHelper extends Ice.ObjectPrxHelperBase implements " << name << "Prx"; @@ -4497,7 +4526,6 @@ Slice::GenCompat::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) 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) { OperationPtr op = *r; @@ -6498,8 +6526,9 @@ Slice::GenCompat::AsyncVisitor::visitOperation(const OperationPtr& p) } int iter; - - out << sp << nl << "final class " << classNameAMDI << '_' << name + out << sp; + writeSuppressDeprecation(out, p); + out << nl << "final class " << classNameAMDI << '_' << name << " extends IceInternal.IncomingAsync implements " << classNameAMD << '_' << name; out << sb; |