2

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:

  1. activator new testingScalac (choose play-scala from the template list)
  2. Add to build.sbt the flag with scalacOptions ++= Seq("-Ywarn-unused")
  3. 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

pedrorijo91
  • 7,635
  • 9
  • 44
  • 82

1 Answers1

0

Created an issue, it seems to be a Play framework problem: https://github.com/playframework/playframework/issues/6302

In the meanwhile a PR has been done that may fix: https://github.com/playframework/playframework/pull/7538

pedrorijo91
  • 7,635
  • 9
  • 44
  • 82