Skip to content

Annotations

Justin Conklin edited this page Aug 24, 2017 · 1 revision

Just like classes and members, annotations are simply maps. They can be specified for classes, methods, and fields. Provide the :annotations key with either a map or sequence of tuples. Method parameter annotations are also supported, specified by a map of parameter indexes to annotations.

(def anns {Deprecated true})

(def my-method
  {:flags [:public], :name "annotated_method", :desc [String :void]
   :emit [#_...] ;; omitted for brevity
   :annotations anns
   :parameter-annotations {0 anns}})

Annotation values are processed exactly the same way as in Clojure.