Skip to main content

AspectJ

Simple Story

This is one of the two ways the teacher watches by the rule sheet during the examination. Here the teacher watches the pupils' hands, in the places of the pupils' work where they know to look.

They miss a reach that starts inside one of the permitted aids, or inside an aid the head teacher put out. When such an aid reaches for something forbidden for the pupil, this way of watching does not see it. Some roundabout reaches by the pupil escape it too.

Who is who

What it is​

AspectJ is the aspect-oriented programming (AOP) extension of Java: a language for aspects, plus a compiler and a weaver that place advice into bytecode.

How Ares 2 uses it​

AspectJ is one of the two runtime enforcement backends, selected by the ASPECTJ half of the programming language configuration. The Ares JAR goes on the aspect path so its aspects are woven into the exercise.

What follows from call-site weaving​

AspectJ intercepts at the call, not at the target. It rewrites the place where the call is written, which means coverage is an enumerated list of call sites the weaver could see:

  • a call made from inside the Java Development Kit (JDK) has no woven call site;
  • a reflective or library-mediated call reaches the target without passing a woven site;
  • coverage grows only by naming more call sites.

The repository documents this in detail, including the one case where AspectJ is stronger than instrumentation, in AspectJ versus Instrumentation.

Further reading​