如何获取有关“功能"标志警告的更多信息?
使用 Play2 编译应用程序时,有时我的终端上会出现以下消息:
When compiling an application with Play2, sometimes these kind of message appears on my terminal :
[info] 将 1 个 Scala 源代码编译到 ~/target/scala-2.10/classes...
[警告] 有 1 个功能警告;使用 -feature 重新运行以了解详细信息
[警告] 发现一个警告
[成功] 1s编译完成
[info] Compiling 1 Scala source to ~/target/scala-2.10/classes...
[warn] there were 1 feature warnings; re-run with -feature for details
[warn] one warning found
[success] Compiled in 1s
如何获得有关这些警告的更多信息?它必须是 sbt 的一个选项,但我不知道在哪里搜索......
How can I get more information about those warning? It must be an option of sbt but I have no idea where to search...
推荐答案
要查看确切的消息,您需要在 sbt 构建定义文件中添加feature"标志:
To see the exact message you need to add "feature" flag in your sbt build definition file:
scalacOptions ++= Seq("-feature")
为什么?Scala 2.10 不仅引入了新特性,还重新调整了旧特性——一些最强大的 scala 特性被隐藏了,因为它们应该以极大的责任感来使用:有时他们被错误地使用了.这就是 SIP-18 出现的原因.从现在开始,要访问动态、高级类型、存在类型和其他一些东西,您必须显式启用它们.
Why? Scala 2.10 not only introduced new features, but also reshuffled older ones -- some of the most powerful scala features were hidden because they should be used with great responsibility: sometimes they were used mistakingly. That is why SIP-18 has arised. From now on, to access dynamics, higher kinds, existential types and some other things you have to explicitly enable them.
相关文章