Integer is a "boxed" integer in Java. It is a full Java Object. The
java.awt.Color constructor you are calling takes 4 primitive int parameters,
not Integer. Try this:
(set! *warn-on-reflection* true)
(def a 1)
(java.awt.Color. (int 0) (int 0) (int (or a 0)) (int 0))
I'm not so sure what you are asking for with the into-array part of your
questions. The last into-array expression returns a Java array of
java.awt.Color objects. If you are trying to pass that to some other Java
method and you are seeing reflection, and adding a type hint of
^"[Ljava.awt.Color;" doesn't work somewhere near there to avoid the reflection,
it would be good to show a code snippet of what you are trying and getting
reflection with.
Andy
On Feb 18, 2013, at 10:29 AM, AtKaaZ wrote:
> For or
> => (set! *warn-on-reflection* true)
> (def ^Integer a 1)
> (java.awt.Color. 0 0 ^Integer (or ^Integer a 0) 0)
> *clojure-version*
> true
> #'cgws.notcore/a
> Reflection warning, NO_SOURCE_PATH:3:1 - call to java.awt.Color ctor can't be
> resolved.
> #<Color java.awt.Color[r=0,g=0,b=1]>
> {:major 1, :minor 5, :incremental 0, :qualifier "RC16"}
> => (java.awt.Color. 0 0 ^Integer (or 0 ^Integer a) 0)
> Reflection warning, NO_SOURCE_PATH:2:1 - call to java.awt.Color ctor can't be
> resolved.
> #<Color java.awt.Color[r=0,g=0,b=0]>
> => (java.awt.Color. 0 0 a 0)
> #<Color java.awt.Color[r=0,g=0,b=1]>
>
>
> For into-array I don't yet have a sample but what is wanted is this:
> ^{:tag "[Ljava.awt.Color;"} (into-array java.awt.Color (list (java.awt.Color.
> 0 0 0 0)))
> but what we get is the returned value without the typehint when doing just
> this:
> (into-array java.awt.Color (list (java.awt.Color. 0 0 0 0)))
>
>
> I'm not sure which jira issues apply for these, likely this is already
> reported but more generically?
--
--
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.