Java arrays in Clojure's gen-interface
I have this piece of code:
(ns com.example.main)
(gen-class
:name com.example.main.CTest
:methods [ [foo [] "[B"]])
(defn -foo [this]
(byte-array [(byte 1) (byte 2)]))
(gen-interface
:name com.example.main.ITest
:methods [ [foo [] "[B"]])
It creates the foo
method in class CTest
correctly, with return type byte[]
. However, the same thing creates a method with 开发者_如何转开发return type [B
in the ITest
interface. How do I do this correctly? Is it a bug in Clojure?
Thanks, David
I don't know if some other solution is preferred, but this works:
(gen-interface
:name com.example.main.ITest
:methods [[foo [] #=(java.lang.Class/forName "[B")]])
精彩评论