Skip to content

Non-static inner classes fail to recognize constructor #2277

@tekacs

Description

@tekacs

An example is probably illustrative. The following Java syntax (from here):

BoxUser user = new BoxUser(api, "0");
BoxUser.Info info = user.new Info();
info.setName(name);
user.updateInfo(info);

Can be converted to the following Clojure:

(let [user (BoxUser. api "0")
      info (BoxUser$Info. user)]
  (.updateInfo user (doto info (.setName name))))

The Clojure compiler is happy to compile and run this, but Cursive complains that it can't find the constructor for (BoxUser$Info user).

CleanShot 2019-11-25 at 10 55 00@2x

If I instead write (BoxUser$Info.) then 'Go to definition leads me to the constructor of the inner class:

public Info() {
    super(BoxUser.this);
}

... but this isn't actually the corresponding constructor — the approach from above is the way to call this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugMarks issues describing bugsreleasedMarks issues which have had the fixes released in a stable build

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions