AutoCloseable
for closing resources SC-R1052The highlighted close
method functionally resembles that of AutoCloseable
's. AutoCloseable
is an interface that classes can inherit in scenarios where they hold resources that are to be closed. Consider refactoring your code to utilize this interface if possible.
class C {
def close(): Unit = {
//
}
}
class C extends AutoCloseable {
override def close(): Unit = {
//
}
}
// Usage
Using(new C()) {c =>
//
}