diff --git a/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/impl/StandardLibrarySupport.kt b/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/impl/StandardLibrarySupport.kt index 4e0c552fe392..74b188a07086 100644 --- a/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/impl/StandardLibrarySupport.kt +++ b/plugins/stream-debugger/src/com/intellij/debugger/streams/lib/impl/StandardLibrarySupport.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.debugger.streams.lib.impl import com.intellij.debugger.streams.core.lib.impl.* @@ -44,6 +44,7 @@ class StandardLibrarySupport OptionalResultOperation("findAny"), OptionalResultOperation("findFirst"), ToCollectionOperation("toArray"), + ToCollectionOperation("toList"), ToCollectionOperation("collect")) } } \ No newline at end of file diff --git a/plugins/stream-debugger/test/com/intellij/debugger/streams/exec/SpecialCasesTest.java b/plugins/stream-debugger/test/com/intellij/debugger/streams/exec/SpecialCasesTest.java index b4721b698729..6e27acca6717 100644 --- a/plugins/stream-debugger/test/com/intellij/debugger/streams/exec/SpecialCasesTest.java +++ b/plugins/stream-debugger/test/com/intellij/debugger/streams/exec/SpecialCasesTest.java @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.debugger.streams.exec; import com.intellij.debugger.streams.test.TraceExecutionTestCase; @@ -39,4 +39,8 @@ public class SpecialCasesTest extends TraceExecutionTestCase { public void testToCollection() { doTest(false); } + + public void testToList() { + doTest(false); + } } diff --git a/plugins/stream-debugger/test/com/intellij/debugger/streams/test/TraceExecutionTestCase.kt b/plugins/stream-debugger/test/com/intellij/debugger/streams/test/TraceExecutionTestCase.kt index 5084cc372c46..44bdd46a8e15 100644 --- a/plugins/stream-debugger/test/com/intellij/debugger/streams/test/TraceExecutionTestCase.kt +++ b/plugins/stream-debugger/test/com/intellij/debugger/streams/test/TraceExecutionTestCase.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.debugger.streams.test import com.intellij.debugger.DebuggerTestCase @@ -16,6 +16,8 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.PluginPathManager import com.intellij.openapi.application.runInEdt import com.intellij.openapi.diagnostic.Logger +import com.intellij.pom.java.LanguageLevel +import com.intellij.testFramework.IdeaTestUtil import com.intellij.testFramework.SkipSlowTestLocally import com.intellij.testFramework.runInEdtAndWait import com.intellij.util.Producer @@ -47,6 +49,11 @@ abstract class TraceExecutionTestCase : DebuggerTestCase() { } } + override fun setUpModule() { + super.setUpModule() + IdeaTestUtil.setModuleLanguageLevel(myModule, LanguageLevel.JDK_16) + } + protected open fun replaceAdditionalInOutput(str: String): String { return str } diff --git a/plugins/stream-debugger/testData/debug/outs/toList.out b/plugins/stream-debugger/testData/debug/outs/toList.out new file mode 100644 index 000000000000..c6a64de49a7d --- /dev/null +++ b/plugins/stream-debugger/testData/debug/outs/toList.out @@ -0,0 +1,34 @@ +LineBreakpoint created at ToList.java:6 +!JDK_HOME!\bin\java -agentlib:jdwp=transport=dt_socket,address=!HOST_NAME!:!HOST_PORT!,suspend=y,server=n -Dfile.encoding=!FILE_ENCODING! -classpath !OUTPUT_PATH!;!RT_JAR! ToList +Connected to the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' +ToList.java:6 +Stream.of(1, 2, 3, 4, 5, 6) +.filter(x -> x < 3) +.toList() +filter + before: 1,3,5,6,7,8 + after: 2,4 +toList + before: 2,4 + after: 9,10 +mappings for filter + direct: + 1 -> 2 + 3 -> 4 + 5 -> nothing + 6 -> nothing + 7 -> nothing + 8 -> nothing + reverse: + 1 <- 2 + 3 <- 4 +mappings for toList + direct: + 2 -> 9 + 4 -> 10 + reverse: + 2 <- 9 + 4 <- 10 +Disconnected from the target VM, address: '!HOST_NAME!:PORT_NAME!', transport: 'socket' + +Process finished with exit code 0 diff --git a/plugins/stream-debugger/testData/debug/src/ToList.java b/plugins/stream-debugger/testData/debug/src/ToList.java new file mode 100644 index 000000000000..35881756fe0b --- /dev/null +++ b/plugins/stream-debugger/testData/debug/src/ToList.java @@ -0,0 +1,8 @@ +import java.util.stream.Stream; + +public class ToList { + public static void main(String[] args) { + // Breakpoint! + Stream.of(1, 2, 3, 4, 5, 6).filter(x -> x < 3).toList(); + } +}