ASPECT IMPACT ANALYSIS

by Dehua Zhang

School of Computer Science McGill University, Montr´eal

August 2008

ATHESISSUBMITTEDTOTHE FACULTY OF GRADUATE STUDIESAND RESEARCH INPARTIALFULFILLMENTOFTHEREQUIREMENTSFORTHEDEGREEOF

MASTEROF SCIENCE

Copyright c 2008 by Dehua Zhang

Library and Archives Bibliothèque et Canada Archives Canada

Published Heritage Direction du Branch Patrimoine de l’édition

395 Wellington Street 395, rue Wellington Ottawa ON K1A 0N4 Ottawa ON K1A 0N4 Canada Canada

Your file Votre référence ISBN: 978-0-494-56887-3 Our file Notre référence ISBN: 978-0-494-56887-3

NOTICE: AVIS:

The author has granted a non- L’auteur a accordé une licence non exclusive exclusive license allowing Library and permettant à la Bibliothèque et Archives Archives Canada to reproduce, Canada de reproduire, publier, archiver, publish, archive, preserve, conserve, sauvegarder, conserver, transmettre au public communicate to the public by par télécommunication ou par l’Internet, prêter, telecommunication or on the Internet, distribuer et vendre des thèses partout dans le loan, distribute and sell theses monde, à des fins commerciales ou autres, sur worldwide, for commercial or non- support microforme, papier, électronique et/ou commercial purposes, in microform, autres formats. paper, electronic and/or any other formats. . The author retains copyright L’auteur conserve la propriété du droit d’auteur ownership and moral rights in this et des droits moraux qui protège cette thèse. Ni thesis. Neither the thesis nor la thèse ni des extraits substantiels de celle-ci substantial extracts from it may be ne doivent être imprimés ou autrement printed or otherwise reproduced reproduits sans son autorisation. without the author’s permission.

In compliance with the Canadian Conformément à la loi canadienne sur la Privacy Act some supporting forms protection de la vie privée, quelques may have been removed from this formulaires secondaires ont été enlevés de thesis. cette thèse.

While these forms may be included Bien que ces formulaires aient inclus dans in the document page count, their la pagination, il n’y aura aucun contenu removal does not represent any loss manquant. of content from the thesis.

Abstract

One of the major challenges in aspect-oriented programming is that aspects may have unintended impacts on a base program. Thus, it is important to develop techniques and tools that can both summarize the impacts and provide information about the causes of the impacts. This thesis presents impact analyses for AspectJ. Our approach detects different ways and inter-type declarations interact and in- terfere with the base program and focuses on four kinds of impacts, state impacts which cause changes of state in the base program, computation impacts which cause changes in functionality by adding, removing or replacing computations of the base program, shad- owing impacts which cause changes of field reference in the base program, and lookup impacts which cause changes of method lookup in the base program. We provide a classification scheme for these kinds of impacts and then develop a set of static analyses to estimate these impacts. A key feature of our approach is the use of points-to analysis to provide more accurate estimates. Further, our analysis results allow us to trace back to find the causes of the impacts. We have implemented our techniques in the AspectBench compiler. By implementing them in an AspectJ compiler, all kinds of , advice and inter-type declarations can be analyzed. We also have integrated these analyses into an AspectJ IDE and provided a two-way navigation between impacts and program source code. In addition, we have carried out experiments on example programs and benchmarks to investigate the results of our analyses.

i ii R e´sume´

L’un des princip