Community
Participate
Working Groups
Build ID: I20090313-0100 Steps To Reproduce: 1. Create a class with a private field and a constructor that can return before assigning to said field. e.g. class Choo { private int a; Choo(int b) { if (1 == b) return; a = 2; } } 2. Source -> Cleanup.. 3. Ensure Code Style -> Variable declarations -> Use modifier 'final' where possible -> Private fields is ticked. 4. Run the clean-up. 'final' will be added to the private field (a), which will cause the constructor to error: "The blank final field a may not have been initialized" Can work around this by putting in the implicit "=0;" on the private field. -- java.version=1.6.0_13 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_GB Command-line arguments: -os win32 -ws win32 -arch x86_64
Move to JDT/UI
Created attachment 150316 [details] Testcase and simplest possible fix Simplest possible fix; if any constructor that returns at any point assigns to the private field, it can't be made final.
Thanks, released to HEAD. To be honest, that whole clean up should be rewritten to just - create a working copy with all supported variables set to final - compile the working copy - create changes for those variables which didn't introduce a definite assignment problem