@@ -11,31 +11,24 @@ import semmle.code.java.dataflow.FlowSummary
1111import utils.modelgenerator.internal.CaptureModels
1212
1313/**
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 .
1616 */
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. */
2517bindingset [ package]
26- private float getNumApisWithMadModels ( string package , string provenance ) {
18+ private float getNumMadModeledApis ( string package , string provenance ) {
2719 provenance in [ "generated" , "manual" , "both" ] and
2820 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
3124 (
32- mc . ( SummarizedCallable ) .isAutoGenerated ( ) and // "auto-only"
25+ sc .isAutoGenerated ( ) and // "auto-only"
3326 provenance = "generated"
3427 or
35- mc . ( SummarizedCallable ) .isManuallyGenerated ( ) and // "manual-only"
28+ sc .isManuallyGenerated ( ) and // "manual-only"
3629 provenance = "manual"
3730 or
38- mc . ( SummarizedCallable ) .isBothAutoAndManuallyGenerated ( ) and // "both"
31+ sc .isBothAutoAndManuallyGenerated ( ) and // "both"
3932 provenance = "both"
4033 )
4134 )
5548 float manualOnly , float non , float all , float generatedCoverage , float manualCoverage
5649where
5750 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
6154 all = getNumApis ( package ) and
6255 non = all - ( generatedOnly + both + manualOnly ) and
6356 generatedCoverage = ( both / ( both + manualOnly ) ) and // Proportion of manual models covered by generated ones
0 commit comments