Scala

Scala

Made by DeepSource

Universal apply methods make the new keyword redundant SC-R1069

Anti-pattern
Major

In Scala 2, the new keyword was required to instantiate a class. However, case classes were an exception as an appropriate apply() is automatically generated for them, thus making the new keyword redundant. In Scala 3, this concept has been generalized to all concrete classes. Therefore, you can safely drop the new keyword.

Bad Practice

val sb = new StringBuilder()

Recommended

val sb = StringBuilder()