StrongAspectJ: flexible and safe pointcut/advice bindings

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. In this paper, we analyze the roots of these type errors, and describe measures to recover type safety for both generic and non-generic pointcut/advice declarations. Pointcuts quantify over heterogeneous sets of join points and are hence typed using type ranges in our approach, while type variables and a dual advice signature allow to express the generic and invasive nature of advices. Using these mechanisms, we can express advice that augments, narrows or replaces base functionality in possibly generic contexts. As a language engineering contribution, we integrate our proposal with the AspectJ language, and we provide a prototype implementation as a plugin for the AspectBench Compiler (abc). On a theoretical level, we present a formal definition of the proposed constructs and typing rules, and develop proofs for their type safety properties.

[1]  Christopher G. Lasater,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.

[2]  Akinori Yonezawa,et al.  Aspectual Caml: an aspect-oriented functional language , 2005, ICFP '05.

[3]  Radha Jagadeesan,et al.  Typed parametric polymorphism for aspects , 2006, Sci. Comput. Program..

[4]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[5]  Mira Mezini,et al.  Conquering aspects with Caesar , 2003, AOSD '03.

[6]  Gilad Bracha,et al.  Adding wildcards to the Java programming language , 2004, SAC '04.

[7]  Mitchell Wand A Semantics for Advice and Dynamic Join Points in Aspect-Oriented Programming , 2001, SAIG.

[8]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[9]  Luca Cardelli,et al.  On understanding types, data abstraction, and polymorphism , 1985, CSUR.

[10]  David Walker,et al.  A type-theoretic interpretation of pointcuts and advice , 2006, Sci. Comput. Program..

[11]  Gregor Kiczales,et al.  Design pattern implementation in Java and aspectJ , 2002, OOPSLA '02.

[12]  Guy L. Steele,et al.  Java(TM) Language Specification, The (3rd Edition) (Java (Addison-Wesley)) , 2005 .

[13]  Bruno De Fraine,et al.  A Formal Semantics of Flexible and Safe Pointcut/Advice Bindings , 2007 .

[14]  S. Griffis EDITOR , 1997, Journal of Navigation.

[15]  Gary T. Leavens,et al.  MiniMAO: An imperative core language for studying aspect-oriented reasoning , 2006, Sci. Comput. Program..

[16]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 1999, OOPSLA '99.

[17]  Ondrej Lhoták,et al.  abc: an extensible AspectJ compiler , 2005, AOSD '05.

[18]  William G. Griswold,et al.  An Overview of AspectJ , 2001, ECOOP.

[19]  Wim Vanderperren,et al.  JAsCo: an aspect-oriented approach tailored for component based software development , 2003, AOSD '03.

[20]  Gilad Bracha,et al.  Strongtalk: typechecking Smalltalk in a production environment , 1993, OOPSLA '93.

[21]  Martin C. Rinard,et al.  A classification system and analysis for aspect-oriented programs , 2004, SIGSOFT '04/FSE-12.

[22]  Cyril S. Ku,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.

[23]  Ramnivas Laddad,et al.  Aspectj in Action: Practical Aspect-Oriented Programming , 2003 .

[24]  Olaf Spinczyk,et al.  Generic Advice: On the Combination of AOP with Generative Programming in AspectC++ , 2004, GPCE.

[25]  KiczalesGregor,et al.  Design pattern implementation in Java and aspectJ , 2002 .

[26]  Philip Wadler,et al.  Java generics and collections , 2006 .

[27]  Stefan Hanenberg,et al.  Parametric introductions , 2003, AOSD '03.

[28]  David H. Lorenz,et al.  Aspects and polymorphism in AspectJ , 2003, AOSD '03.