Search code examples
scalasbtscalac

Scala: The `-` [dash, minus] command is deprecated in favor of `onFailure` and will be removed in 0.14.0


When I'm doing sbt compile -feature on my Scala project I get a mysterious warnings:

The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0

I have no clue what that dash/minus command is or where it is possibly being used. Searching for it on google is impossible, as well as grepping the code base for it (There are just /so/ /many/ /dashes/).

If at least I knew where it is defined. I could not find anything in the scala doc either.


Solution

  • I think you're looking for this:

    // commands with poor choices for names since they clash with the usual conventions for command line options
    //   these are not documented and are mainly internal commands and can be removed without a full deprecation cycle
    object Compat {
        def OnFailure = "-"
        ...
        def OnFailureDeprecated = deprecatedAlias(OnFailure, BasicCommandStrings.OnFailure)
        ...
        private[this] def deprecatedAlias(oldName: String, newName: String): String =
            s"The `$oldName` command is deprecated in favor of `$newName` and will be removed in 0.14.0"
    }
    

    Source here

    Also, kind-of related question and pieces of information can be found here, especially how to add the -feature to scalac options.