无法解析符号asJava:Intellij idea

时间:2017-04-18 01:19:02

标签: scala intellij-idea

我一直在做关于intellij想法的scala编码。一切顺利,直到我添加了这段代码(从https://stackoverflow.com/a/32380463/444644复制):

  def toJava(x: Any): Any = {
    import scala.collection.JavaConverters._
    x match {
      case y: scala.collection.MapLike[_, _, _] =>
        y.map { case (d, v) => toJava(d) -> toJava(v) } asJava
      case y: scala.collection.SetLike[_,_] =>
        y map { item: Any => toJava(item) } asJava
      case y: Iterable[_] =>
        y.map { item: Any => toJava(item) } asJava
      case y: Iterator[_] =>
        toJava(y.toIterable)
      case _ =>
        x
    }
  }

这导致两个"错误"上面的前两个asJava调用的亮点。但代码编译并运行良好。如何解决?

Screenshot

0 个答案:

没有答案