The AspectJ runtime is a small library necessary to run Java programs enhanced by AspectJ aspects during a previous compile-time or post-compile-time (binary weaving) build step.
—
Supporting classes for control flow tracking, exception handling, and other runtime services that enable advanced AspectJ features. These utilities provide the infrastructure needed for control flow pointcuts, exception softening, and aspect lifecycle management.
/**
* Represents control flow for cflow and cflowbelow pointcuts
*/
public class CFlow {
public CFlow();
public CFlow(Object _aspect);
public Object getAspect();
public void setAspect(Object _aspect);
public Object get(int index);
}/**
* Wrapper for checked exceptions matched by a 'declare soft'
*/
public class SoftException extends RuntimeException {
public SoftException(Throwable inner);
public Throwable getWrappedThrowable();
public Throwable getCause();
}
/**
* Thrown when there is no aspect of that type currently bound
*/
public class NoAspectBoundException extends RuntimeException {
public NoAspectBoundException(String aspectName, Throwable inner);
public NoAspectBoundException();
public Throwable getCause();
}/**
* Represents source code location information
*/
public interface SourceLocation {
Class getWithinType();
String getFileName();
int getLine();
int getColumn();
}// Exception handling
try {
riskyOperation();
} catch (SoftException e) {
Throwable original = e.getWrappedThrowable();
System.out.println("Softened exception: " + original.getClass().getName());
}
// Source location access
@Before("execution(* com.example..*.*(..))")
public void logLocation(JoinPoint joinPoint) {
SourceLocation loc = joinPoint.getSourceLocation();
if (loc != null) {
System.out.println("Called from: " + loc.getFileName() + ":" + loc.getLine());
}
}Install with Tessl CLI
npx tessl i tessl/maven-org-aspectj--aspectjrt