title: Would type erasure occur here?
body: <p>I think I'll lose information on the specific type of Exception in this block of code.  How can I preserve the type of Exception so that I don't have to add a generic Exception throws clause to the method that contains the following code?  I think it's got to do with employing <a href="http://docs.oracle.com/javase/tutorial/java/generics/index.html" rel="nofollow">generics</a> correctly; guidance would be appreciated.</p>
  
  <pre><code>for( int i = 0; i &lt; retries; i ++ ) {
      Exception anyException = null;
      try {
          Future&lt;Object&gt; returnedObj = threadPool.submit(task);
          toReturn = returnedObj.get(timeout, timeunit);
          break;
      } catch (RejectedExecutionException ex) {
          anyException = ex;
      } catch (NullPointerException ex ) {
          anyException = ex;
      }
      ...
      finally {
         ...
         if(i == retries -1 &amp;&amp; anyException != null) {
             throw anyException;
         }
      }
  }
  </code></pre>