Community
Participate
Working Groups
BETA_JAVA8 top of branch. Create a 1.8 project (by editing org.eclipse.jdt.core.preferences) and add the following: interface I { // code completion works here try completing voi| void foo () default { System.out.println(""); } // code completion is broken here try completing voi| } As shown in comments above, code completion breaks just after the definition of default method.
I'd expect similar results for all new syntax elements. E.g., no proposals here: ActionListener al = (e) -> System.out.println(e.|); Instead, we see a syntax error "Syntax error on token "ARROW", invalid AssignmentOperator" We'll need to check - recovery in the Parser - reporting by DiagnoseParser - adjustments in AssistParser and family.
Feel free to spawn a fresh bug for comment#1 if early analysis indicates different locations for fix (likely), Thanks
The problem re default methods is probably related to bug 383973.
With the work from bug 383973 completion was still broken, but I could narrow the issue down to a problem in RecoveredMethod.updateOnClosingBrace() which prematurely returned the grand-parent (the compilation unit), where it should return the parent (type). As a result CompletionParser.checkRecoveredType() did not find the type and thus couldn't propose a type reference proposal, only keyword proposals. I'll attach the sketch of a patch on top of bug 383973 comment 5, which ensures that upon "void foo() default {stmts;}" we record the opening brace before skipping the block "{stmts;}". I tried using RecoveredMethod.updateOnOpeningBrace() instead of the direct field assignment, but that didn't actually work. I don't think this is the best location for fixing the issue. Ayush, perhaps you can use my analysis to find a better solution?
Created attachment 218131 [details] sketch This fixes the immediate issue re default methods - but may not be the best strategy.
(In reply to comment #4) > I don't think this is the best location for fixing the issue. > Ayush, perhaps you can use my analysis to find a better solution? Thanks Stephan, once the grammar changes are in, I'll see how it can be fixed in RecoveredMethod.updateOnOpeningBrace()
(In reply to comment #6) > (In reply to comment #4) > > I don't think this is the best location for fixing the issue. > > Ayush, perhaps you can use my analysis to find a better solution? > > Thanks Stephan, once the grammar changes are in, I'll see how it can be > fixed in RecoveredMethod.updateOnOpeningBrace() Hi Ayush, the grammar changes have been in for a while - do you want to see how it can be fixed ? :)
(In reply to comment #0) > BETA_JAVA8 top of branch. > > Create a 1.8 project (by editing org.eclipse.jdt.core.preferences) and > add the following: > > interface I { > // code completion works here try completing voi| > void foo () default { System.out.println(""); } > // code completion is broken here try completing voi| > } > > As shown in comments above, code completion breaks just after the > definition of default method. This works now that the grammar has changed for default methods. I will close this for now. Code completion and recovery issues need to be looked at first order projects by themselves in due course.