Skip to content

clarify java_interop, wrt (.instanceMember Classname args*) #171

@uvtc

Description

@uvtc

In https://clojure.org/reference/java_interop, one example given is:

(.instanceMember Classname args*)

I found that confusing, and it was discussed at https://groups.google.com/forum/#!topic/clojure/7eEpEOn1B28 that the docs here could be clarified. Colin Fleming notes:

This doc is confusing - as Phill comments above, this is calling the getName() method on an instance of Class. In Clojure, a bare classname (String, ArrayList or whatever) resolves to the class itself if it has been imported (i.e. what would be String.class in Java). The doc is confusing because (.instanceMember Classname args*) is really just a special case of (.instanceMember instance args*), where "instance" refers to an instance of a Class object. I'm not sure why that doc makes that distinction, it doesn't seem useful to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions