AspectJ is a convenient Aspect-Oriented programming (AOP) extension of Java, which
addresses cross-cutting concerns but breaks encapsulation. In this project, we analyze and
visualize impacts caused by aspects. Impacts are classified by a new classification system,
analyzed using static analyses, and visualized with an Eclipse plug-in. Thus, hidden effect
of aspects can be understood and analyzed by programmers easily.
We presented different ways that advice and inter-type declarations can
interfere with the state and computation of a base program and proposed a
concise classification of impacts caused by them crosscutting the base program.
We classified these impacts as
state impacts --- which are caused by advice
affecting the state of base program, and
computation impacts --- which are
caused by advice affecting the computation of base program,
shadowing impacts --- which are caused by inter-type declarations affecting the field
reference of base program, and
lookup impacts --- which are caused by
inter-type declarations affecting the method lookup of base program.
In addition, we further classified state impacts into direct state
impacts and indirect state impacts; and classified computation
impacts as addition, elimination, definite-substitution,
conditional-substitution and mixed. Our definition of a base program
follows the principle that ``everything except me'', and our tool covers
interference between aspects naturally.
Based on this classification, we implemented static impact analyses in the abc
compiler to analyze all kinds of advice and inter-type declarations. By using
the points-to analysis and side-effect analysis supported by Soot, our impact
analyses system can give precise estimations of impacts. Our approach also
produces an informative analysis report. In the report, we not only report the
impact information, but also report the causes of impacts, so we can guide the
programmer to understand the key impacts of aspects on their program.
We also integrated these analyses into an IDE. We integrated our toolkit into
Eclipse and produced an interactive tree-structure view of the report that both
allows programmers to view the impacts in a more graphical manner and allows
programmers to navigate directly to the parts of the source code involved in
the impacts. In addition, we generate markers into the source code editor so
that programmers can be aware of the impacts when browsing the source code.
Moreover, we provide the function to link the impact report view to the current
editing location in the source code editor so that programmers can focus on the
impacts only related to the source code being edited.
Most of the work on AIA is documented in Dehua's Msc thesis.
To get the text report of impacts, compile AspectJ programs using abc and
enable the impact extension by specifying -ext abc.impact
in the command line.
To run the Eclipse plug-in, just right click on your AspectJ project and then
select "abc Tools" - "Run Impact Analysis", and a view called "Impact" will
show up and display all impacts.
Since we run points-to analysis, which needs a lot of memory, we suggest increasing
the memory size allocated to Java. For command line, refer to
abc's documentation to
increase the memory size; for the Eclipse plug-in, specify -vmargs -Xmx1024m
argument to Eclipse.