Hi! I got a strange-looking error for extend-protocol:
β― echo '(defprotocol IByteArray (-to-bytes [this])) (extend-protocol IByteArray (Class/forName "[B") (-to-bytes [_]))' | clj-kondo --lint -
<stdin>:1:88: error: Function name must be simple symbol but got: "[B"
linting took 28ms, errors: 1, warnings: 0
This has come up several times here. Search for Class/forName. This behavior isnβt officially supported by Clojure
got it. thanks!
btw, perhaps you can use one of the new clojure 1.12 features here if you're willing to give 1.12 a try
user=> (= byte/1 (Class/forName "[B"))
truethanks, but I have to wait for the release π looks like for now the only option is to ignore entire form
I don't think that's supported yet by clj-kondo, darn ;)
yeah probably
the recommended approach is to use extend directly
as (Class/forName ..) isn't officially supported by Clojure in defprotocol
it just happens to work by accident. if you have multiple of those, it will fail
right, it should work as well. I'll try this
1.12 is already an RC! We're using Beta 1 and Beta 2 in production already.
yes, but unfortunately clj-kondo still doesn't support byte/1 as opposed to byte* which was an old thing
I bumped that issue to high priority now, should be in the next release
I get the impression that only a handful of companies really help test the Clojure prerelease builds π
yeah, the real tests begin with an official release, I even notice that with my own projects ;)
I wonder how to incentivize that better.