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