170 likes | 226 Views
Learn how to find all dependencies of a member function called getName in a class named Class using Aspect Browser. Implement modularized language-dependent aspects to streamline the modification process. Discover the process of creating an Aspect Browser language-independent database and using it to modify functions efficiently.
E N D
Aspect Browser Plus Ling Neil Patricia
Motivation • When modifying code it is important to find all dependencies • Backtracing is helpful when learning new code
Scenario • Find all references to a member function called getName that is in a class called Class • Looking for: • classNew.getName() • myClass.getName() • anything.getName() • As long as it is of type Class
How to do this with AB • Create getName() aspect: • May result in a lot of false positives • Create Class aspect and note all variables that have this type. Search for variable.getName() • Tedious • Detracts from task at hand • Won’t find implicit this references • Take advantage of naming conventions • No guarantee
Goals • Keep Aspect Browser language independent • Minimize modification to AB • Modularize language dependent portion
How did we do it? • Language dependent component creates a “database” • Can use any method desired to populate file • Aspect Browser uses database when Aspect Plus Aspects are created • getName@@Class
Demo • Want to modify getName() function of a class called Class
What went right? • Modularization was almost perfect • I still have no idea how Patricia’s code works • Patricia and Ling have never seen my modifications • Integration with Aspect Browser was almost trivial. • AspectPlus inherited from Aspect • Factory created AspectPlus based on string parse
What went wrong? • We couldn’t use this on Aspect Browser itself because of AspectJ. Bummer! • Emacs interface is not perfect
What’s next? • Support for another language (c++) • Support member variable references as well • Support RegExp matches • Fix bug with emacs’ highlighting
Call Data Collection Implementation • Java bytecode based collector. Requires pre-compiled files. • Uses Apache BCEL to read and parse class files. • Extracts source file, line number, target type, and function name for each call.
Call Collection Issues • Requires optional line number and local variable tables. Debug compile generates them. • Compilation and collection should be automated. • Virtual calls - currently indicates only match to compile time type.
Function of AspectPlusDatabase • User Interface calls findAspect with sFile, sType and sFunction. • findAspect goes through the Database and returns the line for every occurrence of them.
Implementation1 • AspectPlusDatabase goes through the Database once and saves all the information in a hashmap for later uses.
Implementation2 • AspectPlusDatabase finds the vector by key sFile, then finds sType and sName in the vector.