Skip to content

Commit 9b30f9a

Browse files
tausbnStephan Brandauer
authored andcommitted
Java: Add negative characteristic for static calls
1 parent 6fc1657 commit 9b30f9a

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

java/ql/src/Telemetry/AutomodelApplicationModeCharacteristics.qll

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,21 @@ private class NonPublicMethodCharacteristic extends CharacteristicsImpl::Uninter
290290
}
291291
}
292292

293+
/**
294+
* A negative characteristic that filters out qualifiers that are classes (i.e. static calls). These
295+
*are unlikely to have any non-trivial flow going into them.
296+
*/
297+
private class ClassQualifierCharacteristic extends CharacteristicsImpl::NotASinkCharacteristic {
298+
ClassQualifierCharacteristic() { this = "class qualifier" }
299+
300+
override predicate appliesToEndpoint(Endpoint e) {
301+
exists(Call c |
302+
e.asExpr() = c.getQualifier() and
303+
c.getCallee().isStatic()
304+
)
305+
}
306+
}
307+
293308
/**
294309
* Holds if the given endpoint has a self-contradictory combination of characteristics. Detects errors in our endpoint
295310
* characteristics. Lists the problematic characteristics and their implications for all such endpoints, together with

0 commit comments

Comments
 (0)