title: Java, getting rid of unchecked conversion for method returning an object
body: <p>I've yet another case of unchecked warning that I cannot get rid of. Code looks like this:</p>
  <pre class="lang-java prettyprint-override"><code>public &lt;FV, V&gt; V getFieldValue ( String fieldName, Function&lt;FV, V&gt; converter )
  {
    FV fieldValue = (FV) getFieldValue ( fieldName ); // this returns an object
    return converter.apply ( fieldValue )
  } 
  </code></pre>
  <p>This code compiles and works fine, but Eclipse (and Java compiler) complaints that the FV casting is unsafe. Yes, it is, yet I'd like to rely on the caller knowing what they are doing, so I'd like to remove the warning.</p>
  <p>Eclipse proposes me to add <code>@SuppressWarnings ( &quot;unchecked&quot; )</code> at either the assignment or the method level, neither changes a thing. Is it possible to tell the compiler I'm fine with it and I don't want to be bothered?</p>
  <p>If you are thinking that <code>getFieldValue()</code> should use a generic and not an Object, yes, I know, but it's very ancient code that I can't change.</p>