0
点赞
收藏
分享

微信扫一扫

Groovy - Groovy ambiguous method overload


修改前

if (CollectionUtils.isEmpty(serviceGraph.getCallMap())) {
serviceGraph.setCallMap(new HashMap<String, Integer>())
}
Caused by: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method java.math.BigDecimal#<init>.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class [Map]
[class java.util.Collection]


修改后

if (CollectionUtils.isEmpty(serviceGraph.getCallMap() as Map)) {
serviceGraph.setCallMap(new HashMap<String, Integer>())
}
  • Ps:成功!这里涉及到 Groovy 的 as 语法。


举报

相关推荐

0 条评论