scala.util.Success doesn't have an apply method but inherits the one from scala.util.Try (AFAIK). But all scala.util.Try.apply does is call Success.apply surrounded by a try catch block. How is this not infinitely recursive and how does this ever trigger the catch block?
No, scala's Success is a case class that inherits abstract class Try.
So the apply method is a built-in method generated by scala compiler, not inherited from the object Try.
Source https://github.com/scala/scala/blob/2.11.x/src/library/scala/util/Try.scala#L225
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