Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Recommending Method Invocation Context Changes

1,273 views

Published on

Published in: Technology, News & Politics
  • Be the first to comment

Recommending Method Invocation Context Changes

  1. 1. ChangeCommander Recommending Method Invocation Context Changes Beat Fluri, Jonas Zuberbühler, and Harald C. Gall s.e.a.l. - software evolution & architecture lab Department of Informatics University of Zurich, Switzerland University of Zurich Department of Informatics software evolution & architecture lab
  2. 2. Which changes fix bugs? Bug fix change study on Eclipse 43 plugins from Platform, JDT, and PDE 15% of bugs fixes contain context changes of method invocation statements
  3. 3. Which changes fix bugs? Bug fix change study on Eclipse 43 plugins from Platform, JDT, and PDE 15% of bugs fixes contain context changes of method invocation statements Method Invocation Context Change Moving a method invocation into the then or the else-part of an if-statement.
  4. 4. Which changes fix bugs? Bug fix change study on Eclipse 43 plugins from Platform, JDT, and PDE visited.add(outputFolder); 15% of bugs fixes contain context changes of method invocation statements Method Invocation Context Change Moving a method invocation into the then or the else-part of an if-statement.
  5. 5. Which changes fix bugs? Bug fix change study on Eclipse 43 pluginsif (!visited.contains(outputFolder)) { from Platform, JDT, and PDE visited.add(outputFolder); 15% of bugs fixes contain context changes of method invocation statements } Method Invocation Context Change Moving a method invocation into the then or the else-part of an if-statement.
  6. 6. Context changes tend to be similar Similar conditions for all methods Similar conditions for specific methods
  7. 7. Context changes tend to be similar Similar conditions for all methods if (myObject != null) { if (list != null) { list.add(myObject); list.add(myObject); } } Similar conditions for specific methods
  8. 8. Context changes tend to be similar Similar conditions for all methods if (myObject != null) { if (list != null) { list.add(myObject); list.add(myObject); } } Similar conditions for specific methods if (!list.contains(myObject)) { list.add(myObject); }
  9. 9. Pattern extraction process
  10. 10. Pattern extraction process Context changes
  11. 11. Pattern extraction process Context changes
  12. 12. Pattern extraction process Context changes
  13. 13. Pattern extraction process Context Invocation changes aggregation
  14. 14. Pattern extraction process Context Invocation Pattern changes aggregation extraction
  15. 15. Pattern extraction process Context Invocation Pattern changes aggregation extraction
  16. 16. Invocation aggregation Method invocations Invocation signature list.add(myObject) java.util.List.add(MyClass)
  17. 17. Invocation aggregation Method invocations Invocation signature list.add(myObject) java.util.List.add(MyClass)
  18. 18. Invocation aggregation Method invocations Invocation signature list.add(myObject) java.util.List.add(MyClass)
  19. 19. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass)
  20. 20. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) Same Package
  21. 21. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) Same Package Imports
  22. 22. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) JDT Same Package Imports
  23. 23. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) JDT Same Package Imports
  24. 24. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) Post Resolver JDT Match in scope variables Match in imports ... Same Package Imports
  25. 25. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) Post Resolver JDT Match in scope variables Match in imports ... Same Package Imports
  26. 26. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) list.add(myObject)
  27. 27. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) list.add(myObject)
  28. 28. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) list.add(myObject)
  29. 29. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) Split compound conditions into single conditions
  30. 30. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) Split compound conditions into Token streams for single conditions - conditions - method invocation
  31. 31. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) Split compound conditions into Token streams for single conditions - conditions - method invocation
  32. 32. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) Split compound conditions into Token streams for single conditions - conditions - method invocation list.add(myObject)
  33. 33. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) Split compound conditions into Token streams for single conditions - conditions - method invocation list.add(myObject)
  34. 34. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) Split compound conditions into Token streams for single conditions - conditions - method invocation list.add(myObject)
  35. 35. Recommendation
  36. 36. Recommendation
  37. 37. Recommendation
  38. 38. Recommendation java.util.List.add(MyClass)
  39. 39. Recommendation java.util.List.add(MyClass)
  40. 40. Recommendation java.util.List.add(MyClass)
  41. 41. Recommendation java.util.List.add(MyClass) x x Surrounding if already contains condition Filter predefined method invocations
  42. 42. Recommendation java.util.List.add(MyClass) x x Surrounding if already contains condition Filter predefined method invocations
  43. 43. ChangeCommander
  44. 44. A first validation Split history Training set: Past context changes up to a certain release Test set: Context changes after that particular release Recommended context change True positive (TP): in test set False positive (FP): not in test set False negative (FN): context change in test set but not recommended
  45. 45. A first validation Project TP #B FP FN ArgoUML 29 11 4675 75 Azureus 15 3 - 82 Eclipse JDT 51 27 - 158 Eclipse PDE 35 25 8011 46 jEdit 1 0 1307 13
  46. 46. A first validation Project TP #B FP FN ArgoUML 29 11 4675 75 Azureus 15 3 - 82 Eclipse JDT 51 27 - 158 Eclipse PDE 35 25 8011 46 jEdit 1 0 1307 13
  47. 47. Conclusions Recommending context changes We leverages context change data to suggest corresponding modifications on existing or newly added method invocations. ChangeCommander By integrating our recommendation approach into the development process, we aim at reducing future bugs.

×