【问题标题】:Warning:scalac: there was one deprecation warning; re-run with -deprecation for details警告:scalac:有一个弃用警告;使用 -deprecation 重新运行以获取详细信息
【发布时间】:2018-05-23 16:32:25
【问题描述】:

在消息输出中注意这一点:

警告:scalac:有一个弃用警告;使用 -deprecation 重新运行以了解详细信息

这是什么意思?我应该重新运行什么?

我尝试重建和同步项目。但是警告信息仍然存在。

【问题讨论】:

  • 您的代码使用了一些已弃用的 API 或函数或类似的东西。如果您将 -deprecation 选项添加到 scalac 命令行,您将获得更多详细信息

标签: intellij-idea


【解决方案1】:

从命令行找到解决方案:

sbt
set scalacOptions in ThisBuild ++= Seq("-unchecked", "-deprecation")
compile

并找到了警告的原因:

[warn] Blah.scala:53: Adaptation of argument list by inserting () has been deprecated: leaky (Object-receiving) target makes this especially dangerous.
[warn]         signature: Logger.error(x$1: Any): Unit
[warn]   given arguments: <none>
[warn]  after adaptation: Logger.error((): Unit)
[warn]       logger.error()
[warn]                   ^
[warn] one warning found

问题是我使用了一个不推荐使用的函数调用logger.error()。奇怪的是,IntelliJ 没有给出任何 lint 错误。

参考:https://stackoverflow.com/a/9578787/1035008

【讨论】:

    猜你喜欢
    • 2015-03-09
    • 1970-01-01
    • 1970-01-01
    • 2012-03-23
    • 2013-04-29
    • 2014-07-18
    • 2021-02-21
    • 2014-07-18
    • 2020-12-05
    相关资源
    最近更新 更多