Java: add test for spurious flow from path graph deduplication

This commit is contained in:
Asger F
2023-10-11 14:06:32 +02:00
parent 8efdc2df7b
commit 0eb543e0a9
3 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
import java.util.function.Function;
class A {
String source() { return ""; }
void sink(String s) { }
String propagateState(String s, String state) {
return "";
}
void foo() {
Function<String, String> lambda = Math.random() > 0.5
? x -> propagateState(x, "A")
: x -> propagateState(x, "B");
String step0 = source();
String step1 = lambda.apply(step0);
String step2 = lambda.apply(step1);
sink(step2);
}
void bar() {
Function<String, String> lambda =
(x -> Math.random() > 0.5 ? propagateState(x, "A") : propagateState(x, "B"));
String step0 = source();
String step1 = lambda.apply(step0);
String step2 = lambda.apply(step1);
sink(step2);
}
}