title: Type mismatch: cannot convert from Class <..> to Class <...>
body: <p>I've 'inherited' an Eclipse RCP project which seems to work fine with a target platform set based around 3.6.  However, moving forward we need to update to the latest version of the platform, but when I change the target platform to 3.7 (or 4.2) I get a handful of errors along the lines of </p>
  
  <pre><code>Type mismatch: cannot convert from Class&lt;capture#1-of ?&gt; to Class&lt;? extends IDatasetProvider&gt;
  </code></pre>
  
  <p>Can anyone suggest/provide an explanation of why this might work fine in 3.6, but not in 3.7 (and later)? Any ideas as to where I would start in resolving this would also be great!</p>
  
  <p>A snippet of the code causing this error (which appears at the b.loadClass part):</p>
  
  <pre><code>    List&lt;Class&lt;? extends IDatasetProvider&gt;&gt; list = new LinkedList&lt;Class&lt;? extends IDatasetProvider&gt;&gt;();
      ClassMap&lt;IDatasetProvider, List&lt;String&gt;&gt; map = new ClassMap&lt;IDatasetProvider, List&lt;String&gt;&gt;();
  
      for (IConfigurationElement e : elements)
      {
          try
          {
              Bundle b = Platform.getBundle(e.getContributor().getName());
  
              String viewId = e.getAttribute("viewId");
              Class&lt;? extends IDatasetProvider&gt; datasetType = b.loadClass(e
                      .getAttribute("datasetProvider"));
              ...
              ...
              ...
          }
       }
  </code></pre>
  
  <p>There are also 3 (possibly) related warnings</p>
  
  <pre><code> IDatasetProvider is a raw type. References to generic type IDatasetProvider&lt;T&gt; should be parameterized 
  </code></pre>
  
  <p>If I change back to our 3.6 platform, it all works again.</p>
  
  <p>EDIT: fixed thanks to the help of Alexy and gzukmin.  </p>
  
  <p>I used the following code, specifically casting to <code>Class&lt;? extends IDatasetProvider&gt;</code> rather than just <code>Class</code>:</p>
  
  <pre><code>Class&lt;? extends IDatasetProvider&gt; datasetType = 
      (Class&lt;? extends IDatasetProvider&gt;) b.loadClass(e.getAttribute("datasetProvider"));
  </code></pre>
  
  <p>If there's any reason I should consider just casting to the more generic <code>Class</code>, please let me know!</p>