Fork me on GitHub
#clj-kondo
<
2022-07-23
>
Joshua Suskalo22:07:59

@borkdude looks like the unused import linter currently doesn't understand usages of the class in the :gen-class ns clause

borkdude22:07:48

can you post an example?

Joshua Suskalo22:07:51

(ns <redacted>
  (:import
   (com.mongodb.kafka.connect.sink MongoSinkTopicConfig)
   (com.mongodb.kafka.connect.sink.processor PostProcessor))
  (:gen-class
   :name "<redacted>"
   :extends PostProcessor
   :constructors {[MongoSinkTopicConfig] [MongoSinkTopicConfig]}))

Joshua Suskalo22:07:21

This is what I'm currently working on where I spotted it

borkdude22:07:54

ok, so you're importing it to use it within gen class?

borkdude22:07:11

issue welcome

borkdude22:07:27

if you can, make a repro with a standard JDK class which I can run locally

Joshua Suskalo19:07:12

Okay, turns out this should be an error.

Joshua Suskalo19:07:33

Because apparently the classes in your import clause aren't available in the gen-class form

Joshua Suskalo19:07:37

so you need to fully-qualify them.

borkdude19:07:40

I guess it matters in which order you put those clauses

Joshua Suskalo19:07:01

Nope, I have the order in a way that should make sense, but it still resolves non-qualified class names as being from java.lang