Clojure doesn't care about casting, so you can ignore this issue
entirely. But also, it's not an issue: the same code would fail in
Java, because Clojure's integer literals are Long, not Integer. (cast
Long (cast Number 1)) would work fine.

On Oct 24, 2:12 pm, Steffen Panning <steffen.pann...@gmail.com> wrote:
> Hello Group,
>
> the Java API I'm currently working with expects that an Interface is
> downcasted to a concrete class.
>
> As a quick test I toyed with this:
>
> (cast Integer (cast Number 1))
> ClassCastException Cannot cast java.lang.Long to java.lang.Integer
>  java.lang.Class.cast (Class.java:3007)
>
> It seems the clojure cast does not work like the java cast.
>
> Is there a way to do this Clojure?
> A not so nice alternative is to write the cast stuff in java.
>
> TIA Steffen

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to