Java: Update polyCalls to use virtual dispatch.

This commit is contained in:
Anders Schack-Mulligen
2019-05-14 15:36:12 +02:00
parent bb67ac9ad1
commit f9e4512f32

View File

@@ -8,6 +8,7 @@ import Type
import Annotation
import Exception
import metrics.MetricField
private import dispatch.VirtualDispatch
/**
* A common abstraction for type member declarations,
@@ -115,13 +116,14 @@ class Callable extends StmtParent, Member, @callable {
/**
* Holds if this callable may call the specified callable,
* taking overriding into account.
* taking virtual dispatch into account.
*/
predicate polyCalls(Callable m) {
this.calls(m)
or
exists(Method mSuper, VirtualMethodAccess c | c.getCaller() = this and c.getMethod() = mSuper |
m.(Method).overrides(mSuper)
exists(Call call |
call.getCaller() = this and
viableCallable(call) = m
)
}