1

I'm trying to call this java method from Clojure and it's throwing me "ClassCastException Cannot cast java.lang.Long to [J java.lang.Class.cast (Class.java:3003)"

public String encrypt(long... numbers) {
  return encode(numbers, alphabet_, salt_, minHashLength_);
}

What's the equivalent of calling that method from Clojure?

4

1 回答 1

2

Java varargs 是编译成单个数组参数的语法糖。为了将数据从 Clojure 传递到此方法,请使用该long-array函数将您的 long 集合转换为数组。

(.encrypt obj (long-array [1 2 3]))
于 2013-07-26T03:45:13.167 回答