Community
Participate
Working Groups
I have verified that on a Mac and Windows machines that if I create/modify a java class with an enum and lambda, using content assist will crash eclipse. Here is some sample code: import java.util.concurrent.Callable; public class TestClass { public enum TestEnum { ENUM1(() -> //remove this comment and use content assist ), ENUM2(() -> ); private Callable<Object> callable; private TestEnum(Callable<Object> callable) { this.callable = callable; } } } If you remove "//remove this comment and use content assist" and launch content assist (ctrl+space), eclipse will get in some indefinite loop and consume max cpu.
How does the crash look like? Anything in the .log? Do you have a crash report? On my machine it does not crash but it takes more than 5 seconds and sometimes an error dialog pops up saying the completion took too long.
It doesn't crash. I just keeps running. I have to kill the app manually. I don't see anything in the logs except when I start the app it prints out some startup info.
(In reply to Brian Newby from comment #2) > It doesn't crash. Why did you write it then?
That is my fault I should have said it locks up eclipse to where it is unusable. Then I have to force kill the application.
(In reply to Brian Newby from comment #4) > That is my fault I should have said it locks up eclipse to where it is > unusable. Then I have to force kill the application. Instead of killing, please first run jstack and attach the thread dump here.
Created attachment 278149 [details] Here is the thread dump when it locks up. I deleted the comment and started content assist after "ENUM1(() -> "
The recovery goes into an infinite loop between Parser#parse() and Parser#resumeOnSyntaxError(). Not sure what it takes to fix but will revisit later.
Enum plus lambda => Parser in infinite loop Sounds exactly like bug 539685. *** This bug has been marked as a duplicate of bug 539685 ***
Here's a test demonstrating that we get suitable proposals now: https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=bc061ab235fc554c2c5ab1a0746361f46ed36ffa
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179924
I can't help but notice the completion is not particularly useful in the following case: ENUM1(() -> |, ENUM2(() -> ); However, if I have a trailing ')', then things are much better. ENUM1(() -> |), ENUM2(() -> ); The most natural cases below are also working: ENUM1(() -> | ENUM1(()-> |)
Verified for 4.20 RC1 with build I20210525-1800