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.
Select labmda parameter 'x'->Right click->Refactor->Rename... New Name: a Dialog will show error: Cannot rename. a already used. But in fact the code: IntegerMath addition = (a, b) -> a + b; IntegerMath subtraction = (a, b) -> a - b; is correct. public class Calculator { interface IntegerMath { int operation(int a, int b); } public int operateBinary(int a, int b, IntegerMath op) { return op.operation(a, b); } public static void main(String... args) { Calculator myApp = new Calculator(); IntegerMath addition = (a, b) -> a + b; IntegerMath subtraction = (x, y) -> x - y; // Try to rename 'x' to 'a' System.out.println("40 + 2 = " + myApp.operateBinary(40, 2, addition)); System.out.println("20 - 10 = " + myApp.operateBinary(20, 10, subtraction)); } }
changeset: 50a8acf6e8a9 user: Ralph Benjamin Ruijs <ralphbenjamin@netbeans.org> date: Mon Oct 20 13:05:03 2014 +0200 summary: # 238268 - Rename lambda parameter checks wrong context for eligible parameter name
verified in NetBeans IDE Dev (Build 20141104-d5433ace1b92)