clojure-emacs / clojure-emacs/clj-refactor.el

cljr-add-stubs fails over :import-ed Java classes

Open
#479 0 comments 0 reactions 0 assignees View on GitHub
bug help wanted low hanging fruit
Dominant language
Emacs Lisp
Stars
785
Forks
110
PR merge metrics
No merged PRs in 30d

Description

## Expected behavior

`cljr-add-stubs` will succesfully complete a `reify` for a Java class that has been `:import`ed, i.e. the symbol is not package-qualified.

## Actual behavior

Errors with `Can't find interface IntConsumer`

## Steps to reproduce the problem

* `(:import java.util.function.IntConsumer)`
* type `(reify IntConsumer)` in a clojure buffer
* Place `POINT` over `IntConsumer`
* Invoke cljr-add-stubs normally (I use hydra)

### clj-refactor.el version information

This repo @ master

## Analysis

When there's no prefix (which is the case with `:import`ed classes), the following LOC is executed:

https://github.com/clojure-emacs/clj-refactor.el/blob/9dcc50da7ce6f3c10276c87f09022e80c03e8bef/clj-refactor.el#L3071

which appears to mistakenly fill `IntConsumer` with the equivalent of `(ns-name *ns*)` instead of the actual java package.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.