File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -405,4 +405,56 @@ public class A {
405405 Parser a12;
406406 }
407407}
408+ ```
409+
410+ ### ` removeUnusedLambdaParameters `
411+
412+ Rename unused lambda parameters, or unused pattern variables to ` _ ` .
413+
414+ For example:
415+
416+ ``` java
417+ public class Unused {
418+
419+ private interface J {
420+ public void run (String a , String b );
421+ }
422+
423+ public static void main (String [] args ) {
424+ record R(int i, long l) {}
425+
426+ J j = (a, b) - > System . out. println(a);
427+ j. run(" a" , " b" );
428+
429+ R r = new R (1 , 1 );
430+ switch (r) {
431+ case R(_, long l) - > {}
432+ case R r2 - > {}
433+ }
434+ }
435+ }
436+ ```
437+
438+ becomes:
439+
440+ ``` java
441+ public class Unused {
442+
443+ private interface J {
444+ public void run (String a , String b );
445+ }
446+
447+ public static void main (String [] args ) {
448+ record R(int i, long l) {}
449+
450+ J j = (a, _) - > System . out. println(a);
451+ j. run(" a" , " b" );
452+
453+ R r = new R (1 , 1 );
454+ switch (r) {
455+ case R(_, _) - > {}
456+ case R _ - > {}
457+ }
458+ }
459+ }
408460```
Original file line number Diff line number Diff line change 13131313 " switchExpression" ,
13141314 " tryWithResource" ,
13151315 " renameFileToType" ,
1316- " organizeImports"
1316+ " organizeImports" ,
1317+ " removeUnusedLambdaParameters"
13171318 ]
13181319 },
13191320 "default" : [
You can’t perform that action at this time.
0 commit comments