In Scala,
{ x: Option[Int] => x }
.getClass
.getMethod("apply", classOf[Option[_]])
.getGenericParameterTypes
returns Array(scala.Option<java.lang.Object>)
. I'd initially been expecting to see instead Array(scala.Option<scala.Int>)
, but I see that scala.Int
is a value class (extends AnyVal
) 'whose instances are not represented as objects by the underlying host system'.
I still don't understand the erasure to Object
, though. Couldn't it be the much more useful java.lang.Integer
?