title: String gets assigned to a List without a compilation error
body: <p>As I know, one of the main purposes of generics in Java is providing compile-time type safety. If it gets compiled, the code will run without issues.</p>
  
  <p>Then why is the following code being compiled?</p>
  
  <pre><code>public static void main(String[] args) {
      String s = getList();
  }
  
  private static &lt;T extends List&gt; T getList() {
      return (T)new ArrayList();
  }
  </code></pre>
  
  <p>It compiles fine. Where is my type-safe compilation? The <code>getList()</code> method has nothing in common with the <code>String</code> class.</p>