Any reason why clj-kondo doesn't lint (Foo.)
as unresolved-symbol
but it does when Foo.
without the parens? ๐งต
The second one might be a constructor call for a class that's available
but the class is not imported, shouldn't lint as something like that?
you don't have to import a class to be able to use it
I didn't know about it, besides java.lang is there other classes that one can configure to use without import?
you can use any class without importing it by using the classname
and in this case Foo
is a single segment class name
Oh yeah, it makes sense, you mean java.util.Date
would be valid right?
The check for class names used to include a dot, but I lifted this since some people did have single segment classes
yes
I see, that's what I was about to suggest
you can probably find a unit test that explicitly supports this
and some issue number
hahah no problem, I can see now why don 't restrict that
darn, now I'm curious myself what the issue number was ;)
hahahaha sorry
I can find one here: https://github.com/clj-kondo/clj-kondo/issues/950 but that doesn't have this example
that was just relaxing foo.bar.Baz
to foo.Baz
there might be some rule in clj-kondo that says: if the call ends with a dot, just leave it alone, since it's a constructor and people know what they are doing with classes
yeah, I see, It would be really cool to find some way to lint that, but I can't think in anything that would always work/makes sense
if Foo
was a record or deftype you would probably use ->Foo
instead
Would be hard to make clj-kondo support java classes arglists/docs in analysis output? ๐งต
I think would be necessary to add support for java classes analysis that probably is no easy task
I mean, I'd like to get a docs or signature of a java class via clojure-lsp
Maybe try adding a warning for a constructor call that only has a single segment and see if this breaks any tests
It could be that clj-kondo is just too relaxed for this case
ATM, java usages are just var-usages
buckets, it'd be necessary to have a var-definition
for those I think
clj-kondo doesn't analyze Java source code
but you could maybe retrieve those using reflection and put them somewhere
hum, it would be nice
currently clj-kondo uses some javadoc stuff to store all this info
but reflection might have been a better choice, easier
you mean clojure.java.javadoc?
no, the javadoc
command
https://github.com/clj-kondo/clj-kondo/blob/master/extract/clj_kondo/impl/ExtractJava.clj
https://github.com/clj-kondo/clj-kondo/blob/master/script/extract-java