Community
Participate
Working Groups
Consider the following example and try to rename the variables mentioned in comments using "Alt+Shift+R": @FunctionalInterface interface I { int foo (int x); } public class C1 { I i= (int x) -> { // Unable to Rename "x" int p= 10; // Unable to Rename "p" I ii= (int a) -> a+100; // Unable to Rename "ii", "a" return ii.foo(x) + p; }; void foo() { I i= (int x) -> x; // works here } } We get the error, "Only local variables declared in methods and initializers can be renamed". However, it should be possible to rename variables in any type of lambda expr also.
Created attachment 235236 [details] Patch with testcases. Renaming of variables within lambda is taken care off. Testcases are also included.
Due to bug 408230 the below case(inferred parameter type) fails during rename operation. I i1= (x) -> { x++; // Select 'x' and invoke rename return x; };
Released the fix to BETA_JAVA8 as: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?h=BETA_JAVA8&id=1fa7558ed5b5098be920ba39ae0d8f2d68e3f004 (In reply to Manju Mathew from comment #2) > Due to bug 408230 the below case(inferred parameter type) fails during > rename operation. > I i1= (x) -> { > x++; // Select 'x' and invoke rename > return x; > }; Added an additional test for the above case and released to BETA_JAVA8 as: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?h=BETA_JAVA8&id=ecba45b579d03f4e3032f64b0dc29bd0b019f356
Fixed, changes are available in master.