Bug 425410 - [1.8][quick assist] Conversion from anonymous class having generic method to lambda expression
Summary: [1.8][quick assist] Conversion from anonymous class having generic method to ...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3.1   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: BETA J8   Edit
Assignee: Noopur Gupta CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 424296
  Show dependency tree
 
Reported: 2014-01-10 10:08 EST by Noopur Gupta CLA
Modified: 2014-02-21 00:02 EST (History)
6 users (show)

See Also:
markus.kell.r: review+


Attachments
Fix + Test (3.72 KB, patch)
2014-01-13 07:13 EST, Noopur Gupta CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Noopur Gupta CLA 2014-01-10 10:08:29 EST
+++ This bug was initially created as a clone of Bug #424296 +++

interface FIOther<T> {
	<M> FIOther<T> run (M x);
}

public class TestOther {
    FIOther<String> fi1 = new FIOther<String>() {public <M> FIOther<String> run(M x) {return null;}};
    
}


Convert the error free code to lambda expression with quick fix. See the syntax error message :
Illegal lambda expression: Method run of type FIOther<String> is generic 	TestOther.java	/_pasted_code_/src	line 6	Java Problem
Comment 1 Noopur Gupta CLA 2014-01-10 10:11:19 EST
In this case, the conversion should not be supported as it is not possible to have a generic lambda expression.
Hence, the quick assist should be disabled.
Comment 2 Noopur Gupta CLA 2014-01-13 07:13:34 EST
Created attachment 238911 [details]
Fix + Test

Disabled the conversion to lambda if the method in anonymous class is generic.
Attached patch is based on mmathew/BETA_JAVA8 branch.
Comment 4 Martin Mathew CLA 2014-02-21 00:02:13 EST
Verified using Kepler SR2(RC4) + BETA_JAVA8 - RC1