Skip to content
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

NPE autocompleting class names #1818

Closed
arrdem opened this issue Jul 31, 2016 · 16 comments
Closed

NPE autocompleting class names #1818

arrdem opened this issue Jul 31, 2016 · 16 comments

Comments

@arrdem
Copy link
Contributor

arrdem commented Jul 31, 2016

Bug encountered autocompleting class names, CIDER 0.14.0-SNAPSHOT (package: 20160727.904), emacs latest, Clojure 1.8.

  Show: Clojure Java REPL Tooling Duplicates All  (1 frames hidden)

  This is an unexpected CIDER middleware error.
  Please submit a bug report via `M-x cider-report-bug`.

  If these stacktraces are occuring frequently, consider using the
  button(s) below to suppress these types of errors for the duration of
  your current CIDER session. The stacktrace buffer will still be
  generated, but it will "pop under" your current buffer instead of
  "popping over". The button toggles this behavior.

 complete-error 

1. Unhandled java.lang.NullPointerException
   (No message)

           ns_mappings.clj:   87  cider.inlined-deps.compliment.v0v3v0.compliment.sources.ns-mappings/candidates/iter/fn
              LazySeq.java:   40  clojure.lang.LazySeq/sval
              LazySeq.java:   49  clojure.lang.LazySeq/seq
                   RT.java:  521  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj:  706  clojure.core/concat/fn
              LazySeq.java:   40  clojure.lang.LazySeq/sval
              LazySeq.java:   49  clojure.lang.LazySeq/seq
                   RT.java:  521  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj:  715  clojure.core/concat/cat/fn
              LazySeq.java:   40  clojure.lang.LazySeq/sval
              LazySeq.java:   49  clojure.lang.LazySeq/seq
                   RT.java:  521  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj: 3004  clojure.core/sort
                  core.clj: 3010  clojure.core/sort-by
                  core.clj: 3010  clojure.core/sort-by
                  core.clj:   88  cider.inlined-deps.compliment.v0v3v0.compliment.core/completions
                  core.clj:   54  cider.inlined-deps.compliment.v0v3v0.compliment.core/completions
              complete.clj:   18  cider.nrepl.middleware.complete/complete
              complete.clj:   10  cider.nrepl.middleware.complete/complete
              complete.clj:   28  cider.nrepl.middleware.complete/complete-reply
              complete.clj:   27  cider.nrepl.middleware.complete/complete-reply
        error_handling.clj:  146  cider.nrepl.middleware.util.error-handling/eval12806/fn
              MultiFn.java:  233  clojure.lang.MultiFn/invoke
              complete.clj:   37  cider.nrepl.middleware.complete/wrap-complete/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                   out.clj:   99  cider.nrepl.middleware.out/wrap-out/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                 debug.clj:  648  cider.nrepl.middleware.debug/wrap-debug/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
             enlighten.clj:   86  cider.nrepl.middleware.enlighten/wrap-enlighten/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
           macroexpand.clj:  208  cider.nrepl.middleware.macroexpand/wrap-macroexpand/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                 undef.clj:   22  cider.nrepl.middleware.undef/wrap-undef/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
           track_state.clj:  188  cider.nrepl.middleware.track-state/wrap-tracker/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
               inspect.clj:   96  cider.nrepl.middleware.inspect/wrap-inspect/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                pprint.clj:  108  cider.nrepl.middleware.pprint/wrap-pprint/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
             pr_values.clj:   22  clojure.tools.nrepl.middleware.pr-values/pr-values/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                  test.clj:  286  cider.nrepl.middleware.test/wrap-test/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                pprint.clj:   50  cider.nrepl.middleware.pprint/wrap-pprint-fn/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
               session.clj:  192  clojure.tools.nrepl.middleware.session/session/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                server.clj:   19  clojure.tools.nrepl.server/handle*
                server.clj:   16  clojure.tools.nrepl.server/handle*
                server.clj:   28  clojure.tools.nrepl.server/handle/fn
                  core.clj: 1938  clojure.core/binding-conveyor-fn/fn
                  AFn.java:   18  clojure.lang.AFn/call
           FutureTask.java:  266  java.util.concurrent.FutureTask/run
   ThreadPoolExecutor.java: 1142  java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  617  java.util.concurrent.ThreadPoolExecutor$Worker/run
               Thread.java:  745  java.lang.Thread/run
@Malabarba
Copy link
Member

@alexander-yakushev

@alexander-yakushev
Copy link
Member

@arrdem Does it happen for any classnames, or specific ones? Could you please give some leads?

@arrdem
Copy link
Contributor Author

arrdem commented Jul 31, 2016

@alexander-yakushev this (or some other NPE) was encountered pretty routinely last night hacking on $PRIVATE_REPO. Lemme see if I can come up with a minimal failing example.

@tirkarthi
Copy link

@alexander-yakushev I am also facing the same issue with cider-nrepl version 0.14.0 and cider 0.14.0-snapshot. I have tested it with cider-nrepl version 0.13.0 and cider 0.14.0-snapshot I don't receive the error and completion.

hello-world.core> (defrecord Animal [name])    
hello-world.core.Animal
hello-world.core> (Animal. "hello")
#hello_world.core.Animal{:name "hello"}
hello-world.core> (Anim)

When I try to autocomplete with point at Anim by pressing TAB I receive the error as above.

@alexander-yakushev
Copy link
Member

Thanks @tirkarthi! Indeed, completing classes produced by defrecord threw NPE because, as it turns out, such classes don't have a package. Perhaps, there are other cases like that too, which @arrdem ran into.

@bbatsov I'm deploying a fix as 0.3.1.

alexander-yakushev added a commit to alexander-yakushev/compliment that referenced this issue Aug 3, 2016
@arrdem
Copy link
Contributor Author

arrdem commented Aug 3, 2016

I'm gonna guess that I was encountering something else. Sorry I haven't put together a demo, work's been busy and I'm prepping a talk for Thursday. Will try to get to it tomorrow.

@bbatsov
Copy link
Member

bbatsov commented Aug 3, 2016

@alexander-yakushev OK, I'll update the dep.

@qrthey
Copy link

qrthey commented Aug 7, 2016

I think I encountered a related issue.

system-info

;; CIDER 0.13.0 (California), nREPL 0.2.12
;; Clojure 1.8.0, Java 1.8.0_102

Steps to reproduce:

  • create new leiningen project
  • define a new record in the 'core' file
  > (defrecord Person [name gender])
  • cider-jack-in
  • switch to the core files buffer, compile and switch to the projects namespace (C-c C-o, C-c C-k and C-c M-n)
  • switch to the repl

Typing the start of a keyword, triggering auto completion with company-mode, that isn't defined in the core namespace throws the error, e.g.

> :my

resulting error buffers content:

1. Unhandled java.lang.NullPointerException
   (No message)

           ns_mappings.clj:   87  cider.inlined-deps.compliment.v0v3v0.compliment.sources.ns-mappings/candidates/iter/fn
              LazySeq.java:   40  clojure.lang.LazySeq/sval
              LazySeq.java:   49  clojure.lang.LazySeq/seq
                   RT.java:  521  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj:  706  clojure.core/concat/fn
              LazySeq.java:   40  clojure.lang.LazySeq/sval
              LazySeq.java:   49  clojure.lang.LazySeq/seq
                   RT.java:  521  clojure.lang.RT/seq
                  core.clj:  137  clojure.core/seq
                  core.clj:  715  clojure.core/concat/cat/fn
              LazySeq.java:   40  clojure.lang.LazySeq/sval
              LazySeq.java:   49  clojure.lang.LazySeq/seq
                 Cons.java:   39  clojure.lang.Cons/next
                   RT.java: 1741  clojure.lang.RT/length
                   RT.java: 1682  clojure.lang.RT/seqToArray
              LazySeq.java:  130  clojure.lang.LazySeq/toArray
                   RT.java: 1655  clojure.lang.RT/toArray
                  core.clj:  344  clojure.core/to-array
                  core.clj: 3004  clojure.core/sort
                  core.clj: 3010  clojure.core/sort-by
                  core.clj: 3010  clojure.core/sort-by
                  core.clj:   88  cider.inlined-deps.compliment.v0v3v0.compliment.core/completions
                  core.clj:   54  cider.inlined-deps.compliment.v0v3v0.compliment.core/completions
              complete.clj:   18  cider.nrepl.middleware.complete/complete
              complete.clj:   10  cider.nrepl.middleware.complete/complete
              complete.clj:   28  cider.nrepl.middleware.complete/complete-reply
              complete.clj:   27  cider.nrepl.middleware.complete/complete-reply
        error_handling.clj:  146  cider.nrepl.middleware.util.error-handling/eval2951/fn
              MultiFn.java:  233  clojure.lang.MultiFn/invoke
              complete.clj:   37  cider.nrepl.middleware.complete/wrap-complete/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                 trace.clj:   36  cider.nrepl.middleware.trace/wrap-trace/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
           track_state.clj:  188  cider.nrepl.middleware.track-state/wrap-tracker/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                pprint.clj:  108  cider.nrepl.middleware.pprint/wrap-pprint/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
             pr_values.clj:   22  clojure.tools.nrepl.middleware.pr-values/pr-values/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                  test.clj:  286  cider.nrepl.middleware.test/wrap-test/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
              resource.clj:   27  cider.nrepl.middleware.resource/wrap-resource/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
               apropos.clj:   91  cider.nrepl.middleware.apropos/wrap-apropos/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
             classpath.clj:   15  cider.nrepl.middleware.classpath/wrap-classpath/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
               version.clj:   17  cider.nrepl.middleware.version/wrap-version/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
               session.clj:  238  clojure.tools.nrepl.middleware.session/add-stdin/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
            stacktrace.clj:  174  cider.nrepl.middleware.stacktrace/wrap-stacktrace/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                pprint.clj:   50  cider.nrepl.middleware.pprint/wrap-pprint-fn/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
               session.clj:  192  clojure.tools.nrepl.middleware.session/session/fn
            middleware.clj:   22  clojure.tools.nrepl.middleware/wrap-conj-descriptor/fn
                server.clj:   19  clojure.tools.nrepl.server/handle*
                server.clj:   16  clojure.tools.nrepl.server/handle*
                server.clj:   28  clojure.tools.nrepl.server/handle/fn
                  core.clj: 1938  clojure.core/binding-conveyor-fn/fn
                  AFn.java:   18  clojure.lang.AFn/call
           FutureTask.java:  266  java.util.concurrent.FutureTask/run
   ThreadPoolExecutor.java: 1142  java.util.concurrent.ThreadPoolExecutor/runWorker
   ThreadPoolExecutor.java:  617  java.util.concurrent.ThreadPoolExecutor$Worker/run
               Thread.java:  745  java.lang.Thread/run

@OlegTheCat
Copy link

I can confirm issue reported by @qrthey.

@bbatsov
Copy link
Member

bbatsov commented Aug 21, 2016

Do you have this issue with 0.14-snapshot as well?

@qrthey
Copy link

qrthey commented Aug 21, 2016

Yes, same NullPointerException. This almost empty leiningen project reproduces the error (see comments for details).

@qrthey
Copy link

qrthey commented Aug 25, 2016

I just tried this after another melpa update of 0.14.0snapshot

(;; CIDER 0.14.0snapshot (package: 20160825.249), nREPL 0.2.12)

The middleware exception is no longer thrown.

@alexander-yakushev
Copy link
Member

If CIDER 0.14.0-SNAPSHOT now uses Compliment 0.3.1, the defrecord problem should indeed be fixed. As for keyword error, I can't reproduce it on 0.14.0snapshot too, but I think I saw something similar before (but can't reproduce it now again).

@bbatsov
Copy link
Member

bbatsov commented Sep 27, 2016

OK, so should we close this or not?

@bbatsov
Copy link
Member

bbatsov commented Oct 9, 2016

I'm closing this for now. Feel free to reopen it if there still some issues (that can ideally be reliably reproduced).

@bbatsov bbatsov closed this as completed Oct 9, 2016
@qrthey
Copy link

qrthey commented Oct 9, 2016

I haven't seen the issue occurring in a long time. Sorry for my late reply
and thanks for fixing this issue.

On Oct 9, 2016 09:58, "Bozhidar Batsov" notifications@github.com wrote:

I'm closing this for now. Feel free to reopen it if there still some
issues (that can ideally be reliably reproduced).


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1818 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AIGPJuxy8eghpG-27-PNvyXlRZC_zEO6ks5qyJ6lgaJpZM4JY9bn
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants