play framework路由文件编译警告:local val in method at is never used

Play framework route file compilation warning: local val in method at is never used

在我的播放应用程序中,我有一个路由文件,其中包含 public 个文件的路由。最近我添加了 -Ywarn-unused 编译器标志,但收到了一些意外警告。

步数:

  1. activator new testingScalac(从模板列表中选择 play-scala)
  2. 添加到build.sbt带有scalacOptions ++= Seq("-Ywarn-unused")
  3. 的标志
  4. 添加到路由文件:

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 returns:

$ 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/compiler 错误(我查看了 github 但找不到与此相关的任何内容)?

Note: it uses play 2.5.4 but it also happens on play 2.4.x

创建了一个问题,似乎是 Play 框架问题:https://github.com/playframework/playframework/issues/6302

与此同时,PR 已经完成,可能会修复:https://github.com/playframework/playframework/pull/7538