9
9
//import java // not needed I guess
10
10
import semmle.code.java.dataflow.FlowSummary // for SummarizedCallable
11
11
import utils.modelgenerator.internal.CaptureModels // for DataFlowTargetApi
12
+ import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl // for NegativeSummarizedCallable
12
13
13
14
// ! improve QLDoc?
14
15
/**
@@ -53,8 +54,8 @@ float getNumMadModels(string package, string provenance) {
53
54
54
55
// ! move to other file
55
56
/**
56
- * Returns the number of APIs without MaD
57
- * models for a given package.
57
+ * Returns the number of APIs without SummarizedCallables
58
+ * (MaD models) for a given package.
58
59
*/
59
60
float getNumApisWithoutMadModel ( string package ) {
60
61
exists ( DataFlowTargetApi dataFlowTargApi |
@@ -63,21 +64,40 @@ float getNumApisWithoutMadModel(string package) {
63
64
result =
64
65
count ( DataFlowTargetApi d |
65
66
package = d .getDeclaringType ( ) .getPackage ( ) .toString ( ) and
66
- not exists ( SummarizedCallable sc | d = sc .asCallable ( ) )
67
+ not exists ( MadModeledCallable sc | d = sc .asCallable ( ) )
67
68
)
68
69
)
69
70
}
70
71
72
+ /**
73
+ * Returns the total number of APIs for a given package.
74
+ */
75
+ float getNumApis ( string package ) {
76
+ exists ( DataFlowTargetApi dataFlowTargApi |
77
+ package = dataFlowTargApi .getDeclaringType ( ) .getPackage ( ) .toString ( )
78
+ |
79
+ result = count ( DataFlowTargetApi d | package = d .getDeclaringType ( ) .getPackage ( ) .toString ( ) )
80
+ )
81
+ }
82
+
71
83
from
72
84
string package , float generatedOnly , float both , float manualOnly , float non , float all ,
73
85
float generatedCoverage , float manualCoverage
74
86
where
75
87
generatedOnly = getNumMadModels ( package , "generated" ) and
76
88
manualOnly = getNumMadModels ( package , "manual" ) and
77
89
both = getNumMadModels ( package , "both" ) and
78
- non = getNumApisWithoutMadModel ( package ) and // ! edit this
79
- all = generatedOnly + both + manualOnly + non and
90
+ // non = getNumApisWithoutMadModel(package) and
91
+ // all = generatedOnly + both + manualOnly + non and
92
+ all = getNumApis ( package ) and
93
+ non = all - ( generatedOnly + both + manualOnly ) and
80
94
generatedCoverage = ( both / ( both + manualOnly ) ) and // Proportion of manual models covered by generated ones
81
95
manualCoverage = ( both / ( both + generatedOnly ) ) // Proportion of generated models covered by manual ones
82
96
select package , generatedOnly , both , manualOnly , non , all , generatedCoverage , manualCoverage
83
97
order by package
98
+ // * "all" and "none" tests
99
+ // from string package, float num
100
+ // where num = getNumApis(package) // allY2 = DFTAs
101
+ // // where num = getNumModeledApis(package) // allY1 = api that has either a positive or negative model
102
+ // // where num = getNumApisWithoutMadModel(package) // noneY2 = DFTAs \ SCs
103
+ // select package, num order by package
0 commit comments