title: how to covert a java class type to its base type?
body: <p>I am trying to figure out how to convert a class type to its base type so that the java program can be compiled. In detail, we have code as follows. The code is similar to  <a href="https://github.com/twitter/chill/blob/develop/chill-thrift/src/main/java/com/twitter/chill/thrift/TBaseSerializer.java#L56" rel="nofollow noreferrer">https://github.com/twitter/chill/blob/develop/chill-thrift/src/main/java/com/twitter/chill/thrift/TBaseSerializer.java#L56</a></p>
  
  <pre><code>  interface TBase {.... }
  
    class Deserializer {
        public TBase read(Kryo kryo, Input input, Class&lt;TBase&gt; tBaseClass) {...}
        ...
    }
  
    class Event implements TBase {.... }
  
  
    Deserializer = new Deserializer(...)
    deserializer.read(kryo, input, Event.class);
  </code></pre>
  
  <p>I got the following errors with java8: </p>
  
  <pre><code>incompatible types: Class&lt;Event&gt; cannot be converted to Class&lt;TBase&gt;
  </code></pre>
  
  <p>We cannot change TBase interface to a class. With that constaint, how shall I resolve this type compatibility issue? Is  <code>Class&lt;Event&gt;</code> also <code>Class&lt;TBase&gt;</code> ?       </p>
  
  <p>I have also tried to declare <code>Class&lt;? extends TBase&gt;</code> as the parameter type. with this approach, I got "'read(Kryo, Input, Class)' in 'TBaseSerializer' clashes with 'read(Kryo, Input, Class)' in 'com.twitter.chill.thrift.TBaseSerializer'; both methods have the same erasure, yet neither override the other.</p>