lsp

JR 2026-04-17T00:56:47.828789Z

I was looking to see what's necessary to fix issue https://github.com/clojure-lsp/clojure-lsp/issues/2156 which says that in the code

(let [^Future| fut ,,,] ,,,)
"import java.util.concurrent.Future" isn't show as a Code Action. I messed around with add-missing-libspec-test and noted that it seems as if only java.io.File (which is actually being added via a fixture loaded with (h/load-java-path ,,,)) is available. Import for java classes in the JDK doesn't seem to work anywhere, even without the class being in a type hint. For example, with
(Vecto|r.)
I don't see any import options for code fixes. I did verify that I can jump into the sources for java.util.concurrent.Future and java.util.Vector, etc... Are import suggestions for Java JDK classes supposed to work or is this a config issue on my part?

JR 2026-04-20T15:16:45.900829Z

I tried both changing db.transit.json to version 12 (via opening the file in emacs), and increasing the version to 14 in db.clj. But in both cases db.transit.json was automatically regenerated. I guess the version isn't the issue. I'll keep this in mind, but I'm out of ideas for now

ericdallo 2026-05-06T12:24:16.444009Z

that explains a lot!

JR 2026-05-06T21:26:27.310369Z

It looks like this is due to 1) something removing the ~/.cache/clojure-lsp/db.transit.json file, and 2) running unit tests ( bb test )

JR 2026-05-06T21:28:17.962939Z

It's probably a good idea to isolate the unit tests with a mock or a temporary directory It might also be a good idea to somehow validate db.transit.json, if that's possible without killing performance

JR 2026-05-06T21:29:13.647389Z

The good news is that, if I'm right, this shouldn't be an issue for most users

ericdallo 2026-05-06T22:54:38.730599Z

yeah, I already faced that and saw other people having that, so I wonder if it affect really few users

ericdallo 2026-04-18T16:01:59.795219Z

> db.transit.json seems to be global clj-kondo data about the JDK files (I could be wrong!). Yep, we just save in global cache the jdk analysis as it doesn't make sense to save per repo/project the same analysis all the time, I suspect there is the issue

ericdallo 2026-04-18T16:02:19.378969Z

I doubt the version changed, it's been a while I don't bump version Hum, not sure actually if could be a version change

ericdallo 2026-04-18T16:02:59.434439Z

Yeah I always forget to ask people to copy the old db.transit 😅

ericdallo 2026-04-18T16:03:13.848979Z

It's funny tho, I never got this issue myself

JR 2026-05-06T02:25:18.551899Z

I saw this again and opened https://github.com/clojure-lsp/clojure-lsp/issues/2285 about it. The local cache data seems to be written to the global cache, overwriting the jdk files.

ericdallo 2026-04-17T01:15:17.626609Z

but yes, this comes from java analysis, which we do for jdk if found in user installation in many ways

ericdallo 2026-04-17T01:15:34.028899Z

ericdallo 2026-04-17T01:16:15.498229Z

we do have some inconsistency bug with jdk analysis, which usually is solved removing the global jdk cache in ~/.cache/clojure-lsp/jdk and restarting lsp

JR 2026-04-17T20:12:56.426189Z

You're right! I removed ~/.cache/clojure-lsp/jdk, restart clojure-lsp, and now the import shows up, even in Calva. It seems like https://github.com/clojure-lsp/clojure-lsp/issues/2156 could be closed with this. I wonder what could cause this? Maybe I upgraded my JDK but didn't clear the cache?

ericdallo 2026-04-17T20:21:33.101709Z

yeah TBH this happens since I implemented java analysis, it's some cache issue I never figured it out

JR 2026-04-17T20:23:57.113099Z

Strange. When I diffed the newly rebuilt "jdk" from the ~.cache/clojure-lsp/jdk there were no differences from the jdk directory I had moved away. Maybe just updating the timestamp changes things

ericdallo 2026-04-17T20:25:24.950189Z

yeah I doubt is jdk change, it's something else with kondo anaysis

JR 2026-04-17T21:19:11.804419Z

Very interesting... it seems that there is also a /.cache/clojure-lsp/db.transit.json. I didn't save that (doh!) but it was recreated after I removed /.cache/clojure-lsp/jdk. I'm guessing it is loaded into (:analysis db) because I now see quite a lot of data there whereas before there wasn't much. (I'm pretty sure about this, although I could be wrong!) Indeed, from the code in add-missing-libspec/find-missing-imports, I can do a get-in of db for [:analysis <jarfile> :java-class-definitions] which is kinda what this is using to do find-missing-imports. db.transit.json seems to be global clj-kondo data about the JDK files (I could be wrong!). So maybe db.transit.json was corrupted or it somehow didn't get loaded correctly in db.clj? Or maybe the version changed? (I see the version changed from 12 to 13 recently) I can experiment with that, but otherwise I'll just have to hope I get this corruption again. Too bad I don't have a copy of db.transit.json!

ericdallo 2026-04-22T13:18:13.319239Z

good test