Project: JDT
Bug 269595 [clean up] Clean-Up of For-Each plus use final produces extra 'final' modifier
Reported: 2009-03-21 11:42:08 | Status: verified fixed

The Clean-Up option 'Convert for loops to enhanced for loops' produce an extra 'final' modifier if the loop-variable was defined as final, resulting in two final modifiers on the same variable after clean-up. Example: Before Clean-Up: int[] array = new int[] { 1, 2, 3 }; for( int i = 0; i < array.length; i++ ) { final int value = array[i]; System.out.println( value ); } After Clean-Up: final int[] array = new int[] { 1, 2, 3 }; for( final final int value : array ) { System.out.println( value ); }

Files changed in fix:
org.eclipse.jdt.ui.tests/ui/org/eclipse/jdt/ui/tests/quickfix/CleanUpTest.java org.eclipse.jdt.ui/core extension/org/eclipse/jdt/internal/corext/fix/ConvertForLoopOperation.java