do not generate models for lambda flow methods

This commit is contained in:
Owen Mansel-Chan
2024-03-01 12:11:40 +00:00
parent bbf3fa7506
commit bb97df1d71

View File

@@ -59,12 +59,26 @@ private predicate isInternal(CompilationUnit cu) {
cu.getPackage().getName().matches("%internal%")
}
/** A method relating to lambda flow. */
private class LambdaFlowMethod extends Method {
LambdaFlowMethod() {
this.hasQualifiedName("java.lang", "Runnable", "run") or
this.hasQualifiedName("java.util", "Comparator", "comparing") or
this.hasQualifiedName("java.util.function", "BiConsumer", "accept") or
this.hasQualifiedName("java.util.function", "BiFunction", "apply") or
this.hasQualifiedName("java.util.function", "Consumer", "accept") or
this.hasQualifiedName("java.util.function", "Function", "apply") or
this.hasQualifiedName("java.util.function", "Supplier", "get")
}
}
/** Holds if the given callable is not worth modeling. */
predicate isUninterestingForModels(Callable c) {
isInTestFile(c.getCompilationUnit().getFile()) or
isInternal(c.getCompilationUnit()) or
c instanceof MainMethod or
c instanceof ToStringMethod or
c instanceof LambdaFlowMethod or
c instanceof StaticInitializer or
exists(FunctionalExpr funcExpr | c = funcExpr.asMethod()) or
c.getDeclaringType() instanceof TestLibrary or