com.rabbitmq.client.ConnectionFactory.newConnection(Address[])
次のように、Clojure 1.4.0 から呼び出しています。
(defn connect [#^ConnectionFactory factory, addrs]
(.newConnection factory (into-array Address addrs)))
呼び出しは機能しますが、反射警告がスローされます。
call to newConnection can't be resolved.
クラスを振り返るとConnectionFactory
、 type の引数を 1 つだけ取る形式が明らかにありcom.rabbitmq.client.Address[]
、これがまさに(into-array Address ())
返されます。
com.mefesto.wabbitmq=> (pprint (filter #(.. (.toString %)
(contains "newConnection"))
(seq (.getDeclaredMethods
ConnectionFactory))))
(#<Method public com.rabbitmq.client.Connection
com.rabbitmq.client.ConnectionFactory.newConnection(
com.rabbitmq.client.Address[])
throws java.io.IOException>
#<Method public com.rabbitmq.client.Connection
com.rabbitmq.client.ConnectionFactory.newConnection(
java.util.concurrent.ExecutorService,
com.rabbitmq.client.Address[])
throws java.io.IOException>
#<Method public com.rabbitmq.client.Connection
com.rabbitmq.client.ConnectionFactory.newConnection()
throws java.io.IOException>
#<Method public com.rabbitmq.client.Connection
com.rabbitmq.client.ConnectionFactory.newConnection(
java.util.concurrent.ExecutorService)
throws java.io.IOException>)
com.mefesto.wabbitmq=> (into-array Address ())
#<Address[] [Lcom.rabbitmq.client.Address;@953235f>
ここで反射を避けるために何をする必要がありますか?