IntelliJ-成功编译后仍无法解析符号展平

时间:2018-07-17 00:09:12

标签: scala intellij-idea lift-json

我正在使用lift-json库来解析一些json。

当我使用sbt编译以下代码时,它编译成功。但是,在IntelliJ IDEA中,我看到红色的flatten,错误为cannot resolve symbol flatten。我拥有最新版本的IDEA(社区2018.1.6)。

val brokerJson = """{  
    "broker":[  
        {  
            "listener_security_protocol_map":{  
                "SASL_PLAINTEXT":"SASL_PLAINTEXT",
                "SASL_SSL":"SASL_SSL"
            },
            "endpoints":[  
                "SASL_PLAINTEXT://blah1:1111",
                "SASL_SSL://foo1:2222"
            ],
            "jmx_port":9281,
            "host":null,
            "timestamp":"9287392929",
            "port":-9,
            "version":21
        },
        {  
            "listener_security_protocol_map":{  
                "SASL_PLAINTEXT":"SASL_PLAINTEXT",
                "SASL_SSL":"SASL_SSL"
            },
            "endpoints":[  
                "SASL_PLAINTEXT://blah2:1111",
                "SASL_SSL://foo2:2222"
            ],
            "jmx_port":9281,
            "host":null,
            "timestamp":"9287392929",
            "port":-9,
            "version":21
        }
    ]
    }"""

val brokerHosts =
    (for {
      JObject(o) <- brokerJson
      JField("endpoints", ends) <- o
    } yield {
      val allEndpoints = ends.children
      Option(allEndpoints.filter(x => x.values.toString.startsWith("SASL_SSL://")).head.values.toString.replace("SASL_SSL://", ""))
    }).flatten.toArray

我尝试使缓存无效,然后重新启动,更新所有插件(包括Scala插件)​​,重建甚至重新安装IDEA。

可能是什么原因和解决方法?

0 个答案:

没有答案