Debug Shell Evaluation Failure with Stream Processing [message #1824303] |
Mon, 13 April 2020 16:05 |
David Eisner Messages: 32 Registered: July 2009 |
Member |
|
|
Consider this simple demo:
package scratch;
import java.util.Arrays;
import java.util.List;
public class DebugShellDemo {
public static void main(String... args) {
List<String> strs = Arrays.asList("one", "two", "three");
strs.stream().forEach(System.out::println); // breakpoint here
}
}
This code runs without error. But if I run it in the debugger and break at the indicated line, and then try to execute that line in the Debug Shell, I get this error:
strs.stream().forEach(System.out::println)
Evaluation failed. Reason(s):
[Marker [on: /, id: 269688, type: org.eclipse.jdt.core.transient_problem, attributes: [charEnd: 67, charStart: 63, id: 33554502, lineNumber: 1, message: java cannot be resolved or is not a field, severity: 2, sourceId: JDT], created: 4/13/20, 9:03 AM]]
Everything else seems to be OK -- autocomplete works, for example, and if I instead evaluate a stream pipeline with a collector, I get the expected result:
strs.stream().map(e -> e).collect(java.util.stream.Collectors.toList())
(java.util.ArrayList<E>) [one, two, three]
Am I doing something wrong, or is this a bug?
I'm using Eclipse 2020-03 on macOS 10.15.4, but this also happens in Windows 10.
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02189 seconds