title: Why am I getting an AssertionError when assigning Arrays.asList() to var directly?
body: <p>I'm trying to understand <a href="http://openjdk.java.net/jeps/286" rel="noreferrer">local variable type inference</a> in Java 10. </p>
  
  <ol>
  <li><p>The code below works perfectly during compilation and runtime:</p>
  
  <pre><code>List list1 = Arrays.asList(1L, 2.0F, "3");
  var list2 = list1;
  </code></pre></li>
  <li><p>However, this line throws a compilation error:</p>
  
  <pre><code>var list3 = Arrays.asList(1L, 2.0F, "3");
  </code></pre>
  
  <blockquote>
    <p><code>Error:java: java.lang.AssertionError: Unexpected intersection type: java.lang.Object&amp;java.io.Serializable&amp;java.lang.Comparable&lt;? extends java.lang.Object&amp;java.io.Serializable&amp;java.lang.Comparable&lt;?&gt;&gt;</code></p>
  </blockquote></li>
  </ol>
  
  <p>I don't really understand why the 2nd case is wrong but not the 1st case. Because I expect the compiler would infer the type of <code>list1</code> and treat <code>list2</code> and <code>list3</code> the same. Thanks in advance.</p>