Community
Participate
Working Groups
public interface Foo { int run1(int s1, int s2); } interface X extends Foo{ static Foo f = (x5, x6) -> {x<ctrl-space> } x5, x6 are not suggested.
(In reply to comment #0) > x5, x6 are not suggested. Just curious. What would a completed program look like ?
This may be a more relevant example: interface Foo { int run1(int s1, int s2); } interface X extends Foo{ static Foo f = (x512, x6) -> { System.out.println(x51|) } No completion proposals at |
(In reply to comment #1) > (In reply to comment #0) > > > x5, x6 are not suggested. > > Just curious. What would a completed program look like ? e.g interface X extends Foo { static Foo f = (x5, x6) -> {return x5;}; }
(In reply to comment #3) > (In reply to comment #1) > > (In reply to comment #0) > > > > > x5, x6 are not suggested. > > > > Just curious. What would a completed program look like ? > > e.g > > interface X extends Foo { > > static Foo f = (x5, x6) -> {return x5;}; > > } Right, this is not the same case as comment#0 and is similar to comment#2 case.
Hello, I'll be working on this. Thanks Anirban
Created attachment 230450 [details] Applicable regression clean patch Applicable regression clean patch.
The following completion attempt triggers an NPE: // --- interface I { int foo(int x); } public class X { void go() { I i = (argument) -> { if (true) { return arg| } } } }
(1) The following completion attempt triggers an NPE: // --- interface I { int foo(int x); } public class X { void go() { I i = (argument) -> { if (true) { return arg| } } } } (2) I am not sure the approach embodied in recoverFromStatementInBracedLambdaBody is the right approach. Looks like it will work only in very specific scenarios. There are a number of scenarios, where ungetting the current token and inserting a TokenNameRBRACE is the WRONG thing to do - i.e it will not trigger the sequence of rule reductions you are hoping for. I am not sure if such attempts to force rule reductions can be successful given how complex the grammar is. (3) I get NPE at completion attempt in this snippet also: interface I { int foo(int x); } public class X { void go() { I i = (argument) -> { argument == 0 ? argu| } } }
Hello Srikanth, Thanks for the comments. I'll take a re-look at the solution, keeping myself open to suggestions. I'll come up with a solution soon. Thanks Anirban
Created attachment 232071 [details] Patch accommodating review comments. Patch accommodating review comments.
Created attachment 232973 [details] Submitting refreshed patch Submitting refreshed patch (did not run regression on this one, ran on the original though).
This patch looks much more complicated than needed. Please get rid of all grammar + parser changes and submit a simpler patch and we will study it in detail, thanks.
Consider the below snippet: public class C1 { I2 i2= () -> { syso| //invoke <Ctrl+Space> here }; } @FunctionalInterface interface I2{ public void foo(); } In the above example if we invoke content assist after 'syso' ideally it should be completed as 'System.out.println();', this is not happening inside a lambda expression. Kindly take care of this scenario while fixing this bug.
Consider the below code snippet: import java.io.Serializable; interface I { void doit(); } public class X { // Invoke code assist<Ctrl+space> in this location gives 20+ suggestions Object o = (I & Serializable) () -> {}; // Invoke code assist<Ctrl+space> in this location gives just 4 template proposals } Invoking code assist just before and after a variable initialized using lambda gives different result. Will this be handled by this bug or should a new bug be created for the same?
(In reply to Manju Mathew from comment #14) > Invoking code assist just before and after a variable initialized using > lambda gives different result. Will this be handled by this bug or should a > new bug be created for the same? Please raise a separate bug - tagging it as BETA_JAVA8, thanks.
This got subsumed by the fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=407106. Tests have been added from here.