Skip to main content

Weaving

Simple Story

At some point the checking has to get into the room.

That can happen when the work is compiled, or as each class is loaded into memory, or while the examination is already under way. Later is more powerful, because by then you can reach parts you never had the source for.

What it is

Weaving is the act of inserting advice at matched join points. It can happen:

  • at compile time, by a special compiler that emits already-woven bytecode;
  • at load time, by an agent that rewrites each class as the Java Virtual Machine (JVM) loads it;
  • at runtime, by redefining classes that are already loaded.

The two backends Ares supports sit at different points on that scale. AspectJ weaves the call sites it can see. Load-time instrumentation rewrites classes as they are loaded, including classes Ares never compiled.

This difference is the reason the two backends are not interchangeable in their guarantees, and the reason continuous integration (CI) runs both.

Further reading