I'm guessing that this is not intended behavior. Is there a bug already posted about this? (I've tried it in 2.9.2, but haven't had a chance in 2.10, yet.)
scala> val d1: java.lang.Double = 1.0
d1: java.lang.Double = 1.0
scala> val d2: Double = d1
d2: Double = 1.0
scala> val dn: java.lang.Double = null
dn: java.lang.Double = null
scala> val dn2: Option[Double] = Option(dn)
java.lang.NullPointerException
at scala.Predef$.Double2double(Predef.scala:363)
at .<init>(<console>:8)
at .<clinit>(<console>)
at .<init>(<console>:11)
at .<clinit>(<console>)
at $print(<console>)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.call(IMain.scala:704)
at scala.tools.nsc.interpreter.IMain$Request$$anonfun$14.apply(IMain.scala:920)
at scala.tools.nsc.interpreter.Line$$anonfun$1.apply$mcV$sp(Line.scala:43)
at scala.tools.nsc.io.package$$anon$2.run(package.scala:25)
at java.lang.Thread.run(Thread.java:662)
scala> Option(dn)
res0: Option[java.lang.Double] = None
scala> Option(dn).asInstanceOf[Option[Double]]
res1: Option[Double] = None
The same thing happens with a conversion from java.lang.Integer to Option[Int]. The obvious workaround is to write
but it seems like you shouldn't need to do that.