title: How do I annotate with @SuppressWarnings("unchecked") for a single cast instead of a whole method?
body: <p>It seems excessive when annotations apply to a method.</p>
  
  <p>How do I use the annotation @SuppressWarnings("unchecked") for a single cast instead of a whole method?</p>
  
  <p>In this example, I just finished checking that a cast will be safe and so I proceed to cast but I get an annoying warning.</p>
  
  <pre><code>@Override
  public void execDetails()
  { 
      Map&lt;Integer, ResponseList&lt;?&gt;&gt; responseMap = 
              new HashMap&lt;Integer, ResponseList&lt;?&gt;&gt;();
  
      // ... omitted code ...
  
      ResponseList&lt;?&gt; responseList = responseMap.get(requestId);
      Class&lt;?&gt; elementType = responseList.getElementType();
      if (elementType == ExecutionDetail.class)
          ((ResponseList&lt;ExecutionDetail&gt;)responseList).add(new ExecutionDetail());
  
  }
  </code></pre>