开发者

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")]])
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜