On my play app, I have a routes file with routes for public files. Recently I added the -Ywarn-unused
compiler flag, and I'm getting some unexpected warnings.
Steps:
activator new testingScalac
(choose play-scala from the template list)- Add to
build.sbt
the flag withscalacOptions ++= Seq("-Ywarn-unused")
- Add to the routes file:
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")
Now, running 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
Am I doing something wrong on the routes file, or is it a playframework/compiler bug (I looked in github and couldn't find anything related to this)?
Note: it uses play 2.5.4 but it also happens on play 2.4.x