Community
Participate
Working Groups
Hi, I'm currently using the Eclipse JDT Patch for Java 8 Support(BETA) v1.0.0.v20140107-0103_BETA_JAVA8 with Eclipse Kepler SR1 20130919-0819 When a try to get the autocompletion (Ctrl + Space) after the pattern 'try' in a lamba in a SWT Listener (see the following code where '|' represente the cursor of the editor) eclipse freeze and is not responding anymore. code : import org.eclipse.swt.widgets.Listener; ... public class Plop { ... Public Listener getListener(){ return event -> { try|(ctrl + Space ) }; }
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 :)
I'll take a look at this this week. Thanks Maxime.
Created attachment 239539 [details] Diff of two CPU tracing snapshots when hung This is an infinite loop trying to recover from a syntax error during diet parse but not making any further progress. I didn't understand where the actual error was, but a working workaround I found was to put System.currentTimeMillis() into a ThreadLocal guarded with a try-finally-block at the start of CompletionParser.dietParse and then checking the time in CompletionParser.initializeScanner and throwing OperationCanceledException if it went over a second or so.
(In reply to Timo Kinnunen from comment #4) > Created attachment 239539 [details] > Diff of two CPU tracing snapshots when hung > > This is an infinite loop trying to recover from a syntax error during diet > parse but not making any further progress. > > I didn't understand where the actual error was, I think the commit operation is incorrectly capturing the error state the LALR automaton enters into and all further rollbacks roll back to this bad state.
Sorry about the freeze and sorry about the delay. Fix and test released here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=90c80d82832fd719fe60993fa6dd40696f0b049a (In reply to Srikanth Sankaran from comment #5) > I think the commit operation is incorrectly capturing the error state the > LALR automaton enters into and all further rollbacks roll back to this bad > state. Yep. Fix is trivial. Ensure that only kosher states are committed at checkpoints. (In reply to Timo Kinnunen from comment #4) > I didn't understand where the actual error was, but a working workaround I > found was to put System.currentTimeMillis() into a ThreadLocal guarded with > a try-finally-block at the start of CompletionParser.dietParse and then > checking the time in CompletionParser.initializeScanner and throwing > OperationCanceledException if it went over a second or so. I'll consider this for a second line of defense and work on a patch. You shouldn't need a thread local - instance field should be good enough.
(In reply to Srikanth Sankaran from comment #6) > I'll consider this for a second line of defense and work on a patch. You > shouldn't need a thread local - instance field should be good enough. I hooked up the CompletionParser infrastructure into the canonical of scheme of things i.e IProgressMonitor that the CompletionEngine already tracks: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=7dbc472feab6f8985cd72052d6eaace52c7ea562
Verified as working for Eclipse + Java 8 RC1 using Kepler SR1 + Eclipse Java Development Tools Patch for Java 8 Support (BETA) 1.0.0.v20140220-2054