Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions java/ql/consistency-queries/DataFlowConsistency.ql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import semmle.code.java.dataflow.internal.DataFlowImplConsistency::Consistency
20 changes: 20 additions & 0 deletions java/ql/lib/semmle/code/java/dataflow/FlowSummary.qll
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ class SummarizedCallableBase extends TSummarizedCallableBase {
or
pos = -1 and result = this.asCallable().getDeclaringType()
or
hasOverloadWithParameter(this.asCallable(), pos) and
result instanceof TypeObject
or
result = this.asSyntheticCallable().getParameterType(pos)
or
exists(SyntheticCallable sc | sc = this.asSyntheticCallable() |
Expand All @@ -169,6 +172,23 @@ class SummarizedCallableBase extends TSummarizedCallableBase {
}
}

private predicate hasOverload(string package, string type, string name) {
2 <= strictcount(Callable c | c.hasQualifiedName(package, type, name))
}

private predicate maxOverloadArity(string package, string type, string name, int arity) {
hasOverload(package, type, name) and
arity = max(int p | exists(Callable c | c.hasQualifiedName(package, type, name) and p = c.getNumberOfParameters()))
}

private predicate hasOverloadWithParameter(Callable c, int pos) {
exists(string package, string type, string name, int arity |
c.hasQualifiedName(package, type, name) and
maxOverloadArity(package, type, name, arity) and
pos = [c.getNumberOfParameters().. arity - 1]
)
}

class SummarizedCallable = Impl::Public::SummarizedCallable;

class NeutralCallable = Impl::Public::NeutralCallable;
Expand Down