title: Difference in behaviour of the ternary operator on JDK8 and JDK10
body: <p>Consider the following code</p>
  
  <pre><code>public class JDK10Test {
      public static void main(String[] args) {
          Double d = false ? 1.0 : new HashMap&lt;String, Double&gt;().get("1");
          System.out.println(d);
      }
  }
  </code></pre>
  
  <p>When running on JDK8, this code prints <code>null</code> whereas on JDK10 this code results in <code>NullPointerException</code></p>
  
  <pre><code>Exception in thread "main" java.lang.NullPointerException
      at JDK10Test.main(JDK10Test.java:5)
  </code></pre>
  
  <p>The bytecode produced by the compilers is almost identical apart from two additional instructions produced by the JDK10 compiler which are related to autoboxing and seem to be responsible for the NPE.</p>
  
  <pre><code>15: invokevirtual #7                  // Method java/lang/Double.doubleValue:()D
  18: invokestatic  #8                  // Method java/lang/Double.valueOf:(D)Ljava/lang/Double;
  </code></pre>
  
  <p>Is this behaviour a bug in JDK10 or an intentional change to make the behaviour stricter? </p>
  
  <pre><code>JDK8:  java version "1.8.0_172"
  JDK10: java version "10.0.1" 2018-04-17
  </code></pre>