Fork me on GitHub
#cider
<
2023-12-17
>
Carsten Behring18:12:53

Playing with enrich-classpath, I dont get the JDK sources recognized. Doing this : (-> Thread class->source println) as documented returns nill

Carsten Behring18:12:17

The "classpath" looks good and seem to contain a directory with the unpacked java files: /home/vscode/.cache/mx.cider/unzipped-jdk-sources/11021 The contents of this directory is again a folder structure:

java.base
java.compiler
java.datatransfer
java.desktop
...
and the the folder java.base contains the source of class Thread But somehow class->source does not find it.

Carsten Behring18:12:32

This is interesting:

user=> (io/resource "/home/vscode/.cache/mx.cider/unzipped-jdk-sources/11021")
nil
user=> (io/resource "java/lang/Thread.java")
but this works:
user=> (io/resource "java.base/java/lang/Thread.java")
#object[java.net.URL 0x42fcc7e6 "jar:file:/usr/lib/jvm/msopenjdk-current/lib/src.zip!/java.base/java/lang/Thread.java"]

Carsten Behring18:12:28

So this code seem to be "too simple" to work in all cases:

(defn class->source [class-object]
  {:pre [(class? class-object)]}
  (-> class-object pr-str munge (string/replace "." "/") (str ".java") (io/resource) slurp))
As it does not take "modularisation" of tke JDK (sources) into consideration

vemv19:12:26

Maybe I wrote that part of the readme too long ago I take it that you got it fixed? https://github.com/clojure-emacs/enrich-classpath/pull/61 The way we use this stuff is https://github.com/clojure-emacs/orchard which uses the module system as needed

Daniel Slutsky21:12:45

A short demo integrating the https://scicloj.github.io/clay/ tool for datavis & literate programming with #cider: https://www.youtube.com/watch?v=fd4kjlws6Ts This follows yesterday's demo using #calva. This time, we are looking into an image-processing use case. BTW I use the https://github.com/corgi-emacs/corgi Emacs configuration by @plexus & friends, which is so lightweight and nice for Clojure. Anyway, the demo does not rely on this specific config.

cider 3
❤️ 1