Skip to content

Commit 7c72ece

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Java: update genVsMan coverage query to use ModelApi instead of DataFlowTargetApi
1 parent 9828ad0 commit 7c72ece

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

java/ql/src/Metrics/Summaries/GeneratedVsManualCoverageQuery.qll

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
private import semmle.code.java.dataflow.FlowSummary
2-
private import utils.modelgenerator.internal.CaptureModels
2+
private import semmle.code.java.dataflow.internal.ModelExclusions
33
private import TopJdkApis
44

55
/**
6-
* Returns the number of `DataFlowTargetApi`s with Summary MaD models
6+
* Returns the number of `ModelApi`s with Summary MaD models
77
* for a given package and provenance.
88
*/
99
bindingset[package, apiSubset]
@@ -13,7 +13,7 @@ private int getNumMadModeledApis(string package, string provenance, string apiSu
1313
count(SummarizedCallable sc |
1414
callableSubset(sc.asCallable(), apiSubset) and
1515
package = sc.asCallable().getCompilationUnit().getPackage().getName() and
16-
sc.asCallable() instanceof DataFlowTargetApi and
16+
sc.asCallable() instanceof ModelApi and
1717
(
1818
// "auto-only"
1919
not sc.hasManualModel() and
@@ -34,12 +34,12 @@ private int getNumMadModeledApis(string package, string provenance, string apiSu
3434
)
3535
}
3636

37-
/** Returns the total number of `DataFlowTargetApi`s for a given package. */
37+
/** Returns the total number of `ModelApi`s for a given package. */
3838
private int getNumApis(string package, string apiSubset) {
3939
result =
40-
strictcount(DataFlowTargetApi dataFlowTargApi |
41-
callableSubset(dataFlowTargApi, apiSubset) and
42-
package = dataFlowTargApi.getCompilationUnit().getPackage().getName()
40+
strictcount(ModelApi api |
41+
callableSubset(api, apiSubset) and
42+
package = api.getCompilationUnit().getPackage().getName()
4343
)
4444
}
4545

@@ -70,7 +70,7 @@ predicate modelCoverageGenVsMan(
7070
// calculate the total generated and total manual numbers
7171
generated = generatedOnly + both and
7272
manual = manualOnly + both and
73-
// count the total number of `DataFlowTargetApi`s for each package
73+
// count the total number of `ModelApi`s for each package
7474
all = getNumApis(package, apiSubset) and
7575
non = all - (generatedOnly + both + manualOnly) and
7676
// Proportion of coverage

0 commit comments

Comments
 (0)