This is a short post about an experience I had where the loss of type safety caused a nasty bug.
Look at the following code:
val tenYearsFromNow:Long = System.currentTimeMillis + 10 * 365 * 24 * 60 * 60 * 1000
It has a bug. Can you spot it?
The bug is that 10 * 365 * 24 * 60 * 60 * 1000 is computed as an integer and oveflows. tenYearsFromNow then holds a value that is twenty days from now.