From 21ec83a1978c462f07bcff958e29562f491f3e13 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Fri, 23 Jun 2023 11:44:56 +0200 Subject: [PATCH] Java: Add MaD support for With[out]Element. --- .../java/dataflow/internal/FlowSummaryImplSpecific.qll | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll b/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll index d9782c2eecf..b99c96c8085 100644 --- a/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll +++ b/java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImplSpecific.qll @@ -170,6 +170,10 @@ predicate neutralSummaryElement(SummarizedCallableBase c, string provenance) { bindingset[c] SummaryComponent interpretComponentSpecific(AccessPathToken c) { exists(Content content | parseContent(c, content) and result = SummaryComponent::content(content)) + or + c = "WithoutElement" and result = SummaryComponent::withoutContent(any(CollectionContent cc)) + or + c = "WithElement" and result = SummaryComponent::withContent(any(CollectionContent cc)) } /** Gets the summary component for specification component `c`, if any. */ @@ -196,6 +200,10 @@ private string getContentSpecific(Content c) { /** Gets the textual representation of the content in the format used for MaD models. */ string getMadRepresentationSpecific(SummaryComponent sc) { exists(Content c | sc = TContentSummaryComponent(c) and result = getContentSpecific(c)) + or + sc = TWithoutContentSummaryComponent(_) and result = "WithoutElement" + or + sc = TWithContentSummaryComponent(_) and result = "WithElement" } bindingset[pos]