【发布时间】:2016-11-10 03:59:00
【问题描述】:
import com.alibaba.fastjson.JSON
object test {
def main(args: Array[String]) = {
val map = new util.HashMap[CharSequence, CharSequence]()
map.put("123", "22333")
map.put("test", null)
val ret = JSON.toJSONString(map)
println(ret)
}
}
toJSONString 函数:
public static String toJSONString(Object object) {
return toJSONString(object, emptyFilters, new SerializerFeature[0]);
}
public static String toJSONString(Object object, SerializerFeature... features) {
return toJSONString(object, DEFAULT_GENERATE_FEATURE, features);
}
错误:
Error:ambiguous reference to overloaded definition,both method toJSONString in object JSON of
type (x$1: Any, x$2: com.alibaba.fastjson.serializer.SerializerFeature*)String
and method toJSONString in object JSON of
type (x$1: Any)String
match argument types (java.util.HashMap[CharSequence,CharSequence])
val ret = JSON.toJSONString(map)
【问题讨论】:
-
issues.scala-lang.org/browse/SI-8344 其中
f(a,b,c)可以视为f(Tuple3(a,b,c))。
标签: java scala reference ambiguous