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

Handle NoClassDefFoundError when determining class type #186

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

### Bugs fixed

*
* [#186](https://github.com/clojure-emacs/refactor-nrepl/issues/186) Make sure `resolve-missing` still works, even if a candidate class has missing dependencies.
* [#185](https://github.com/clojure-emacs/refactor-nrepl/issues/185) Report throwables of type `Error` instead of swallowing them.
* [clojure-emacs/clj-refactor.el#330](https://github.com/clojure-emacs/clj-refactor.el/issues/332) `clean-ns` removes imported inner inner classes.
* [clojure-emacs/clj-refactor.el#330](https://github.com/clojure-emacs/clj-refactor.el/issues/330) `clean-ns` ignores namespaced keywords.
Expand Down
11 changes: 10 additions & 1 deletion src/refactor_nrepl/ns/resolve_missing.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,16 @@

(defn- collate-type-info
[candidates]
(map (fn [candidate] {:name candidate :type (get-type candidate)}) candidates))
(map (fn [candidate]
(try
{:name candidate :type (get-type candidate)}

;; This happends when class `candidate` depends on a class that is
;; not available on the classpath.
(catch NoClassDefFoundError e
{:name candidate :type :class})))
candidates))


(defn- inlined-dependency? [candidate]
(or (-> candidate str (.startsWith "deps."))
Expand Down