It is possible to extend protocols to primitive arrays but specifying the class for the type is a little tricky:
However, things go bad if you try to do more than one of these:
The code in {parse-impls} is seeing the second {(Class/forName "[I")} as a function, not as a new type. One workaround for this is to only extend the protocol to one type at a time.
It would be even better (moving into enhancement area) if there was a syntax here to specify primitive array types - we already have the syntax of {bytes, ints, longs}, etc for type hints and those seem perfectly good to me.
It also breaks when extending only one array type:
But changing the declaration order fixes it:
Dupe of
On further inspection, I don't think this is a dupe of but merely a related problem.
Using Class/forName has a further problem, as type-hints on the this parameter are longer emitted:
Reflection warnings are also generated for non-primitive arrays (so just supporting ints etc, won't completely fix this problem). It would be good to have a solution which covered all the problems with extending protocols to arrays.