Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 405126 - [1.8][code assist] Lambda parameters incorrectly recovered as fields.
Summary: [1.8][code assist] Lambda parameters incorrectly recovered as fields.
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.3   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Srikanth Sankaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 402079
  Show dependency tree
 
Reported: 2013-04-08 01:39 EDT by ANIRBAN CHAKRABORTY CLA
Modified: 2013-11-30 19:57 EST (History)
2 users (show)

See Also:
srikanth_sankaran: review? (anchakrk)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ANIRBAN CHAKRABORTY CLA 2013-04-08 01:39:38 EDT
public interface Foo { 
	int run(int s1, int s2); 
}

interface X {
	

    static Foo f = (int x5, int x11) -> x
    static int x1 = 2;
}

class C {
	void method1(){
		int p = X.<ctrl-space>
	}
}

Wrongly suggesting x5, x11. Only x1 should have been suggested.
Comment 1 Srikanth Sankaran CLA 2013-04-08 01:44:49 EDT
(In reply to comment #0)
> public interface Foo { 
> 	int run(int s1, int s2); 
> }
> 
> interface X {
> 	
> 
>     static Foo f = (int x5, int x11) -> x
>     static int x1 = 2;
> }
> 
> class C {
> 	void method1(){
> 		int p = X.<ctrl-space>
> 	}
> }
> 
> Wrongly suggesting x5, x11. Only x1 should have been suggested.

This looks like is due to the syntax error in the lambda expression and
how recovery handles it. There is a missing semicolon. If that is addressed
there are no incorrect proposals.
Comment 2 Srikanth Sankaran CLA 2013-11-30 07:46:49 EST
Fix and tests available here: http://git.eclipse.org/c/jdt/eclipse.jdt.core.git/commit/?h=BETA_JAVA8&id=6d7da1254151724e22f25d1be0ba01cba8049f5e

Anirban, please review. TIA.