Download presentation
Presentation is loading. Please wait.
Published byDonald Page Modified over 8 years ago
1
IDENTIFYING SEMANTIC DIFFERENCES IN ASPECTJ PROGRAMS Martin Görg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University
2
Outline Motivation and Background Difference Analysis Algorithm Evaluation of Quality and Feasibility Conclusions
3
Motivation and Background
4
Static Semantic Difference Analysis static: source code analysis at compile time semantic: differences in behavior PP’ modified
5
Why solve the Problem? Motivation Reduce testing costs Produce correct software Possible applications Debugging support Regression test selection Program slicing
6
AOP and AspectJ AOP encapsulates crosscutting concerns AspectJ implementation of AOP extension to Java public class C { int i; void m1() { } … } Base Code aspect A { double C.d; before() : … { } …. } Aspect Code Introduce Advise
7
AspectJ Example 1 aspect Constraints { 2 public boolean Shape.immovable = false; 2 void around(Shape s) : execution (public Shape+.set*(..)) && target(s) { 3 if (!s.immovable) {proceed( ) ; } } } ITD around advice
8
Hammocks Single entry Single exit For any directed graph S E
9
Motivational Example 1 public class Point extends Shape { 2 private int x, y; 3 public void setX(int i){ 4 x = i; } 5 public void setY(int i){ 6 y = i; } 1 public class Point extends Shape { 2 private int x, y; 3 public void setX(int i){ 4 x = i; } 5 void setY(int i){ 6 y = i; } a change in visibility alters program execution
10
for AspectJ Programs Difference Analysis Algorithm
11
Algorithm Outline 1. For every module in P find a matching module in P’ (module-level matching) 2. Build extended CFGs for all modules in P and P’ and identify hammocks 3. Perform node-by-node comparison on every pair of hammock graphs (node-level matching)
12
Matching at Module Level Signature matching Disjunctive matching Obtain best match from multiple candidates public void p1.C1.add(int, Object) P:P: boolean p1.C1.add(int, Object) P’: public void p1.C1.add(int, Object) P:P: boolean p1.C1.add(double, Object) P’:
13
1. Matching at Module Level Problem: Not every AspectJ construct has a signature (most importantly: advices) Solution: a)Define new AspectJ signatures (e.g. [strictfp] before (Formals) : [throws TypeList] : Pointcut {Body} ) b)Define disjunctive patterns for these signatures
14
2. Build CFGs and Hammocks
15
3. Matching at Node Level Simultaneous graph traversal Node-by-node comparison Recursive Two user inputs Similarity threshold (S) Maximum lookahead (LH)
16
3. Matching at Node Level X E Y H P X E Y H P’ S UV e P S UV’ e P’ Similarity Threshold S = 0.5; Lookahead LH = 1
17
Quality and Feasibility Tests and Evaluation
18
ProgramLOCDiffsAffectedMatchedErrors ants14514262446 (100%)0 bean1991930268 (100%)0 cona-stack38119730 (100%)0 dcm314068415232771 (100%)0 figure14842101177 (100%)0 introduction233418362 (98.3%)6 nullcheck29801362582828 (98.2%)78 quicksort1151427155 (100%)0 spacewar305312834496 (100%)0 tracing33055164442 (100%)0 Signature definitions and disjunctive matching Minimal change with maximal effect Deficits: some combinations and swapped statements
19
S < 0.6: LH has only minor impact LH 20: within one minute S 0.6: slow for LH > 20, but not needed
20
New Findings and Open Tasks Conclusions
21
What we did New signatures for AspectJ modules Disjunctive matching for AspectJ and Java modules a solution for modified signatures Application of hammock algorithm from OO to AO Evaluations using a tool implementation
22
Conclusions Disjunctive matching is a good idea modules are correctly matched more work for node-level matching eliminates work of type-level matching replaces user interaction Type-level matching is not required Hammock graph matching can be applied given: a) correctly matched modules b) appropriately modeled and labeled CFGs
23
Future Work Improve disjunctive matching patterns Extend CFG representations Solve the swapping problem Handle dynamic pointcuts
24
Questions? Thank You for listening
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.