Clojure で書いているBaseX Java インターフェイスのモジュールがあります。インターフェイスは、メソッドの呼び出し方法と最適化方法を決定するために使用できる多くの注釈を提供します。ただし、これらを生成されたクラスに実際にアタッチするのに問題があります。
(ns net.dyfis.svnkit_wrapper.SvnWrapper
(:import (org.basex.query QueryModule
QueryModule$Requires
QueryModule$Permission
QueryModule$Deterministic))
(:gen-class
:main false
:extends org.basex.query.QueryModule
:methods [
^{:static true}
[^{QueryModule$Requires QueryModule$Permission/NONE,
Deprecated {}}
cat [java.lang.String] java.lang.String]
^{:static true}
[^{QueryModule$Deterministic {},
QueryModule$Requires QueryModule$Permission/NONE}
catRev [java.lang.String int] java.lang.String]]))
ただし、Deprecated アノテーションのみが添付されます。QueryModule$Requires
および QueryModule$Deterministic
アノテーションは黙って破棄されます。
>>> cat
public static java.lang.String net.dyfis.svnkit_wrapper.SvnWrapper.cat(java.lang.String)
>>> cat.getAnnotations()
array(java.lang.annotation.Annotation,[@java.lang.Deprecated()])
これは Clojure 1.4.0-beta6 で発生していますが、AOT でコンパイルされたメソッドでの注釈のサポートは Clojure 1.2 から存在するはずです。そのため、これはおそらく使用上のエラーですが、どうすればよいのでしょうか?