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

Bug 532953

Summary: [1.8][assist] Lambda expression auto completion
Product: [Eclipse Project] JDT Reporter: Marvin Fröhlich <eclipse>
Component: TextAssignee: JDT-Text-Inbox <jdt-text-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 4.7.3   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:

Description Marvin Fröhlich CLA 2018-03-27 08:33:50 EDT
There should be a code assist completion option for functional interfaces.

Example1:
##################################################
BiConsumer<String, Integer> c = |
##################################################

Example2:
##################################################
consumeStuff( | );
##################################################

At the position of the text cursor there should be some possibility to auto complete the functional interface method signature for lambda expression. Of course this makes more sense for custom interfaces with more and actually named arguments.

The options should be:
* (1) Complete with argument name only (only available for single argument signatures)
* (2) Complete without argument types
* (3) Complete with argument types
* (4) Complete without argument types, but (curly) braces
* (5) Complete with argument types and (curly) braces

For example1:

Option (1) (and for a Consumer<String>) would lead to:
##################################################
Consumer<String> c = t -> |;
##################################################

Option (2) would lead to:
##################################################
BiConsumer<String, Integer> c = ( t, u ) -> |;
##################################################

Option (2) (and for a Consumer<String>) would lead to:
##################################################
Consumer<String> c = ( t ) -> |;
##################################################

Option (3) with configured next-line-braces would lead to:
##################################################
BiConsumer<String, Integer> c = ( String t, Integer u ) -> |;
##################################################

Option (4) with configured next-line-braces would lead to:
##################################################
BiConsumer<String, Integer> c = ( t, u ) ->
{
    |
};
##################################################

Option (4) with configured same-line-braces would lead to:
##################################################
BiConsumer<String, Integer> c = ( t, u ) -> {
    |
};
##################################################

Option (5) with configured next-line-braces would lead to:
##################################################
BiConsumer<String, Integer> c = ( String t, Integer u ) ->
{
    |
};
##################################################

Option (5) with configured same-line-braces would lead to:
##################################################
BiConsumer<String, Integer> c = ( String t, Integer u ) -> {
    |
};
##################################################
Comment 1 Noopur Gupta CLA 2018-03-27 10:31:00 EDT

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