The field access pointcuts of AspectJ do not support array objects in full. When an element of an array object is set or referenced, the corresponding index values and assigned value are not exposed to the advice. This small project presents an extension of AspectJ¡¦s field access pointcuts for exposing such useful context information in referencing an array field. We have implemented this extension using the abc compiler for AspectJ. The core of our implementation is a finite-state machine based pointcut matcher that can handle arrays of multiple dimensions in a uniform way.
The most recent version is 1.0, which has been tested with abc-1.0.2, abc-1.1.0, and abc-1.2.0. Both its sources and binaries are available for download.
Sources:
To build ArrayPT 1.0, you will need:
| %ABC_HOME%\src\abc\ajex | ||
| \ast | ||
| \extension | ||
| \parse | ||
| \types | ||
| \weaving | ||
| \aspectinfo | ||
| \matching |
| %ABC_HOME%\runtime-src\org\aspectbench\ajex | ||
| \lang | ||
| \reflect | ||
| \runtime | ||
| \reflect |
Binaries:
Get the compiler here: arraypt-1.0.jar
Get the runtime libraries here: arraypt-runtime-1.0.jar
Example:
Click here to get the code that demonstrates how to use ArrayPT.
Before you can compile or run the example code, you must include the following jar files in the CLASSPATH environment variable.
To compile the example code, use:
abc -ext abc.ajex ArrayPTDemo.java
And, to run the example code, use:
java ArrayPTDemo
Chin-Hung Chien is a senior software engineer at Foxconn Electronics Inc.
Kung Chen is an Associate Professor in the Department of Computer Science at the National Chengchi University, Taiwan.