Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Debug Shell Evaluation Failure with Stream Processing("java cannot be resolved or is not a field" error when processing stream with forEach())
Debug Shell Evaluation Failure with Stream Processing [message #1824303] Mon, 13 April 2020 16:05 Go to next message
David Eisner is currently offline David EisnerFriend
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.
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824308 is a reply to message #1824303] Mon, 13 April 2020 16:45 Go to previous messageGo to next message
Gayan Perera is currently offline Gayan PereraFriend
Messages: 9
Registered: July 2009
Junior Member
Could you try

strs.stream().forEach(v -> System.out.println(v))
instead and see you get the proper output you are expecting ?
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824309 is a reply to message #1824308] Mon, 13 April 2020 17:00 Go to previous messageGo to next message
David Eisner is currently offline David EisnerFriend
Messages: 32
Registered: July 2009
Member
Thanks. That's one thing I tried. Same problem, unfortunately.
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824312 is a reply to message #1824309] Mon, 13 April 2020 17:42 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 58
Registered: October 2018
Member
Hello there,

No problems at this end.

Using:

- Windows 10.
- Eclipse IDE for Java Developers 2020-03 (4.15.0)
- openjdk version "14" 2020-03-17

index.php/fa/37807/0/
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824315 is a reply to message #1824312] Mon, 13 April 2020 18:05 Go to previous messageGo to next message
David Eisner is currently offline David EisnerFriend
Messages: 32
Registered: July 2009
Member
Thanks, Eitan, but I'm talking about Debug Shell specifically:

index.php/fa/37808/0/
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824316 is a reply to message #1824309] Mon, 13 April 2020 18:06 Go to previous messageGo to next message
Gayan Perera is currently offline Gayan PereraFriend
Messages: 9
Registered: July 2009
Junior Member
I think the improvement which eclipse did to support inspection and evaluations of stream and lambda expression must have a problem with void type terminal operations.
For example it doesn't for this either
Arrays.asList("a", "b", "ac").forEach(v -> System.out.println(v))


Would you mind reporting a issue in bugs.eclipse.org ?
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824317 is a reply to message #1824316] Mon, 13 April 2020 18:37 Go to previous messageGo to next message
Eitan Rosenberg is currently offline Eitan RosenbergFriend
Messages: 58
Registered: October 2018
Member
Miss the word "Shell" .....

Same thing happened on this end.

Good luck.
Re: Debug Shell Evaluation Failure with Stream Processing [message #1824318 is a reply to message #1824316] Mon, 13 April 2020 19:20 Go to previous messageGo to next message
David Eisner is currently offline David EisnerFriend
Messages: 32
Registered: July 2009
Member
Bug filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=562079

Thanks.
Re: Debug Shell Evaluation Failure with Stream Processing [message #1828796 is a reply to message #1824318] Thu, 18 June 2020 19:25 Go to previous message
David Eisner is currently offline David EisnerFriend
Messages: 32
Registered: July 2009
Member
Thanks for fixing the bug so quickly, Gayan. I've seen bugs languish for years, this one is already fixed in the next quarterly release (2020-06). Much appreciated.
Previous Topic:Java FX installation help
Next Topic:Workspace corrupted - Eclipse GUI not coming up anymore
Goto Forum:
  


Current Time: Wed Oct 28 12:07:52 GMT 2020

Powered by FUDForum. Page generated in 0.03309 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top