Skip to content

Commit 9a04124

Browse files
author
Stephan Brandauer
committed
Java: fine-tune characteristics
1 parent f224a40 commit 9a04124

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

java/ql/src/Telemetry/AutomodelApplicationModeCharacteristics.qll

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,20 +269,23 @@ private class ClassQualifierCharacteristic extends CharacteristicsImpl::NotASink
269269
* A characteristic that limits candidates to parameters of methods that are recognized as `ModelApi`, iow., APIs that
270270
* are considered worth modeling.
271271
*/
272-
private class NotAModelApiParameter extends CharacteristicsImpl::UninterestingToModelCharacteristic {
273-
NotAModelApiParameter() { this = "not a model API parameter" }
272+
private class ArgumentToLocalCall extends CharacteristicsImpl::UninterestingToModelCharacteristic {
273+
ArgumentToLocalCall() { this = "argument to local call" }
274274

275275
override predicate appliesToEndpoint(Endpoint e) {
276-
not exists(ModelExclusions::ModelApi api |
277-
exists(Call c |
278-
c.getCallee() = api and
279-
exists(int argIdx | exists(api.getParameter(argIdx)) |
280-
argIdx = -1 and e.asExpr() = c.getQualifier()
281-
or
282-
e.asExpr() = c.getArgument(argIdx)
283-
)
284-
)
285-
)
276+
ApplicationCandidatesImpl::getCallable(e).fromSource()
277+
}
278+
}
279+
280+
/**
281+
* A Characteristic that marks endpoints as uninteresting to model, according to the Java ModelExclusions module.
282+
*/
283+
private class ExcludedFromModeling extends CharacteristicsImpl::UninterestingToModelCharacteristic {
284+
ExcludedFromModeling() { this = "excluded from modeling" }
285+
286+
override predicate appliesToEndpoint(Endpoint e) {
287+
ModelExclusions::isUninterestingForModels(ApplicationCandidatesImpl::getCallable(e)) or
288+
ModelExclusions::isUninterestingForModels(e.getEnclosingCallable())
286289
}
287290
}
288291

0 commit comments

Comments
 (0)