问题描述
我刚刚从 IDEA 12 升级到 13(社区版),从那以后我在 IDEA 中收到一个关于我的游戏项目不兼容类型的错误.
I just upgraded from IDEA 12 to 13 (community edition) and since then I get an error in IDEA about incompatible types for my play project.
Option<String> authHeaderOption = requestHeader.headers().get(AUTHORIZATION);
requestHeader 是 play.api.mvc.RequestHeader 类型.错误消息指出:
requestHeader is of type play.api.mvc.RequestHeader. The error message states:
Incompatible types. Found: 'scala.Option<java.lang.String>', required: 'scala.Option<java.lang.String>
所以它抱怨类型不兼容,但同时声明所需类型和找到的类型是相同的.
So it complains about types being incompatible but at the same moment states that required and found types are the same.
从播放控制台运行应用程序时一切正常,因此编译正常.
When running the app from play console everything works fine, so compilation works.
错误发生在调用scala play api的java类中.在升级 IntelliJ 之前没有这样的错误,所以它一定是 IDE 问题,但我还没有弄清楚是什么.
The error occurs in a java class that calls the scala play api. Before upgrading IntelliJ there was no such error so it must be an IDE issue but I have not been able to figure out what yet.
有没有人见过这种错误?
Has anyone seen this kind of error before?
推荐答案
点击File -> Invalidate Caches/Restart..."菜单项.
Hit the "File -> Invalidate Caches / Restart..." menu item.
这篇关于IntelliJ IDEA 13 给出关于不兼容类型的无效错误(Java-Scala-InterOp in Play)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!