AspectJ Plugin

Introduction

The AspectJ Plugin implements a subset of AspectJ based on SDF, Stratego, and Reflex. The main objective is to provide an extensible and lightweight implementation on AspectJ.

The AspectJ plugin works by transforming AspectJ programs into pure-Java versions using the Reflex library. Due to the complex nature of this transformation (imagine obtaining syntactically correct Java code and the correct order for statements), the plugin defines a series of stages to structure the process; and also a domain-specific language (DKLang: Declarative Kernel Language) as a target of the transformation (from this language Java code can be finally generated). The main advantages of having these elements are:

  • Both the syntax and the semantics of AspectJ can be extended in a modular fashion. This is because of the structure of the process and also because we are using SDF for the definition of syntax, Stratego/XT for the specification of the transformation, and Reflex for the semantics. These three components are design to be extensible.
  • The complexity in the generation of Java code is heavily reduced. Due to the declarative nature of DKLang, obtaining the final Java code from a DKLang specification is far more easier than doing it by hand.
  • The ammount of lines of code necessary to code an extension using the plugin is 2-5 times less than using an imperative alternative like abc.

The full paper “A Lightweight and Extensible AspectJ Implementation” explaining the details and the motivations of the plugin can be found here.

Download

The source of plugin and the extensions presented in the paper can be downloaded from the following subversion directory: http://pleiad.dcc.uchile.cl/svn/incubator/reflexborg/plugins/aspectj.

Credits

First of all, we thank Martin Bravenboer, Eelco Visser, and the Stratego project members for their support in the development of this plugin. Part of this work was developed during the visit of Rodolfo Toledo at Delft University, under the guidance of Martin Bravenboer.

The idea behind the plugin was conceived by Éric Tanter and Rodolfo Toledo. The plugin is maintained by Rodolfo Toledo.

Old AspectJ Plugin

If you are looking for the old version of the AspectJ plugin developed by Leonardo Rodriguez, please visit this page.