@@ -11,31 +11,24 @@ import semmle.code.java.dataflow.FlowSummary
11
11
import utils.modelgenerator.internal.CaptureModels
12
12
13
13
/**
14
- * A callable with a Summary MaD model. Specifically, this callable is
15
- * the intersection of DataFlowTargetApis and SummarizedCallables .
14
+ * Returns the number of `DataFlowTargetApi`s with Summary MaD models
15
+ * for a given package and provenance .
16
16
*/
17
- private class MadModeledCallable extends SummarizedCallableBase {
18
- MadModeledCallable ( ) {
19
- this instanceof SummarizedCallable and
20
- exists ( DataFlowTargetApi dataFlowTargApi | this .asCallable ( ) = dataFlowTargApi )
21
- }
22
- }
23
-
24
- /** Returns the number of APIs with Summary MaD models for a given package and provenance. */
25
17
bindingset [ package]
26
- private float getNumApisWithMadModels ( string package , string provenance ) {
18
+ private float getNumMadModeledApis ( string package , string provenance ) {
27
19
provenance in [ "generated" , "manual" , "both" ] and
28
20
result =
29
- count ( MadModeledCallable mc |
30
- package = mc .asCallable ( ) .getDeclaringType ( ) .getPackage ( ) .toString ( ) and
21
+ count ( SummarizedCallable sc |
22
+ package = sc .asCallable ( ) .getDeclaringType ( ) .getPackage ( ) .toString ( ) and
23
+ exists ( DataFlowTargetApi dataFlowTargApi | sc .asCallable ( ) = dataFlowTargApi ) and
31
24
(
32
- mc . ( SummarizedCallable ) .isAutoGenerated ( ) and // "auto-only"
25
+ sc .isAutoGenerated ( ) and // "auto-only"
33
26
provenance = "generated"
34
27
or
35
- mc . ( SummarizedCallable ) .isManuallyGenerated ( ) and // "manual-only"
28
+ sc .isManuallyGenerated ( ) and // "manual-only"
36
29
provenance = "manual"
37
30
or
38
- mc . ( SummarizedCallable ) .isBothAutoAndManuallyGenerated ( ) and // "both"
31
+ sc .isBothAutoAndManuallyGenerated ( ) and // "both"
39
32
provenance = "both"
40
33
)
41
34
)
55
48
float manualOnly , float non , float all , float generatedCoverage , float manualCoverage
56
49
where
57
50
package = dataFlowTargApi .getDeclaringType ( ) .getPackage ( ) .toString ( ) and
58
- generatedOnly = getNumApisWithMadModels ( package , "generated" ) and
59
- manualOnly = getNumApisWithMadModels ( package , "manual" ) and
60
- both = getNumApisWithMadModels ( package , "both" ) and
51
+ generatedOnly = getNumMadModeledApis ( package , "generated" ) and
52
+ manualOnly = getNumMadModeledApis ( package , "manual" ) and
53
+ both = getNumMadModeledApis ( package , "both" ) and
61
54
all = getNumApis ( package ) and
62
55
non = all - ( generatedOnly + both + manualOnly ) and
63
56
generatedCoverage = ( both / ( both + manualOnly ) ) and // Proportion of manual models covered by generated ones
0 commit comments