Scala/Java interop: class type not converted?

会有一股神秘感。 提交于 2019-12-08 04:06:26

The problem is that in Scala, Boolean <: AnyVal <: Any, while java.lang.Boolean <: AnyRef <: Any. Since <? super java.lang.Boolean> means java.lang.Boolean or any superclass of it, you must fall into the AnyRef side of things. Unboxing is not enough; Boolean still places you on the AnyVal side of the type hierarchy even if you would box it into a java.lang.Boolean.

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