播放不会将Java列表转换为Scala列表 [英] Play doesn't convert java-list to scala-list

查看:65
本文介绍了播放不会将Java列表转换为Scala列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个控制器,它按照与示例中相同的方式将模型对象的Java列表移交给视图.

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.

编译器抛出一个错误,它无法从java.util.List转换为scala.collection.immutable.List.我不知道该怎么办.

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.

推荐答案

我去钓鱼了一些细节,最终(幸运地)在我的

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

这篇关于播放不会将Java列表转换为Scala列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆