Browse Clojure Foundations for Java Developers

Macros vs Java Reflection

Macros expand code at compile time; reflection discovers types/members at runtime.

Macros and Java reflection both feel “dynamic,” but they operate at different times.

  • Macros: run at compile/macro-expansion time and generate code. After expansion, you just have ordinary Clojure (and ordinary bytecode).
  • Reflection: runs at runtime to discover methods/fields/types dynamically.

This matters for Java interop: Clojure can use reflection when it cannot infer a method call target (for example, when there are no type hints). That is a runtime cost, and it is solved with better type information—not with macros.

In this section

Revised on Friday, April 24, 2026