修改前
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 语法。