Type Relaxed Weaving

Around advice in AspectJ language can change runtime arguments to method invocations (and other kinds of operations) and return values from the invocations (ibid.). While this is very powerful, there is severe restriction in terms of types, which prevents aspects to change values even if it is safe to do. This project aims at relaxing weaving rules in AspectJ so that aspects have more opportunity to change the values without losing type safety. In addition, we investigate improving type flexibility of proceed method under relaxed weaving rules and supporting generics and covariant return types.

A motivating example of this project is to allow the following around advice definition without losing type safety:

aspect WrapActionListener {
  ActionListener around(): call(ActionListener+.new(..)) {
    ActionListener l = proceed();
    return new Wrapper(l); // Wrapper implements ActionListener

Surprisingly, current AspectJ compilers reject to weave this aspect.



  • Tomoyuki Aotani, Manabu Toyama, and Hidehiko Masuhara, Supporting covariant return types and generics in type relaxed weaving
    • Workshop on Foundations of Aspect-Oriented Languages(FOAL), March 2011.
    • PDF
  • Tomoyuki Aotani, Manabu Toyama, and Hidehiko Masuhara, StrongRelaxAJ: integrating adaptability of RelaxAJ and expressiveness of StrongAspectJ
    • Workshop on Foundations of Aspect-Oriented Languages(FOAL), March 2010.
    • PDF
  • Hidehiko Masuhara, Atsushi Igarashi, and Manabu Toyama, Type Relaxed Weaving
    • The 9th International Conference on Aspect-Oriented Software Development (AOSD’10), March 2010.
  • Hidehiko Masuhara, Relaxing Type Restrictions of Around Advice in Aspect-Oriented Programming
    • The Fifth ASIAN Symposium on Programming Languages and Systems (APLAS 2007), November 2007.
    • poster presentation. abstract
  • Hidehiko Masuhara, On Type Restriction of Around Advice and Aspect Interference
    • The 3rd International Workshop on Aspects, Dependencies and Interactions (ADI’08), July 2008.
    • PDF