mirror of
https://github.com/github/codeql.git
synced 2025-12-21 19:26:31 +01:00
Intermediate interfaces don't need interface forwarders, since the Kotlin compiler won't try to make them non-abstract by synthesising methods. Super references should always target an immediate superclass, not the ancestor containing the intended implementation.
37 lines
1.0 KiB
Plaintext
37 lines
1.0 KiB
Plaintext
import java
|
|
import semmle.code.java.dataflow.DataFlow
|
|
|
|
query predicate callables(Callable c, RefType declType, string kind) {
|
|
c.fromSource() and
|
|
declType = c.getDeclaringType() and
|
|
(
|
|
kind = c.compilerGeneratedReason()
|
|
or
|
|
not exists(c.compilerGeneratedReason()) and kind = "from source"
|
|
)
|
|
}
|
|
|
|
query predicate superAccesses(
|
|
SuperAccess sa, RefType enclosingType, Callable enclosingCallable, Expr qualifier
|
|
) {
|
|
sa.getQualifier() = qualifier and
|
|
enclosingCallable = sa.getEnclosingCallable() and
|
|
enclosingType = enclosingCallable.getDeclaringType()
|
|
}
|
|
|
|
class Config extends DataFlow::Configuration {
|
|
Config() { this = "testconfig" }
|
|
|
|
override predicate isSource(DataFlow::Node x) {
|
|
x.asExpr() instanceof IntegerLiteral and x.getEnclosingCallable().fromSource()
|
|
}
|
|
|
|
override predicate isSink(DataFlow::Node x) {
|
|
x.asExpr().(Argument).getCall().getCallee().getName() = "sink"
|
|
}
|
|
}
|
|
|
|
from Config c, DataFlow::Node source, DataFlow::Node sink
|
|
where c.hasFlow(source, sink)
|
|
select source, sink
|