Can someone explain why kotlin compiler (or ide?) ...
# getting-started
n
Can someone explain why kotlin compiler (or ide?) differentiates between these types of bugs? This was a problem for us
s
no idea, why there are different (or lack of) warnings. But in case you're not sure what the problem is in the first place:
::onEntityReady
returns the method, but doesn't invoke it. it works for
onError = ::postErrorEvent
because there it takes the place of the lambda. Once you put it inside curly braces (a lambda funtion), you have to actually invoke it, in this case
onError = {postErrorEvent(it)}
(with
it
being the default name of the single parameter expected by the function assigned to onError) more here: https://kotlinlang.org/docs/lambdas.html#instantiating-a-function-type
n
@Stephan Schroeder thanks for reply. We already figured that syntax for method reference with :: The "onError" is not a problem at all, the question is specifically about warning that IDE shows, which I assume developers didn't account for.
s
What is the actual warning on
::onEntityReady
?