Can't cast anonymous class to kotlin.jvm.functions.Function1 at runtime


The question I asked on SO:

And I cannot reproduce it on a clean, minimal test project:

Could anyone, perhaps, figure out what’s happening based on the fact that object : HttpServiceHandler with explicit method override when created directly as the argument to addHandler() solves the problem, while returning that same object from newHandler() and giving it to addHandler() still throws the exception?

Most I can do is take screenshots of the original code, the relevant parts.

And um, I checked mvn dependency:tree and maven plugins - they’re the same versions and configurations and there’s no funny stuff with multiple versions of the same artifact.


Not positive it’s the same thing, but I just raised a similar issue with a similar ClassCastException and SAM interfaces.