On 4 September 2013 17:52, Brian Craft <[email protected]> wrote:
> This gives me a number of reflection warnings, on field ba, on equals, and
> on hashCode. I can eliminate the one on hashCode by type hinting the ba
> parameter of BAHashable.
>
> The one on (.ba g) and equals remains. Is there any way to hint these?
Brian, this seems to work (+ a bit more safe):
(set! *warn-on-reflection* true)
(deftype BAHashable [ba]
Object
(equals [this other]
(if (instance? BAHashable other)
(java.util.Arrays/equals ^bytes ba ^bytes (.ba ^BAHashable other))
false))
(hashCode [this]
(java.util.Arrays/hashCode ^bytes ba)))
#_=>user.BAHashable
no more reflcopters! :)
--
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.