Skip to content

Commit

Permalink
Merge branch 'main' into swap-def-decl-creation-order
Browse files Browse the repository at this point in the history
  • Loading branch information
InsertCreativityHere authored Jan 15, 2025
2 parents ef3f744 + 71e8946 commit f6fac9c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 22 deletions.
9 changes: 0 additions & 9 deletions cpp/src/Slice/MetadataValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,6 @@ Slice::validateMetadata(const UnitPtr& p, string_view prefix, map<string, Metada
};
knownMetadata.emplace("suppress-warning", std::move(suppressWarningInfo));

// TODO: we should probably just remove this metadata. It's only checked by slice2java,
// and there's already a 'java:UserException' metadata that we also check... better to only keep that one.
// "UserException"
MetadataInfo userExceptionInfo = {
.validOn = {typeid(Operation)},
.acceptedArgumentKind = MetadataArgumentKind::NoArguments,
};
knownMetadata.emplace("UserException", std::move(userExceptionInfo));

// Then we pass this list off the internal visitor, which performs the heavy lifting.
auto visitor = MetadataVisitor(std::move(prefix), std::move(knownMetadata));
p->visit(&visitor);
Expand Down
19 changes: 6 additions & 13 deletions cpp/src/slice2java/Gen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ Slice::JavaVisitor::writeThrowsClause(const string& package, const ExceptionList
{
Output& out = output();

if (op && (op->hasMetadata("java:UserException") || op->hasMetadata("UserException")))
if (op && (op->hasMetadata("java:UserException")))
{
out.inc();
out << nl << "throws com.zeroc.Ice.UserException";
Expand Down Expand Up @@ -1372,7 +1372,7 @@ Slice::JavaVisitor::writeDispatch(Output& out, const InterfaceDefPtr& p)
writeHiddenDocComment(out);
out << nl << "static java.util.concurrent.CompletionStage<com.zeroc.Ice.OutgoingResponse> _iceD_" << opName
<< '(' << name << " obj, com.zeroc.Ice.IncomingRequest request)";
if (!op->throws().empty() || op->hasMetadata("java:UserException") || op->hasMetadata("UserException"))
if (!op->throws().empty() || op->hasMetadata("java:UserException"))
{
out.inc();
out << nl << "throws com.zeroc.Ice.UserException";
Expand Down Expand Up @@ -2149,18 +2149,11 @@ Slice::JavaVisitor::writeServantDocComment(
out << nl << " * @return A completion stage that the servant will complete when the invocation completes.";
}

if (p->hasMetadata("java:UserException") || p->hasMetadata("UserException"))
map<string, StringList> exDocs = dc->exceptions();
for (const auto& exDoc : exDocs)
{
out << nl << " * @throws com.zeroc.Ice.UserException";
}
else
{
map<string, StringList> exDocs = dc->exceptions();
for (const auto& exDoc : exDocs)
{
out << nl << " * @throws " << fixKwd(exDoc.first) << ' ';
writeDocCommentLines(out, exDoc.second);
}
out << nl << " * @throws " << fixKwd(exDoc.first) << ' ';
writeDocCommentLines(out, exDoc.second);
}

if (!dc->seeAlso().empty())
Expand Down

0 comments on commit f6fac9c

Please sign in to comment.