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

Bug 479198

Summary: [1.8][extract local] Extract local variable, lambda, replace all occurrences
Product: [Eclipse Project] JDT Reporter: leokom leokom <lrozenblyum>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: lrozenblyum, noopur_gupta, stephan.herrmann
Version: 4.4.1   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard: stalebug

Description leokom leokom CLA 2015-10-07 02:53:25 EDT
SCENARIO:

List< String > list = new ArrayList<>();
list.stream().filter( item -> item.isEmpty() );
list.stream().filter( item -> item.isEmpty() );

Select any of 'item -> item.isEmpty()' lambdas.
Refactor -> Extract local variable, checkbox 'Replace all occurrences...' is ON

EXPECTED:
Both lambdas are replaced by new local variable

ACTUALLY:
Just selected lambda is replaced

Received code like :
Predicate<? super String> predicate = item -> item.isEmpty();
list.stream().filter( predicate );
list.stream().filter( item -> item.isEmpty() );

Reason why it is important : 
by using lambdas due to their concise syntax it's very easy to get a lot of duplicated code. It would be very nice if the IDE will help removing that duplication.
Comment 1 Eclipse Genie CLA 2019-08-31 13:25:30 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.