Skip to content

Commit f9e4512

Browse files
committed
Java: Update polyCalls to use virtual dispatch.
1 parent bb67ac9 commit f9e4512

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

java/ql/src/semmle/code/java/Member.qll

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Type
88
import Annotation
99
import Exception
1010
import metrics.MetricField
11+
private import dispatch.VirtualDispatch
1112

1213
/**
1314
* A common abstraction for type member declarations,
@@ -115,13 +116,14 @@ class Callable extends StmtParent, Member, @callable {
115116

116117
/**
117118
* Holds if this callable may call the specified callable,
118-
* taking overriding into account.
119+
* taking virtual dispatch into account.
119120
*/
120121
predicate polyCalls(Callable m) {
121122
this.calls(m)
122123
or
123-
exists(Method mSuper, VirtualMethodAccess c | c.getCaller() = this and c.getMethod() = mSuper |
124-
m.(Method).overrides(mSuper)
124+
exists(Call call |
125+
call.getCaller() = this and
126+
viableCallable(call) = m
125127
)
126128
}
127129

0 commit comments

Comments
 (0)