Java Class<T> static method forName() IncompatibleClassChangeError
<pre><code>private static Importable getRightInstance(String s) throws Exception {
   Class&lt;? extends Importable&gt; c = Class.forName(s).asSubclass(Importable.class);
   Importable i = c.newInstance();
   return i;
}
</code></pre>

<p>which i can also write</p>

<pre><code>private static Importable getRightInstance(String s) throws Exception {
   Class&lt;? extends Importable&gt; c = (Class&lt;? extends Importable&gt;)Class.forName(s);
   Importable i = c.newInstance();
   return i;
}
</code></pre>

<p>or</p>

<pre><code>private static Importable getRightInstance(String s) throws Exception {
   Class&lt;?&gt; c = Class.forName(s);
   Importable i = (Importable)c.newInstance();
   return i;
}
</code></pre>

<p>where Importable is an interface and s is a string representing an implementing class.
Well, in any case it gives the following:</p>

<pre><code>Exception in thread "main" java.lang.IncompatibleClassChangeError: class C1 has
interface Importable as super class
</code></pre>

<p>Here is the last snippet of the stack trace:</p>

<pre><code> at java.lang.Class.forName(Class.java:169)
 at Importer.getRightImportable(Importer.java:33)
 at Importer.importAll(Importer.java:44)
 at Test.main(Test.java:16)
</code></pre>

<p>Now, class C1 actually implemens Importable and i totally don't understand why it complaints.</p>

<p>Thanks in advance.</p>
