Wouldn't there be a bug where if `invoke()` actually returned null, we'd incorrectly throw "No implementation for method $method"?
@PairingWithDuncan6 ай бұрын
Ooh good catch! Reflection is full of these little gotchas. Somewhere in the back of my mind when I was writing the code I was wondering about the implications of Map and how you tell the difference between not there and there but null. I should have listened to that voice.
@PairingWithDuncan6 ай бұрын
I think this fixes it val invocationHandler = this.getOrElse(method) { error("No implementation for method $method") } ?: error("Bad default logic for method $method") invocationHandler.invoke(args ?: emptyArray())
@Olekj6 ай бұрын
@@PairingWithDuncan sweet! Really enjoying your videos ❤️
@PairingWithDuncan6 ай бұрын
Thank you, it’s nice to have somewhere to play and share the joy of it.