When doing this:
def myfunction(line: String): (Int, Option[DateTime], Option[Int]) = { // do some stuff (5, Option(null), Option(null)) }
Option(null) has a lower bound of Option[Null], where Null is the bottom-type of all reference types. Int is a value type, and not a reference type. i.e. you can't assign null to an Int. So you can't assign Option[Null] to Option[Int].
Option(null)
Option[Null]
Null
Int
null
Option[Int]
Use Option.empty[Int] or None instead.
Option.empty[Int]
None