Search code examples
playframework-2.4intellij-15

IntelliJ IDEA 15 Play 2.4 reverse routing method parameter "string cannot be applied to java.lang.String"


I use IntelliJ IDEA 15.0.4 to develop a Java Play! 2.4.4 application. Since a few months (I think it was because of an IntelliJ update, but not 100% sure) the following problem occurs:

Whenever I call a reverse route from a controller that takes a String as a parameter, the parameter is displayed as an error with the following message:

methodName (string) in ReverseMyController cannot be applied to (java.lang.String)

Here's a code example:

public Result myAction(String myId) {
    // Do something...

    // Redirect back to referrer
    flash("success", "Action was a success");
    if(!myId.isEmpty()) return redirect(controllers.routes.MyController.showItem(myId));
    return redirect(controllers.routes.MyController.itemList(1));
}

In this example, the parameter myId passed to the method showItem would be error highlighted, like this.

I already tried fiddling with the Project Structure settings and searched Google, but to no avail. I hope somebody is able to help me with this, my OCD-self would really appreciate having a code base with no error hints again ;)


Solution

  • Yes, I meet the same issue as what you said. I think it is a bug of the IDEA 15.0.4, Have you tried to change to the older version before 15.0.4?