diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA144840.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA144840.java new file mode 100644 index 000000000000..9b261d2da2c8 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA144840.java @@ -0,0 +1,34 @@ + +import java.math.BigDecimal; +import java.util.Map; +import java.util.Optional; +import java.util.function.BiFunction; +import java.util.stream.Stream; + +class Test { + private Map, BiFunction> spec = null; + + public Optional fooIn2(Map> values) { + return values.entrySet().stream().map(entry -> { + String pathName = entry.getKey(); + return entry.getValue().flatMap(value -> + spec.entrySet().stream().filter(specEntry -> + pathName.equals(specEntry.getKey().getLeft())).findFirst().map(specEntry -> { + Pair specEntryKey = specEntry.getKey(); + Number path = specEntryKey.getRight(); + BiFunction compareFunction = specEntry.getValue(); + return compareFunction.apply(path, value); + })); + }).flatMap(option -> option.map(Stream::of).orElse(Stream.empty())).reduce(BigDecimal::add); + } + + static class Pair { + public A getLeft() { + return null; + } + + public B getRight() { + return null; + } + } +} diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java index 2c5bea8ba62a..33242381ec35 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/NewLambdaHighlightingTest.java @@ -228,6 +228,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase { doTest(); } + public void testIDEA144840() throws Exception { + doTest(); + } + private void doTest() { doTest(false); }