Play doesn't convert java-list to scala-list

会有一股神秘感。 提交于 2020-02-07 03:44:08

问题


I have a controller which hands a java-list of model-objects to the view exactly the way like it's done in the examples.

The compiler throws an error that it can't convert from java.util.List to scala.collection.immutable.List. I have no clue what I should do.

[error] /myapp/myappsubprojects/frontend/app/controllers/frontend/MyController.java:15: error: method render in class linklist cannot be applied to given types;
[error]         return ok(linklist.render("link test", Link.findAll()));
[error]                           ^
[error]   required: String,scala.collection.immutable.List<Link>
[error]   found: String,java.util.List<Link>
[error]   reason: actual argument java.util.List<Link> cannot be converted to scala.collection.immutable.List<Link> by method invocation conversion
[error] 1 error

Note: I'm using subprojects (common, frontend, backend) and I had a hard time to make everything run properly. Probably it's related to that.


回答1:


I went fishing for details and ended up (luckily) answering the question in my comment



来源:https://stackoverflow.com/questions/16116264/play-doesnt-convert-java-list-to-scala-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!