title: Java - immutable local variables
body: <p>It is quite common "good practice" to make local variables <code>final</code> by default. Don't know about eclipse, but in IDEA there is even a checkbox in "create local variable" dialog. But there is one issue that doesn't let me use it every time. Take this code for example:</p>
  
  <pre><code>...
  final Foo foo = null;
  try{
      foo = getFromSomewhere();
  } catch (IDontCareException e) {
      log.info(e, "looks like foo is not there);
  }
  
  if (foo != null) {
      doSomethingWithFoo(foo);
  }
  
  doSomethingElse();
  ...
  </code></pre>
  
  <p>The issue is that <code>IDontCareException</code> does not extend  <code>RuntimeException</code>... Is there any way to use <code>final</code> variable still?</p>