Here is a code sample:
public class TypeErasure<X extends String>{
private X data;
public TypeErasure(String s){
this.data = s;
}
According to me, after type erasure the code should look like this:
public class TypeErasure{
private String data;
public TypeErasure(String s){
this.data = s;
}
But I get a compile time error saying
Error:(139, 25) java: incompatible types: java.lang.String cannot be converted to X
Once type erasure is done, information about X is lost, so why does the compiler complain?