IDEA-370048 Stream trace debugging does not show the traces for the gatherers and toList method - toList support

GitOrigin-RevId: 8758ddf107d8bd9e028743ba8d9592f239d22bed
This commit is contained in:
Egor Ushakov
2025-04-11 13:34:31 +00:00
committed by intellij-monorepo-bot
parent 20550e6223
commit 7c641351b6
5 changed files with 57 additions and 3 deletions
@@ -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"))
}
}
@@ -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);
}
}
@@ -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
}
@@ -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
@@ -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();
}
}