adbc - Design by Contract for AspectJ
- Add the library to your AspectJ project and contracts will automatically be enforced at runtime. Whenever a contract is broken, an exception is thrown which also indicates who is to blame.
- Contract enforcement is guided by behavioural subtyping and the advice substitution principle, which allows for modular reasoning. That is, you can reason about a method call just by looking at the contracts of the method body in the static type, even in the presence of advice. In a nutshell, to ensure that an advice complies with the advice substitution principle, its contracts should not interfere with those of the methods being advised. If an advice cannot avoid breaking the principle, modular reasoning can be0 restored by explicitly mentioning that advice's name in an
@advisedByannotation at each method it advises. (See the documentation for more information.)
- Java 6 (or later)
- AspectJ (tested on versions 1.6.12 and 1.7.2)
When using Eclipse+AJDT, just add
adbc.jar to your project's InPath and you can start writing contracts (using the annotations in
be.ac.ua.ansymo.adbc.annotations). Contract enforcement is automatically enabled, and can be disabled if needed via the
For more information, be sure to have a look at adbc's documentation.