1 / 24

Identifying Semantic Differences in AspectJ Programs

Identifying Semantic Differences in AspectJ Programs. Martin G ö rg and Jianjun Zhao Computer Science Department, Shanghai Jiao Tong University. Outline. Motivation and Background Difference Analysis Algorithm Evaluation of Quality and Feasibilit y Conclusions. Motivation and Background.

katina
Télécharger la présentation

Identifying Semantic Differences in AspectJ Programs

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  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 modified P P’

  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 Aspect Code Base Code aspect A { double C.d; before() : … { } …. } public class C { int i; void m1() { } … } Introduce Advise

  7. AspectJ Example • aspect Constraints { • public boolean Shape.immovable = false; • void around(Shape s) :execution (public Shape+.set*(..))&& target(s) { • 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. Difference Analysis Algorithm for AspectJ Programs

  11. Algorithm Outline • For every module in P find a matching module in P’ (module-level matching) • Build extended CFGs for all modules in P and P’ and identify hammocks • 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 P: P’: P: P’: public void p1.C1.add(int, Object) boolean p1.C1.add(int, Object) public void p1.C1.add(int, Object) boolean p1.C1.add(double, Object)

  13. 1. Matching at Module Level • Problem: Not every AspectJ construct has a signature (most importantly: advices) • Solution: • Define new AspectJ signatures(e.g.[strictfp] before (Formals) : [throws TypeList] : Pointcut {Body}) • 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 Similarity Threshold S = 0.5; Lookahead LH = 1 P P’ X X P P’ S S H H U U V V’ E E e e Y Y

  17. Tests and Evaluation Quality and Feasibility

  18. 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. Conclusions New Findings and Open Tasks

  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: • correctly matched modules • appropriately modeled and labeled CFGs

  23. Future Work • Improve disjunctive matching patterns • Extend CFG representations • Solve the swapping problem • Handle dynamic pointcuts

  24. Thank You for listening Questions?

More Related