0
# Runtime Utilities
1
2
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.
3
4
## Capabilities
5
6
### Control Flow Support
7
8
```java { .api }
9
/**
10
* Represents control flow for cflow and cflowbelow pointcuts
11
*/
12
public class CFlow {
13
public CFlow();
14
public CFlow(Object _aspect);
15
public Object getAspect();
16
public void setAspect(Object _aspect);
17
public Object get(int index);
18
}
19
```
20
21
### Exception Handling
22
23
```java { .api }
24
/**
25
* Wrapper for checked exceptions matched by a 'declare soft'
26
*/
27
public class SoftException extends RuntimeException {
28
public SoftException(Throwable inner);
29
public Throwable getWrappedThrowable();
30
public Throwable getCause();
31
}
32
33
/**
34
* Thrown when there is no aspect of that type currently bound
35
*/
36
public class NoAspectBoundException extends RuntimeException {
37
public NoAspectBoundException(String aspectName, Throwable inner);
38
public NoAspectBoundException();
39
public Throwable getCause();
40
}
41
```
42
43
### Source Location
44
45
```java { .api }
46
/**
47
* Represents source code location information
48
*/
49
public interface SourceLocation {
50
Class getWithinType();
51
String getFileName();
52
int getLine();
53
int getColumn();
54
}
55
```
56
57
## Usage Examples
58
59
```java
60
// Exception handling
61
try {
62
riskyOperation();
63
} catch (SoftException e) {
64
Throwable original = e.getWrappedThrowable();
65
System.out.println("Softened exception: " + original.getClass().getName());
66
}
67
68
// Source location access
69
@Before("execution(* com.example..*.*(..))")
70
public void logLocation(JoinPoint joinPoint) {
71
SourceLocation loc = joinPoint.getSourceLocation();
72
if (loc != null) {
73
System.out.println("Called from: " + loc.getFileName() + ":" + loc.getLine());
74
}
75
}
76
```