title: Java generics - using a variable of type Class<? extends Whatever> (clazz cannot be resolved to a type)
body: <p>I keep struggling with Java generics, here's what I'm trying to do:</p>
  
  <pre><code>...
  sortedActions = new ArrayList&lt;BaseAction&gt;();
  ActionGroup&lt;? extends BaseAction&gt; actionGroup = null;
  
  for (final BaseAction action : sortedActions) {
      Class&lt;? extends BaseAction&gt; clazz = action.getClass();
      if (actionGroup == null) {
          actionGroup = new ActionGroup&lt;clazz&gt;(); // &lt;-- "clazz cannot be resolved to a type"
      }
  }
  </code></pre>
  
  <p>And ActionGroup is defined like that:
      public class ActionGroup { ...</p>
  
  <p>I don't understand this error, when I check in the debugger, clazz gets initialized, it is of type "java.lang.Class", its value is "my.packacge.SubAction" which is a subclass of BaseAction, so how is it not resolved to a type? Or, what am I not understanding here?</p>