-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Tab completion with Leiningen REPL after typing a period in a namespace triggers an NPE #2380
Comments
Thanks for reporting this. It's probably a bug in the clojure-complete library, so it will need to be fixed in https://github.com/ninjudd/clojure-complete/issues
|
Great, I've opened an issue over there. |
I tried reproducing this but it works fine for me. I tried a test on clojure-complete ➜ foo-2380 lein repl
nREPL server started on port 50500 on host 127.0.0.1 - nrepl://127.0.0.1:50500
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
Java HotSpot(TM) 64-Bit Server VM 1.8.0_102-b14
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> clojure.core
clojure.core clojure.core.ArrayChunk clojure.core.ArrayManager clojure.core.Eduction clojure.core.IVecImpl
clojure.core.Vec clojure.core.VecNode clojure.core.VecSeq clojure.core.protocols clojure.core.protocols.CollReduce
clojure.core.protocols.IKVReduce clojure.core.protocols.InternalReduce clojure.core.server
user=> clojure.core
➜ foo-2380 lein -v
Leiningen 2.8.0 on Java 1.8.0_102 Java HotSpot(TM) 64-Bit Server VM clojure-complete test (is (= '("clojure.core" "clojure.core.ArrayChunk" "clojure.core.ArrayManager" "clojure.core.IVecImpl" "clojure.core.Vec" "clojure.core.VecNode" "clojure.core.VecSeq" "clojure.core.protocols" "clojure.core.protocols.InternalReduce") (completions "clojure.co"))) |
Thanks for the follow-up - I noticed you're running Java 8 and that seems to be the trigger factor here (I'm on JDK 9). I tested it out with Java 8 and the bug did not reproduce so there's got to be some change in Java 9's classloading behavior that's causing this. |
@venantius Can confirm on Java 9 on Ubuntu $ lein repl
nREPL server started on port 38202 on host 127.0.0.1 - nrepl://127.0.0.1:38202
REPL-y 0.3.7, nREPL 0.2.12
Clojure 1.8.0
OpenJDK 64-Bit Server VM 9-internal+0-2016-04-14-195246.buildd.src
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> clojure.coNullPointerException complete.core/fn--647/iter--639--648/fn--649 (core.clj:66)
CompilerException java.lang.ClassNotFoundException: clojure.co, compiling:(null:0:0)
user=> As @technomancy mentioned it's a problem with upstream clojure-complete on Java 9. I tried the test which passed on Java 8, it fails on Java 9 as below : Test case : (is (= '("clojure.core" "clojure.core.ArrayChunk" "clojure.core.ArrayManager" "clojure.core.IVecImpl" "clojure.core.Vec" "clojure.core.VecNode" "clojure.core.VecSeq" "clojure.core.protocols" "clojure.core.protocols.InternalReduce") (completions "clojure.co")))
$ clj
Clojure 1.9.0
user=> (import [java.io File])
java.io.File
user=> (for [prop ["sun.boot.class.path" "java.ext.dirs" "java.class.path"]
path (.split (System/getProperty prop) File/pathSeparator)] path)
NullPointerException user/eval171/iter--165--172/fn--173 (NO_SOURCE_FILE:5)
user=> (.split (System/getProperty "sun.boot.class.path") File/pathSeparator)
NullPointerException user/eval192 (NO_SOURCE_FILE:7)
user=> (.split (System/getProperty "java.ext.dirs") File/pathSeparator)
NullPointerException user/eval194 (NO_SOURCE_FILE:8)
user=> (.split (System/getProperty "java.class.path") File/pathSeparator)
#object["[Ljava.lang.String;" 0x78de58ea "[Ljava.lang.String;@78de58ea"] |
While we've merged a fix to clojure-complete, @ninjudd has warned us that the library is no longer maintained. I don't yet have deploy rights to Clojars, so I don't have a way of actually releasing the fix. It would seem to me that an alternative approach here would be to migrate Leiningen's dependency off of clojure-complete to https://github.com/alexander-yakushev/compliment, which is actively maintained. |
@venantius I think leiningen uses reply for repl which in turn uses clojure-complete. I couldn't see clojure-complete being used directly in leiningen. The issue of deprecation is already an issue in clojure-complete repo. I think it will be better if we can bump the release with the help of @ninjudd and to have reply and leiningen to migrate to compliment in the long term since they may take significant changes. I will open an issue in reply to migrate to compliment. |
@tirkarthi Agree that's the right thing to do short and long term. I took a quick look at what would need changing in reply and it looks like a fair bit of work, otherwise I would have tried to fix it this afternoon. Opening an issue with them is a good start. |
@venantius I have opened up an issue in reply trptcolin/reply#176 . There is already an issue in clojure-complete about deprecation ninjudd/clojure-complete#18 . I will take a stab at migrating reply to compliment over the weekend 👍 |
@venantius Seems like there is already a three year old PR to replace clojure-complete with compliment : trptcolin/reply#153 |
Bit of an oddly specific bug, I know.
TL;DR - if I type
clojure.co
and then try to tab-complete, an NPE is triggered. Tab-completion works fine if I hit tab atcloj
or atclojure.core/
, but after that first period and before the slash I'll get NPE'd. I ran into this on a project and then was able to reproduce outside of a project context.Now the expected behavior would be for tab completion to work the way it did when I hit tab at
cloj
, i.e. to show me the list of namespaces that are potential results for what I've typed so far.Full command history and stacktrace:
The text was updated successfully, but these errors were encountered: