Reports unclosed scala.io.Source
.
Using a function like .mkString
or .getLines
directly on Source
opened by
fromFile
, fromURL
, or fromURI
will leak the underlying file handle.
Consider using .close()
with try
/finally
to manage the resource's lifetime
or use Scala 2.13's Using
.
Example:
Source.fromFile("file.txt").getLines()