下面的代码由于带有红色下划线的check
为lambda参数类型添加了屏幕截图,代码:
handledExceptions.forEach { exceptionClass ->
exceptionClassToHandler.compute(exceptionClass.java) { clazz, existingHandler ->
check(null == existingHandler) { "There's already a handler registered for ${clazz.name}" }
{ e: Throwable -> handlerMethod.invoke(bean, exceptionClass.java.cast(e)) }
}
}
要求赔偿的
None of the following functions can be called with the arguments supplied:
[ERROR] public inline fun check(value: Boolean): Unit defined in kotlin
[ERROR] public inline fun check(value: Boolean, lazyMessage: () -> Any): Unit defined in kotlin
如果我注释掉check
,代码可以很好地编译。
(或替换为
if(existingHandler != null){
throw IllegalStateException("There's already a handler registered for ${clazz.name}")
}
)
我觉得我缺少明显的东西。为什么支票无法编译,我该怎么办?