Asset Issues with Upgrade to Play 2.6 Scala


(Neil Chaudhuri) #1

I am upgrading from 2.5.x to 2.6.17, and after a fair bit of work I feel like I am close–except for my assets. I am doing some mildly unconventional things like compile-time DI and using a class to help resolve assets.

The first weird thing is I get assetsFinder from mixing in _root_.controllers.AssetsComponents. Why do I need that _root_ thing? Not a huge deal but weird. I digress.

My routes file looks like this:

GET           /assets/*file                                              controllers.Assets.at(file)
GET           /versionedAssets/*file                              controllers.Assets.versioned(file)

GET           /robots.txt                                                controllers.Assets.at(file="robots.txt")

IntelliJ strikes through the function calls saying I should inject Assets. Bug?

I also get warnings:

[warn] patterns after a variable pattern cannot match (SLS 8.1.1)
[warn] If you intended to match against parameter file of method at, you must use backticks, like: case `file` =>
[warn] GET           /assets/*file                                              controllers.Assets.at(file)
[warn] unreachable code due to variable pattern 'file' on line 26
[warn] If you intended to match against parameter file of method at, you must use backticks, like: case `file` =>
[warn] GET           /robots.txt                                                controllers.Assets.at(file="robots.txt")
[warn] routes:151: unreachable code
[warn] GET           /robots.txt 

FYI Line 26 looks like this:

DELETE        /files                                                     com.myapp.MyClass..deleteFile(key:String)

Can you explain why I get these warnings and how to resolve them?

Thanks.