Groovy - Groovy ambiguous method overload

简介: Groovy - Groovy ambiguous method overload

修改前

if (CollectionUtils.isEmpty(serviceGraph.getCallMap())) {
serviceGraph.setCallMap(newHashMap<String, Integer>())
}
Causedby: javax.script.ScriptException: groovy.lang.GroovyRuntimeException: Ambiguousmethodoverloadingformethodjava.math.BigDecimal#<init>.
Cannotresolvewhichmethodtoinvokefor [null] duetooverlappingprototypesbetween:
[class [Map]
[classjava.util.Collection]

修改后

if (CollectionUtils.isEmpty(serviceGraph.getCallMap() asMap)) {
serviceGraph.setCallMap(newHashMap<String, Integer>())
}
  • Ps:成功!这里涉及到 Groovy 的 as 语法。
目录
相关文章
|
Java
Java重载overload
Java重载overload
89 0
|
8月前
|
Java 程序员
Java中的强制类型转换(Explicit Type Casting)
Java中的强制类型转换(Explicit Type Casting)
251 0
|
8月前
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
Caused by: java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘quanZiController‘ method
59 0
|
Java
【Java异常】java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘xxx‘ method
【Java异常】java.lang.IllegalStateException: Ambiguous mapping. Cannot map ‘xxx‘ method
176 0
【错误记录】Groovy 函数参数动态类型报错 ( Caught: groovy.lang.MissingMethodException: No signature of method )
【错误记录】Groovy 函数参数动态类型报错 ( Caught: groovy.lang.MissingMethodException: No signature of method )
3050 0
【错误记录】Groovy 函数参数动态类型报错 ( Caught: groovy.lang.MissingMethodException: No signature of method )
|
JSON Java Scala
Scala中使用JSON.toJSONString报错:ambiguous reference to overloaded definition
问题描述: [ERROR] /Users/jack/book/lightsword/src/main/scala/com/springboot/in/action/filter/LoginFilter.
2315 0
【错误记录】Groovy 注入方法报错 ( Cannot add new method [hello] for arguments [[]]. It already exists )
【错误记录】Groovy 注入方法报错 ( Cannot add new method [hello] for arguments [[]]. It already exists )
162 0
【错误记录】Groovy 注入方法报错 ( Cannot add new method [hello] for arguments [[]]. It already exists )
【错误记录】Groovy 运行报错 ( Exception in thread “main“ groovy.lang.MissingMethodException: No signature of )
【错误记录】Groovy 运行报错 ( Exception in thread “main“ groovy.lang.MissingMethodException: No signature of )
931 0
【错误记录】Groovy 运行报错 ( Exception in thread “main“ groovy.lang.MissingMethodException: No signature of )
|
Java
Groovy - 探索之 invokeMethod 方法
Groovy - 探索之 invokeMethod 方法
233 0