Creating a generic object using a Class<?> variable
<p>I have a generic class A, and I'm in a method where I have to create an instance of A based on the class the given object is. That is, I have:</p>

<pre><code>public void (Object obj) {
  Class&lt;?&gt; c = obj.getClass();
  A&lt;c&gt; = ...;
}
</code></pre>

<p>However, on the third line Eclipse says that c cannot be resolved to a type. When I remove the generic parameter, I get "A is a raw type. References to generic type A should be parameterized."</p>

<p>What would be the correct way to go here?</p>

<p>Thanks.</p>
