Scala usually (apart from intrinsically error-prone things like I/O) keeps me from inadvertently shooting myself in the foot by virtue of its type checking system. But there are some features (which I sometimes need), like Map#apply(), or List#head that may throw errors.
Is there a way to tell the Scala compiler to warn me when I call something that may throw?
I realize these warnings might turn into a deluge as you go down the JVM rabbit hole, so I expect I'd need to filter out OutOfMemoryError and its kin, but I'm okay with that. Scala, as a platform, seems to be very much about safety, so I figure I'm just missing something simple — but Googling around for Scala warning options left me with only the -unchecked, -deprecation, and -feature flags, all of which I'm already using.
WartRemover can give you warnings for some of the more common problems with partial functions in the Scala core library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With