Avoiding Infinite Recursion with Stratified Aspects

Eric Bodden
Sable Research Group
McGill University
3480 University Street
H3A 2A7 Montréal, Québec, Canada
Florian Forster
LG Programmiersysteme
Fernuniversität in Hagen
Universitätsstraße 1
58097 Hagen, Germany
Friedrich Steimann
LG Programmiersysteme
Fernuniversität in Hagen
Universitätsstraße 1
58097 Hagen, Germany

Abstract: Infinite recursion is a known problem of aspect-oriented programming with AspectJ: if no special precautions are taken, aspects which advise other aspects can easily and unintentionally advise themselves. We present a compiler for an extension of the AspectJ programming language that avoids self reference by associating aspects with levels, and by automatically restricting the scope of pointcuts used by an aspect to join points of lower levels. We report on a case study using our language extension and quantify the changes necessary for migrating existing applications to it. Our results suggest that we can make programming with AspectJ simpler and safer, without restricting its expressive power unduly.


The paper can be downloaded here as PDF. It was presented at Net.ObjectDays 2006 and published in: GI-Edition Lecture Notes in Informatics 'NODe 2006 GSEM 2006', Robert Hirschfeld, Andreas Polze and Ryszard Kowalczyk (Editors), pp. 49-64


The following downloads are provided "AS IS" without warranty of any kind.

Extended version of the AspectBench Compiler

Running the extended abc version

In order to run our modified version of abc, simply type:
java -jar abc-meta-1.0.0.jar <standard abc arguments>
You can get help on the command line arguments by typing
java -jar abc-meta-1.0.0.jar -help
In order to run the original version of abc, type:
java -jar abc-meta-1.0.0.jar -ext abc.main <standard abc arguments>
We provide three tests we used for unit testing for you in order to get a feeling for how the new language behaves. You can run them by typing:
java -jar abc-meta-1.0.0.jar <file name>
In addition we provide original and refactored versions of our benchmark programs below.

Extending the extended abc version

In order to extend our version of abc (as described for J-LO in the paper), simply extend abc.meta instead of abc.aspectj in your abc extension. Our modified J-LO version can be downloaded here (tar/gz) as an example.


Each of the ZIP files contains a file metachanges.txt which comments on the necessary changes when applying the stratified aspects extension.

Law of Demeter Checker

Version of section 4.1
Version of section 4.2
Download here.
Version of section 4.3
Download here.

Glassbox Inspector

To Do

Tracing from the AspectJ distribution

Download here.


Download here.

Banking application

Download here.