在我的播放应用中,我有一个包含公共文件路由的路由文件。最近我添加了-Ywarn-unused
编译器标志,并且我收到了一些意外的警告。
步骤:
activator new testingScalac
(从模板列表中选择play-scala)build.sbt
scalacOptions ++= Seq("-Ywarn-unused")
标记
GET /favicon.ico controllers.Assets.at(path="/public",file="/images/favicon.ico")
GET /favicon.png controllers.Assets.at(path="/public",file="/images/favicon.png")
GET /robots.txt controllers.Assets.at(path="/public",file="robots.txt")
现在,运行sbt compile
会返回:
$ sbt compile
[info] Loading project definition from /Users/pedrorijo/git/testRepos/testingScalac/project
[info] Set current project to testingScalac (in build file:/Users/pedrorijo/git/testRepos/testingScalac/)
[info] Compiling 4 Scala sources and 1 Java source to /Users/pedrorijo/git/testRepos/testingScalac/target/scala-2.11/classes...
[warn] /Users/pedrorijo/git/testRepos/testingScalac/conf/routes:15: local val in method at is never used
[warn] GET /favicon.ico controllers.Assets.at(path="/public",file="/images/favicon.ico")
[warn] /Users/pedrorijo/git/testRepos/testingScalac/conf/routes:16: local val in method at is never used
[warn] GET /favicon.png controllers.Assets.at(path="/public",file="/images/favicon.png")
[warn] /Users/pedrorijo/git/testRepos/testingScalac/conf/routes:17: local val in method at is never used
[warn] GET /robots.txt controllers.Assets.at(path="/public",file="robots.txt")
[warn] three warnings found
[success] Total time: 10 s, completed Jul 5, 2016 3:11:28 PM
我在路由文件上做错了什么,或者它是一个playframework /编译器错误(我查看了github并且找不到与此相关的任何内容)?
注意:它使用play 2.5.4但它也发生在play 2.4.x
上
答案 0 :(得分:0)
创建了一个问题,它似乎是一个Play框架问题:https://github.com/playframework/playframework/issues/6302
与此同时,PR已经完成,可以解决:https://github.com/playframework/playframework/pull/7538