Scala:`-` [dash,minus]命令不推荐使用`onFailure`,将在0.14.0中删除

scr*_*avy 9 scala sbt scalac

当我sbt compile -feature在我的Scala项目上做的时候,我收到了一个神秘的警告:

The `-` command is deprecated in favor of `onFailure` and will be removed in 0.14.0
Run Code Online (Sandbox Code Playgroud)

我不知道那个破折号/减号命令是什么或它可能被使用的地方.在谷歌上搜索它是不可能的,也不可能为它编写代码库(只有/ so// many//破折号/).

如果至少我知道它的定义.我在scala doc中也找不到任何东西.

Pat*_*iek 3

你正在寻找这个:

// 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"
}
Run Code Online (Sandbox Code Playgroud)

来源在这里

另外,可以在这里找到类似的相关问题和信息,特别是如何添加-feature到 scalac 选项。