clj-kondo 2025-01-24

How do you use (Class/forName) for a Java String array? When I try to use (Class/forName "[Ljava.lang.String;") I get the following error:

error: Function name must be simple symbol but got: "[Ljava.lang.String;"

Or I should simply use? java.lang.String/1?

if you're using 1.12 already, then java.lang.String/1 is preferable, I think

👍 1

Isn’t this a false error, though?

user=> (Class/forName "[Ljava.lang.String;")
java.lang.String/1
seems to work fine (EDIT: homerdisappear )

Yes, it does work fine, but clj-kondo throws a warning

clj-kondo is correct since the Class/forName hack only works by accident, but luckily we have clojure 1.12 now

👍 2

error message could be a little clearer though

Yeah, that could have helped

The title reflects that:

(proposal: say that it must be a simple symbol)
so I'll move this to a higher priority

or wait, it shouldn't be a simple symbol, in this case

whatever, I'll make a note

Alex Miller (Clojure team) 2025-01-24T16:51:33.492619Z

that's not a hack that works by accident, that's how Class/forName works

in extend-protocol calls?

Alex Miller (Clojure team) 2025-01-24T16:54:20.301789Z

oh, I missed that context at top

👍 1
Alex Miller (Clojure team) 2025-01-24T16:55:22.429659Z

I think symbol is certainly now preferred there

You are a beast, @borkdude!