diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA125254.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA125254.java new file mode 100644 index 000000000000..4d74d1424cc3 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/newLambda/IDEA125254.java @@ -0,0 +1,103 @@ +import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.function.BiFunction; + +class Scratch +{ + public static void main(String[] args) + { + final ExecutorService threadPool = Executors.newCachedThreadPool(); + final List events = new ArrayList<>(); + final SoapInterface soap = new SoapInterface(); + + events.stream() + .map(event -> get(event).apply(soap, event)) + .map(threadPool::submit) + .forEachOrdered(future -> { + try + { + if (! future.get().isError()) + { + + } + else + { + ; + } + } + catch (InterruptedException | ExecutionException e) + { + e.printStackTrace(); + } + }); + } + + public static BiFunction>> get(Object o) + { + return (soap, event) -> toEither( + () -> { + return "value"; + } + ); + } + + private static Callable> toEither(Callable callable) + { + return () -> { + try + { + return Either.value(callable.call()); + } + catch (Exception e) + { + return Either.error(e); + } + }; + } + + public static class EventObject { } + + public static class SoapInterface { } + + public static class Either + { + private V value; + + private E error; + + private Either(V value, E error) + { + this.value = value; + this.error = error; + } + + public static Either value(V value) + { + return new Either<>(value, null); + } + + public static Either error(E error) + { + return new Either<>(null, error); + } + + public V getValue() + { + return value; + } + + public E getError() + { + return error; + } + + public boolean isError() + { + return error != null; + } + } +} \ No newline at end of file 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 f5e6a651f167..13cb81499ff2 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 @@ -226,6 +226,10 @@ public class NewLambdaHighlightingTest extends LightDaemonAnalyzerTestCase { doTest(); } + public void testIDEA125254() throws Exception { + doTest(); + } + private void doTest() { doTest(false); }