From 3eb3cd345dd07c5d37dc0177fe162afbd6160570 Mon Sep 17 00:00:00 2001 From: Anders Schack-Mulligen Date: Tue, 14 May 2019 16:31:56 +0200 Subject: [PATCH] Java: Update qldoc and add callsImpl convenience wrapper. --- java/ql/src/semmle/code/java/Member.qll | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/java/ql/src/semmle/code/java/Member.qll b/java/ql/src/semmle/code/java/Member.qll index 1889bfbda94..46aa8721ef4 100755 --- a/java/ql/src/semmle/code/java/Member.qll +++ b/java/ql/src/semmle/code/java/Member.qll @@ -117,13 +117,21 @@ class Callable extends StmtParent, Member, @callable { /** * Holds if this callable may call the specified callable, * taking virtual dispatch into account. + * + * This includes both static call targets and dynamic dispatch targets. */ predicate polyCalls(Callable m) { - this.calls(m) - or + this.calls(m) or this.callsImpl(m) + } + + /** + * Holds if `c` is a viable implementation of a callable called by this + * callable, taking virtual dispatch resolution into account. + */ + predicate callsImpl(Callable c) { exists(Call call | call.getCaller() = this and - viableCallable(call) = m + viableCallable(call) = c ) }