I think the problem is probably that there is a case where try and catch exceptions are thrown out. In this case, finally should be achieved, but with uninitialized foo . Since in this case the rest of the code will not be reached (the exception that was thrown in the catch takes us out of the method after finally ), this does not present a problem for the code after finally . This code can only be achieved by running try or catch blocks.
Since there is always the case that each individual assignment foo throws an exception, and since in this case the finally block will always work anyway, there is always the possibility of uninitializing foo .
As far as I can tell, the only way to do this is to provide an initialization value for foo .
source share