StrongAspectJ: Flexible and Safe Pointcut/Advice Bindings
Abstract
AspectJ was designed as a seamless aspect-oriented extension of the Java programming language. However, unlike Java, AspectJ does not have a safe type system: an accepted binding between a pointcut and an advice can give rise to type errors at runtime. In addition, AspectJ's typing rules severely restrict the definition of certain generic advice behavior. Other typed aspect languages also suffer from these problems as they, in best case, adopt the same typing strategy as AspectJ.
In this research, we have proposed a novel type system for the popular pointcut/advice mechanism of mainstream aspect languages. The approach consists of a dual signature for around-advice declarations, a typing of pointcuts using type ranges, and the use of type variables for generic advice behavior. It is able to recover type safety in both generic and non-generic contexts. We have presented an integration with mainstream AOP approaches (including the StrongAspectJ extension for AspectJ), while a thorough formal analysis based on the Featherweight Java calculus substantiates the safety claims.
Involved Researchers
This research is a collaboration with the OBASCO group at the École des Mines de Nantes and INRIA.
- Mario Südholt (EMN)
Publications
- B. De Fraine, M. Südholt and V. Jonckers. StrongAspectJ: Flexible and Safe Pointcut/Advice Bindings. Published in Mezini (ed.), Proceedings of AOSD'08, March 31st-April 4th, 2008, Brussels, Belgium. [download paper] [download slides] Distinguished paper award.
- B. De Fraine, M. Südholt and V. Jonckers. A Formal Semantics of Flexible and Safe Pointcut/Advice Bindings. Technical Report SSEL 02/2007/a, Vrije Universiteit Brussel, Oct. 2007. [download report]
Prototype
StrongAJ is a plugin for the AspectBench Compiler (abc) which implements the StrongAspectJ language. It was developed using abc version 1.2.1. The source distribution includes an extensive test suite with static and dynamic cases. See the README file for more details.
- strongaj-0.1.0.tar.gz (latest source distribution)
- strongaj-0.1.0-bin.tar.gz (latest binary distribution, requires abc)
- strongaj-0.1.0-bin-complete.tar.gz (latest binary distribution, stand-alone)