Weaving
The teacher has to be in place before a pupil reaches for anything. This page is about how they get there.
One way puts the teacher beside the pupils' hands before the examination starts. The other puts them beside each worksheet, telephone and other thing as it comes into the room. The second reaches places the first never sees, such as the inside of the permitted aids. The two ways still do not catch exactly the same things.
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
- AspectJ Documentation and Resources — Eclipse Foundation
- Comparing Spring aspect-oriented programming (AOP) and AspectJ — Baeldung
- Applying "Java Aspects" at Load Time: Java Instrumentation application programming interface (API) — Hrishabh Purohit, Medium (freely readable)
- Class Loaders in Java — Baeldung