From 3d70f91b9fe00881ab8c36f295af50a339631604 Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Wed, 23 Oct 2024 09:29:15 +0200 Subject: [PATCH 1/2] Java: Add manual models for various mapToObj methods. --- java/ql/lib/ext/java.util.stream.model.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/java/ql/lib/ext/java.util.stream.model.yml b/java/ql/lib/ext/java.util.stream.model.yml index 32438ab19567..68cde91a5a85 100644 --- a/java/ql/lib/ext/java.util.stream.model.yml +++ b/java/ql/lib/ext/java.util.stream.model.yml @@ -9,6 +9,9 @@ extensions: - ["java.util.stream", "BaseStream", True, "sequential", "()", "", "Argument[this].Element", "ReturnValue.Element", "value", "manual"] - ["java.util.stream", "BaseStream", True, "spliterator", "()", "", "Argument[this].Element", "ReturnValue.Element", "value", "manual"] - ["java.util.stream", "BaseStream", True, "unordered", "()", "", "Argument[this].Element", "ReturnValue.Element", "value", "manual"] + - ["java.util.stream", "DoubleStream", True, "mapToObj", "(IntFunction)", "", "Argument[0].ReturnValue", "ReturnValue.Element", "value", "manual"] + - ["java.util.stream", "IntStream", True, "mapToObj", "(IntFunction)", "", "Argument[0].ReturnValue", "ReturnValue.Element", "value", "manual"] + - ["java.util.stream", "LongStream", True, "mapToObj", "(IntFunction)", "", "Argument[0].ReturnValue", "ReturnValue.Element", "value", "manual"] - ["java.util.stream", "Stream", True, "allMatch", "(Predicate)", "", "Argument[this].Element", "Argument[0].Parameter[0]", "value", "manual"] - ["java.util.stream", "Stream", True, "anyMatch", "(Predicate)", "", "Argument[this].Element", "Argument[0].Parameter[0]", "value", "manual"] - ["java.util.stream", "Stream", True, "collect", "(Supplier,BiConsumer,BiConsumer)", "", "Argument[this].Element", "Argument[1].Parameter[1]", "value", "manual"] @@ -101,5 +104,4 @@ extensions: # The below APIs have numeric flow and are currently being stored as neutral models. # These may be changed to summary models with kinds "value-numeric" and "taint-numeric" (or similar) in the future. - - ["java.util.stream", "IntStream", "mapToObj", "(IntFunction)", "summary", "manual"] # taint-numeric - ["java.util.stream", "IntStream", "range", "(int,int)", "summary", "manual"] # taint-numeric From caa08046b63be51d1075e991f0ffa4b80280adbe Mon Sep 17 00:00:00 2001 From: Michael Nebel Date: Wed, 23 Oct 2024 09:29:29 +0200 Subject: [PATCH 2/2] Java: Update expected test output. --- .../TopJdkApisTest/TopJdkApisTest.expected | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/ql/test/query-tests/Metrics/GeneratedVsManualCoverage/TopJdkApisTest/TopJdkApisTest.expected b/java/ql/test/query-tests/Metrics/GeneratedVsManualCoverage/TopJdkApisTest/TopJdkApisTest.expected index 64748f777659..6f7f461973ae 100644 --- a/java/ql/test/query-tests/Metrics/GeneratedVsManualCoverage/TopJdkApisTest/TopJdkApisTest.expected +++ b/java/ql/test/query-tests/Metrics/GeneratedVsManualCoverage/TopJdkApisTest/TopJdkApisTest.expected @@ -20,4 +20,4 @@ | java.util.function | 0 | 0 | 0 | 1 | 1 | 0.0 | 0.0 | 0.0 | NaN | NaN | 1.0 | | java.util.logging | 0 | 0 | 1 | 1 | 2 | 0.5 | 0.0 | 0.5 | 0.0 | NaN | 0.5 | | java.util.regex | 0 | 0 | 3 | 1 | 4 | 0.75 | 0.0 | 0.75 | 0.0 | NaN | 0.25 | -| java.util.stream | 0 | 0 | 18 | 8 | 26 | 0.6923076923076923 | 0.0 | 0.6923076923076923 | 0.0 | NaN | 0.3076923076923077 | +| java.util.stream | 0 | 0 | 19 | 7 | 26 | 0.7307692307692307 | 0.0 | 0.7307692307692307 | 0.0 | NaN | 0.2692307692307692 |