Java is Unsound https://hackernoon.com/java-is-unsound-28c84cb2b3f#.8tf5qumlb
In this article java type safety is discussed and it is compiling in some java version and not compiling in some java version .
class Unsound {
static class Constrain<A,B extends A>{}
static class Bind<A> {
<B extends A>
A upcast(Constrain<A,B> constrain , B b){
return b;
}
}
static <T,U> U coerce(T t){
Constrain<U,? super T> constrain = null;
Bind <U> bind = new Bind<U>();
return bind.upcast(constrain,t);
}
public static void main(String ...s){
String zero = Unsound.<Integer,String>coerce(0);
}
}
https://raw.githubusercontent.com/namin/unsound/master/doc/unsound-oopsla16.pdf
So if they say this boils down to a null-pointer bug. But unlike most null-pointer bugs
So just not able to understand its compilation or non compilation on different IDE
An open bug is also there related to it https://bugs.openjdk.java.net/browse/JDK-8054941
and eclipse also https://bugs.eclipse.org/bugs/show_bug.cgi?id=510900