Is there a compile-time check that a type that's stated as implementing a protocol actually implements it?

The one thing I miss from Java is the ability to say “this type of thing implements these methods” and have the compiler alert me if it doesn’t.

Given that Clojure has defprotocol / defrecord which kinda map to interfaces and classes, I’m surprised that the compiler doesn’t warn me if I say that a record type implements a protocol and then doesn’t implement functions for it.

But then I know that the Clojure way isn’t to have the compiler enforce things, but have linters do it. So it would seem natural for clj-kondo to do this. But AFAICT it doesn’t.

Is there a Kondo plugin for this? Or any other way of checking up-front that I’ve remembered to implement everything I say I’m implementing?

Clj-kondo could check this, but it currently doesn’t.

There is an issue for it here:

Feel free to give it a thumbs up so it will be prioritized.

3 Likes