This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 270953

Summary: Refactor -> Introduce Method... inside lambda does not consider referenced finals
Product: java Reporter: SirIntellegence
Component: RefactoringAssignee: Svata Dedic <sdedic>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:
Attachments: java test file

Description SirIntellegence 2017-06-23 22:35:21 UTC
Created attachment 164615 [details]
java test file

Using the attached java file, select all or part of the contents of the lambda expression (excluding the "item->"), and use Refactor -> Introduce Method. The resulting method will only have one param for "item" and none for the referenced explicit and implicit final variables.
Comment 1 SirIntellegence 2017-06-23 22:37:51 UTC
This bug results in users having to introduce a method manually or resorting to creative solutions... (Like Refactor->Convert Anonymous to Member)
Comment 2 Svata Dedic 2017-06-30 13:37:37 UTC
Fixed in jet-main#4d867a2b7bc7
Comment 3 Quality Engineering 2017-07-26 02:08:56 UTC
Integrated into 'main-silver', will be available in build *201707260001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/4d867a2b7bc7
User: Svata Dedic <sdedic@netbeans.org>
Log: #270953: introduce method must scan the whole method for local variable accesses, not just the lambda