Welcome to Scala 2.13.12 (OpenJDK 64-Bit Server VM, Java 17.0.9).
Type in expressions for evaluation. Or try :help.
scala> :paste
// Entering paste mode (ctrl-D to finish)
import java.net.URI
case class SparkPath private (private val underlying: String) {
def copy(underlying: String = this.underlying): SparkPath = SparkPath(underlying)
}
object SparkPath {
def apply(underlying: String): SparkPath = new SparkPath(underlying)
}
// Exiting paste mode, now interpreting.
case class SparkPath private (private val underlying: String) {
^
<pastie>:3: error: constructor modifiers are assumed by synthetic `apply` method
Scala 3 migration messages are errors under -Xsource:3. Use -Wconf / @nowarn to filter them or add -Xmigration to demote them to warnings.
Applicable -Wconf / @nowarn filters for this fatal warning: msg=<part of the message>, cat=scala3-migration, site=SparkPath
Problem
I'm not sure if this is a bug, but besides adding @nowarn or removing the private modifier from the constructor, how should I define the apply method to avoid the above compilation error?
Reproduction steps
Scala version:2.13.12 with
-Xsource:3
Problem
I'm not sure if this is a bug, but besides adding
@nowarn
or removing theprivate
modifier from the constructor, how should I define theapply
method to avoid the above compilation error?