Community
Participate
Working Groups
We should offer a quickfix to enclose the reported statement in curly braces.
Fix + tests: http://git.eclipse.org/c/orion/org.eclipse.orion.client.git/commit/?id=65665fc09537a905454182ce2d165fd154a0ea6a In cases where we can't figure out the intention of the code, we err on the side of caution and only surround the immediate statement in braces. For example say you had this: if(true) foo(); bar(); we will only surround 'foo();' and not bar. Just due to spacing we can't know if you wanted 'bar()' to be part of the if or not, and if we did enclose it, we would change the behaviour of the code. The fix code is smart enough to not decouple comments though. For example: if(true) foo('hello'); //$NON-NLS-1 will be fixed as: if(true) { foo('hello'); //$NON-NLS-1 }