5
5
private import java as J
6
6
private import semmle.code.java.dataflow.internal.DataFlowPrivate
7
7
private import semmle.code.java.dataflow.internal.ContainerFlow as ContainerFlow
8
+ private import semmle.code.java.dataflow.internal.ModelExclusions
8
9
private import semmle.code.java.dataflow.DataFlow as Df
9
10
private import semmle.code.java.dataflow.SSA as Ssa
10
11
private import semmle.code.java.dataflow.TaintTracking as Tt
@@ -26,33 +27,6 @@ private J::Method superImpl(J::Method m) {
26
27
not m instanceof J:: ToStringMethod
27
28
}
28
29
29
- private predicate isInTestFile ( J:: File file ) {
30
- file .getAbsolutePath ( ) .matches ( [ "%/test/%" , "%/guava-tests/%" , "%/guava-testlib/%" ] ) and
31
- not file .getAbsolutePath ( ) .matches ( "%/ql/test/%" ) // allows our test cases to work
32
- }
33
-
34
- private predicate isJdkInternal ( J:: CompilationUnit cu ) {
35
- cu .getPackage ( ) .getName ( ) .matches ( "org.graalvm%" ) or
36
- cu .getPackage ( ) .getName ( ) .matches ( "com.sun%" ) or
37
- cu .getPackage ( ) .getName ( ) .matches ( "sun%" ) or
38
- cu .getPackage ( ) .getName ( ) .matches ( "jdk%" ) or
39
- cu .getPackage ( ) .getName ( ) .matches ( "java2d%" ) or
40
- cu .getPackage ( ) .getName ( ) .matches ( "build.tools%" ) or
41
- cu .getPackage ( ) .getName ( ) .matches ( "propertiesparser%" ) or
42
- cu .getPackage ( ) .getName ( ) .matches ( "org.jcp%" ) or
43
- cu .getPackage ( ) .getName ( ) .matches ( "org.w3c%" ) or
44
- cu .getPackage ( ) .getName ( ) .matches ( "org.ietf.jgss%" ) or
45
- cu .getPackage ( ) .getName ( ) .matches ( "org.xml.sax%" ) or
46
- cu .getPackage ( ) .getName ( ) .matches ( "com.oracle%" ) or
47
- cu .getPackage ( ) .getName ( ) .matches ( "org.omg%" ) or
48
- cu .getPackage ( ) .getName ( ) .matches ( "org.relaxng%" ) or
49
- cu .getPackage ( ) .getName ( ) = "compileproperties" or
50
- cu .getPackage ( ) .getName ( ) = "transparentruler" or
51
- cu .getPackage ( ) .getName ( ) = "genstubs" or
52
- cu .getPackage ( ) .getName ( ) = "netscape.javascript" or
53
- cu .getPackage ( ) .getName ( ) = ""
54
- }
55
-
56
30
private predicate isInfrequentlyUsed ( J:: CompilationUnit cu ) {
57
31
cu .getPackage ( ) .getName ( ) .matches ( "javax.swing%" ) or
58
32
cu .getPackage ( ) .getName ( ) .matches ( "java.awt%" )
@@ -62,13 +36,8 @@ private predicate isInfrequentlyUsed(J::CompilationUnit cu) {
62
36
* Holds if it is relevant to generate models for `api`.
63
37
*/
64
38
private predicate isRelevantForModels ( J:: Callable api ) {
65
- not isInTestFile ( api .getCompilationUnit ( ) .getFile ( ) ) and
66
- not isJdkInternal ( api .getCompilationUnit ( ) ) and
67
- not isInfrequentlyUsed ( api .getCompilationUnit ( ) ) and
68
- not api instanceof J:: MainMethod and
69
- not api instanceof J:: StaticInitializer and
70
- not exists ( J:: FunctionalExpr funcExpr | api = funcExpr .asMethod ( ) ) and
71
- not api .( J:: Constructor ) .isParameterless ( )
39
+ not isUninterestingForModels ( api ) and
40
+ not isInfrequentlyUsed ( api .getCompilationUnit ( ) )
72
41
}
73
42
74
43
/**
0 commit comments