Skip to content

Bytecode Version

Justin Conklin edited this page May 2, 2018 · 4 revisions

By default, this library generates version 1.7 bytecode (unless running on JDK 6, then 1.6 bytecode is the default). Provide :version when visiting your class to override. Note that versions 1.6 and lower do not support all instructions, most notably invokedynamic.

(insn/visit (assoc class-data :version 1.5))

Additionally, the dynamic var insn.core/*bytecode-version* is available. Binding this allows overriding the default bytecode version:

Finally, you may also select the bytecode version when using insn.clojure/defn.

(require '[insn.clojure :as bc])

(bc/defn ^{:insn/version 1.8} demo [x]
  [#_...])