Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 492406

Summary: [1.8] Add content assist and/or quickfix to create lambdas (RFE)
Product: [Eclipse Project] JDT Reporter: Colin Sharples <ctg>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 4.5.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Colin Sharples CLA 2016-04-25 18:04:00 EDT
It would be nice to have built-in support for creating lambdas, i.e. via content assist and/or quickfix.

For example, when you call a method that takes a functional interface as a parameter, you can invoke content assist to create a new anonymous class by typing "new " and then ctrl+space. It would be ideal to have a lambda version of the interface available as an option as well as the anonymous class. It's possible to write a code template to insert a generic lambda template, e.g. "(${cursor}) -> {}", but it would need proper JDT support to inspect the interface for argument names and construct a fully populated lambda template.

At present, if you don't know the interface arguments, your only option is to create the anonymous class and then convert to lambda, which is extra work.
Comment 1 Colin Sharples CLA 2016-04-25 20:05:19 EDT
Apologies, this is a duplicate of bug #443091 - I didn't find that when searching to see if it was already requested.

*** This bug has been marked as a duplicate of bug 443091 ***