Java interop docs missing type-hints for object arrays

566 views
Skip to first unread message

Craig McDaniel

unread,
May 11, 2017, 9:30:19 AM5/11/17
to Clojure Dev
Question posted in #slack:

jetzajac [9:02 AM]
Hello everyone. sorry for asking kind of silly question but I honestly couldn’t find actual example anywhere. How do I type-hint java arrays of objects?

After some digging I discovered ^"[Ljava.lang.String;" is the correct syntax for these kinds of type hints. This should be included on the interop page of clojure.org.

[I have already signed a contributor agreement, so if someone would like to guide me so I can make this change myself, I'd be happy to]

Alex Miller

unread,
May 11, 2017, 10:08:40 AM5/11/17
to cloju...@googlegroups.com
The Clojure web site content is managed at https://github.com/clojure/clojure-site - issues and PRs are fine there, see https://clojure.org/community/contributing_site for more info.

For this particular issue, I think a bit more context is needed. Different kinds of type hints (string, class, or special keywords like "bytes") are accepted at different locations (arguments, vars, function returns, etc).

The interop page does have some documentation of array-based type hints at https://clojure.org/reference/java_interop#TypeAliases btw so I think that's where more info should go.



--
You received this message because you are subscribed to the Google Groups "Clojure Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure-dev+unsubscribe@googlegroups.com.
To post to this group, send email to cloju...@googlegroups.com.
Visit this group at https://groups.google.com/group/clojure-dev.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages