Community
Participate
Working Groups
Created attachment 279119 [details] Dump when the error appeared I am running eclipse 2018-12 for developing maven and Gradle-Projects. Unforunately, since about an hour, eclipse hangs everytime when I try to use autocompletion on String variables. If I use autocompletion on other Classes, e.g. File, Set, or classes defined by me, everythings works fine. In the eclipse.ini, I've set space to -Xmx2g. eclipse does not use this space; my system got 16 GB RAM and only 6 are used, so I assume it is not a memory error. Deleting .metadata in the workspace did not solve the problem. If I switch to an empty workspace, create an empty Java project and one Test class in a test package, and enter this code: package test; public class Test { String val = ""; { // val.match } } interface ConditionChecker { boolean check(String line); } enum MyGuesser { INT_LONG("INT_LONG", (line) -> { return line.contains("int"); }, (line) -> { return line.contains("long"); }); String name; ConditionChecker checker; ConditionChecker checkerOld; MyGuesser(String name, ConditionChecker checker, ConditionChecker checkerOld) { this.name = name; this.checker = checker; this.checkerOld = checkerOld; } } The error appears. Seems like two of this interface instances need to be present - if only one is there, the error does not appear. A thread dump is attached.
Please try Eclipse 4.13.
Created attachment 279120 [details] Dump when the error appeared in eclipse 4.12 I've tried it with eclipse 4.12, so the current 2019-06 download. There, the same bug appears. Unfortunately, I can't find 4.13, could you maybe provide a download link?
(In reply to David Georg Reichelt from comment #2) > I've tried it with eclipse 4.12, so the current 2019-06 download. There, the > same bug appears. Unfortunately, I can't find 4.13, could you maybe provide > a download link? There are no 4.13 releases yet. But the latest builds are listed under the Integration Builds section in https://download.eclipse.org/eclipse/downloads/
I can reproduce on 4.13 master, trying to use autocomplete at line.| position After some seconds I get an error dialog (not a full hang) saying the code complete was not able terminate timely, and error log for UI freeze with following stack: at org.eclipse.jdt.internal.compiler.parser.Scanner.<init>(Scanner.java:180) at org.eclipse.jdt.internal.compiler.parser.Scanner.<init>(Scanner.java:308) at org.eclipse.jdt.internal.codeassist.complete.CompletionScanner.<init>(CompletionScanner.java:62) at org.eclipse.jdt.internal.codeassist.complete.CompletionScanner.<init>(CompletionScanner.java:51) at org.eclipse.jdt.internal.codeassist.complete.CompletionJavadocParser.<init>(CompletionJavadocParser.java:62) at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.createJavadocParser(CompletionParser.java:5740) at org.eclipse.jdt.internal.compiler.parser.Parser.<init>(Parser.java:980) at org.eclipse.jdt.internal.codeassist.impl.AssistParser.<init>(AssistParser.java:134) at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.<init>(CompletionParser.java:190) at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.createSnapShotParser(CompletionParser.java:5544) at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.updateRecoveryState(CompletionParser.java:5701) at org.eclipse.jdt.internal.compiler.parser.Parser.resumeOnSyntaxError(Parser.java:13326) at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.resumeOnSyntaxError(CompletionParser.java:5585) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:11906) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12252) at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12209) at org.eclipse.jdt.internal.compiler.parser.Parser.dietParse(Parser.java:10617) at org.eclipse.jdt.internal.codeassist.complete.CompletionParser.dietParse(CompletionParser.java:5063) at org.eclipse.jdt.internal.codeassist.CompletionEngine.complete(CompletionEngine.java:2052) at org.eclipse.jdt.internal.core.Openable.codeComplete(Openable.java:136) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:368) at org.eclipse.jdt.internal.core.CompilationUnit.codeComplete(CompilationUnit.java:358) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.internalComputeCompletionProposals(JavaCompletionProposalComputer.java:253) at org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer.computeCompletionProposals(JavaCompletionProposalComputer.java:215) at org.eclipse.jdt.internal.ui.text.java.JavaTypeCompletionProposalComputer.computeCompletionProposals(JavaTypeCompletionProposalComputer.java:66) at org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerDescriptor.computeCompletionProposals(CompletionProposalComputerDescriptor.java:336) at org.eclipse.jdt.internal.ui.text.java.CompletionProposalCategory.computeCompletionProposals(CompletionProposalCategory.java:340) at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.collectProposals(ContentAssistProcessor.java:334) at org.eclipse.jdt.internal.ui.text.java.ContentAssistProcessor.computeCompletionProposals(ContentAssistProcessor.java:291) at org.eclipse.jface.text.contentassist.ContentAssistant$2.lambda$0(ContentAssistant.java:2015) at org.eclipse.jface.text.contentassist.ContentAssistant$2$$Lambda$1854/0x0000000840facc40.accept(Unknown Source)
Wow, it really seems to hang at this line: //--- public /*static*/ final char[][][][] charArray_length = new char[OptimizedLength][TableSize][InternalTableSize][]; //--- allocating an array of 7 x 30 x 6 chars. (Needless to say that nothing relevant has changed here for ages).
(In reply to Stephan Herrmann from comment #5) > Wow, it really seems to hang at this line: > > //--- > public /*static*/ final char[][][][] charArray_length = > new char[OptimizedLength][TableSize][InternalTableSize][]; > //--- > > allocating an array of 7 x 30 x 6 chars. > > (Needless to say that nothing relevant has changed here for ages). I guess there's a loop before?
After closing the error (timeout) popup I see an interesting message in the status line: The constructor MyGuesser(String, (<no type> line)->{}, (<no type> line)->{}) is undefined.
(In reply to Andrey Loskutov from comment #6) > (In reply to Stephan Herrmann from comment #5) > > Wow, it really seems to hang at this line: > > > > //--- > > public /*static*/ final char[][][][] charArray_length = > > new char[OptimizedLength][TableSize][InternalTableSize][]; > > //--- > > > > allocating an array of 7 x 30 x 6 chars. > > > > (Needless to say that nothing relevant has changed here for ages). > > I guess there's a loop before? No, its a field initializer. Or what you mean "before"? Someone creating Scanners in a tight loop?
Yep.
Right, CompletionParser.createSnapShotParser() is invoked *many* times.
Still funny, that the innocent allocation is always on the stack top, when someone looks, given that we are still running through the non-trivial loop below in Parser.parse()
It's one of the dreaded syntax recovery scenarios for lambdas, which we don't have under control yet. Interestingly, the current recovered element (RecoveredType) has a RecoveredField with this parse tree: INT_LONG("INT_LONG", (<no type> line) -> { return <CompleteOnName:line.>; contains("int"); }, (<no type> line) -> { return line.contains("long"); }), which doesn't look too bad, except that the second ctor arg is not semantically valid: (<no type> line) -> { return <CompleteOnName:line.>; contains("int"); } Just the parser doesn't make any progress. Ah, it's not a total hang due to https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=7dbc472feab6f8985cd72052d6eaace52c7ea562 "[1.8] Follow ups to bug 427322 and bug 425084"
Anyone looking at this bug may want to first have a look at https://wiki.eclipse.org/JDT_Core_Programmer_Guide/Completion - which is known to be incomplete, so completing (sic) that page is on our long term agenda.
And a quote from 2014: (Stephan Herrmann from bug 425084 comment #2) > CompletionParser does not seem to make any progress, with lots of snapshot > parsers being created etc. ... > Looks like the kind of magic that only Srikanth can master :)
New Gerrit change created: https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179694
(In reply to Eclipse Genie from comment #15) > New Gerrit change created: > https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179694 adding a regression test from comment 0, which passes on HEAD, assumebly since the fix for bug 539685 *** This bug has been marked as a duplicate of bug 539685 ***
Gerrit change https://git.eclipse.org/r/c/jdt/eclipse.jdt.core/+/179694 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?id=2523af68f1f5714069768f55260944e646ea1a9e
Verified for 4.20 RC1 with build I20210525-1800