Skip to content

Commit bb97df1

Browse files
committed
do not generate models for lambda flow methods
1 parent bbf3fa7 commit bb97df1

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

java/ql/lib/semmle/code/java/dataflow/internal/ModelExclusions.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,26 @@ private predicate isInternal(CompilationUnit cu) {
5959
cu.getPackage().getName().matches("%internal%")
6060
}
6161

62+
/** A method relating to lambda flow. */
63+
private class LambdaFlowMethod extends Method {
64+
LambdaFlowMethod() {
65+
this.hasQualifiedName("java.lang", "Runnable", "run") or
66+
this.hasQualifiedName("java.util", "Comparator", "comparing") or
67+
this.hasQualifiedName("java.util.function", "BiConsumer", "accept") or
68+
this.hasQualifiedName("java.util.function", "BiFunction", "apply") or
69+
this.hasQualifiedName("java.util.function", "Consumer", "accept") or
70+
this.hasQualifiedName("java.util.function", "Function", "apply") or
71+
this.hasQualifiedName("java.util.function", "Supplier", "get")
72+
}
73+
}
74+
6275
/** Holds if the given callable is not worth modeling. */
6376
predicate isUninterestingForModels(Callable c) {
6477
isInTestFile(c.getCompilationUnit().getFile()) or
6578
isInternal(c.getCompilationUnit()) or
6679
c instanceof MainMethod or
6780
c instanceof ToStringMethod or
81+
c instanceof LambdaFlowMethod or
6882
c instanceof StaticInitializer or
6983
exists(FunctionalExpr funcExpr | c = funcExpr.asMethod()) or
7084
c.getDeclaringType() instanceof TestLibrary or

0 commit comments

Comments
 (0)