-
-
Notifications
You must be signed in to change notification settings - Fork 649
cider-doc doesn't work for Java classes (JDK 8 and JDK 9+) #2732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the great issue report! I was aware of the problems on Java 9+, but I had definitely missed the regression on Java 8. I'll ping here @jeffvalk as well, as he's our resident expert on the subject. I think there are also a couple of related tickets floating around. |
Here's the related ticket covering Java 9+ #2687 |
I'd like to add that the first solution only works when Besides, I was incorrect to hint that the root cause was In summary, loading It is indeed the case with Clojure command line tools:
It is also the case with I think nrepl/nrepl#113 (comment) implemented the second solution I suggested above. |
Note that both solutions are required for |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution and understanding! |
Expected behavior
cider-doc displays the documentation for Java classes, e.g. in JDK 8:
Actual behavior
cider-doc fails to display the documentation for Java classes (JDK8 and JDK 9+)
Java 8:
Java 13:
Steps to reproduce the problem
./test/src/test/core.clj
in Emacs andcider-jack-in
to the projectcider-doc
withC-c C-d C-d
, type in String, and returnProblem
Java 8: Loading orchard.java in
lein repl
fails becausetools.jar
is not visible to the classloader oforchard.java/source-info
, which makes loadingorchard/java/legacy_parser.clj
unsuccessful.Java 13: Loading orchard.java
in lein-repl
works.Debugging Notes
cider-bisect.txt
cider-nrepl-bisect.txt
orchard-bisect.txt
Java 8: Loading orchard.java in
lein repl
fails becausetools.jar
is not visible to the classloader oforchard.java/source-info
, which makes loadingorchard/java/legacy_parser.clj
unsuccessful.cider-jack-in
toorchard
in Emacs.For d9f444fc91e07a17ed106afe5fd02dd5bceb87a7:
tools.jar
andsrc.zip
are added toclojure.lang.DynamicClassLoader@4bd059cd
orchard.java/source-info
issun.misc.Launcher$AppClassLoader@33909752
which is not modifiableSimilarly for b83826f42604f5f9bf59e25a535ef9d3ddb3c5db:
At both commits,
[org.tcrawley/dynapath "1.0.0"]
is used which makes URLClassLoader non-modifiable. Note that @jeffvalk attempted to address this issue in clojure-emacs/orchard@314c84a (according to clojure-emacs/orchard#50 (comment)).Java 8: Loading orchard.java
in lein-repl
workscider-jack-in
toorchard
in Emacs.For d49e659f9f46381bdf3589b32b5969b263989c4d:
Solution
Load
orchard.java
before loading the middlewares.cider-doc
works again (JDK 8 and JDK 9+) sotools.jar
must be visible to the classloader oforchard.java/source-info
. However, the classloader oforchard.java/source-info
is not modifiable so I'm not sure how this solution works.As recommended by dynapath, add a modifiable URLClassLoader subclass as the highest loader of the (cider) enviroment.
Test coverage (or why I believe this problem went undetected)
orchard.java-test/source-info-test is conditional on whether
tools.jar
is visible to the classpath of orchard.java/source-info.However, even when I ran the tests unconditionally, they still passed (?!). I'm not sure how to improve this.
Comment
I'd appreciate pointers to learn more about this. Thank you for your time and effort in building cider.
Environment & Version information
CIDER version information
Lein/Boot version
Emacs version
Operating system
Fedora 30:
The text was updated successfully, but these errors were encountered: