Inference rules for generic code migration of aspect-oriented programs - Rubbo, Fernando Barden (2009)
The latest versions of AspectJ { the most popular aspect oriented extension for Java { must cope with complex changes that occurred in the Java type system, specially with the parametric polymorphism which aims to improve the type safety and the readability of the source code. However, for legacy and non-generic constructions to take advantage of this pervasive feature, they must be migrated to explicitly supply actual type parameters in both declarations and instantiations of generic classes. Even though the type systems of Java and AspectJ were designed to support this kind of migration in a gradual way, this process is somewhat complex and error prone. The reason behind this assertion is that actual type parameters must be inferred to remove as much unsafe downcasts as possible without a ecting the original semantics of the program. Therefore, tools are essential to minimize the e ort of a manual application of the refactoring steps and to prevent the introduction of new errors. Since current automated solutions focus only on Java programs, they do not consider the use of aspects to encapsulate crosscutting concerns. Thus, this dissertation proposes a novel collection of inference rules to derive type constraints for the polymorphic version of AspectJ. These rules were used together with an existing generic migration algorithm to enable the conversion of non-generic legacy code to add actual type parameters in both Java and AspectJ languages.