What is wrong with this code?  I want to instantiate a Java String
from a Java character-array.
But I want it to be fast, hence the need to cast per the "warn on
reflection" message.

    user=> (set! *warn-on-reflection* true)
    true
    user=>  (new String #^"[C" (make-array Character/TYPE 3 \a ))
    java.lang.ClassCastException: [[C cannot be cast to [C
(NO_SOURCE_FILE:0)

This seems to be correct if I correctly understood this thread.

http://groups.google.com/group/clojure/browse_thread/thread/6a2821394d0099a4/0f4dfef688b40a9b?lnk=gst&q=String+character+array+cast#0f4dfef688b40a9b

As we all know, this is brain-dead easy in POJ (aside from the initial
'a' value in the array).

    char foo[] = new String[3];
    // do something here
    String foo = new String( foo );           // voila !

Chick, chick, chickee

--~--~---------~--~----~------------~-------~--~----~
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