SlideShare a Scribd company logo
1 of 47
Download to read offline
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
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
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.
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.
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.
Context changes tend to be similar

Similar conditions for all methods




Similar conditions for specific methods
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
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);
  }
Pattern extraction process
Pattern extraction process
          Context
          changes
Pattern extraction process
          Context
          changes
Pattern extraction process
          Context
          changes
Pattern extraction process
          Context    Invocation
          changes   aggregation
Pattern extraction process
          Context    Invocation    Pattern
          changes   aggregation   extraction
Pattern extraction process
          Context    Invocation    Pattern
          changes   aggregation   extraction
Invocation aggregation


Method invocations   Invocation signature




list.add(myObject)   java.util.List.add(MyClass)
Invocation aggregation


Method invocations   Invocation signature




list.add(myObject)   java.util.List.add(MyClass)
Invocation aggregation


Method invocations   Invocation signature




list.add(myObject)   java.util.List.add(MyClass)
Invocation aggregation

    Method invocation    Invocation signature
    list.add(anObject)   java.util.List.add(MyClass)
Invocation aggregation

    Method invocation    Invocation signature
    list.add(anObject)   java.util.List.add(MyClass)




    Same Package
Invocation aggregation

    Method invocation    Invocation signature
    list.add(anObject)   java.util.List.add(MyClass)




    Same Package

      Imports
Invocation aggregation

    Method invocation          Invocation signature
    list.add(anObject)         java.util.List.add(MyClass)




                         JDT




    Same Package

      Imports
Invocation aggregation

    Method invocation          Invocation signature
    list.add(anObject)         java.util.List.add(MyClass)




                         JDT




    Same Package

      Imports
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
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
Pattern extraction


Aggregated invocations     Context change patterns




list != null &&            <qualifier> != null

!list.contains(myObject)   !<qualifier>.contains(<argument_0>)



list.add(myObject)
Pattern extraction


Aggregated invocations     Context change patterns




list != null &&            <qualifier> != null

!list.contains(myObject)   !<qualifier>.contains(<argument_0>)



list.add(myObject)
Pattern extraction


Aggregated invocations     Context change patterns




list != null &&            <qualifier> != null

!list.contains(myObject)   !<qualifier>.contains(<argument_0>)



list.add(myObject)
Pattern extraction

       Aggregated invocations     Context change patterns
       list != null &&            <qualifier> != null
       !list.contains(myObject)
                                  !<qualifier>.contains(<argument_0>)




  Split compound
  conditions into
  single conditions
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
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
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)
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)
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)
Recommendation
Recommendation
Recommendation
Recommendation



                 java.util.List.add(MyClass)
Recommendation



                 java.util.List.add(MyClass)
Recommendation



                 java.util.List.add(MyClass)
Recommendation



                          java.util.List.add(MyClass)




           x
               x

       Surrounding if
       already contains
       condition

       Filter predefined
       method
       invocations
Recommendation



                          java.util.List.add(MyClass)




           x
               x

       Surrounding if
       already contains
       condition

       Filter predefined
       method
       invocations
ChangeCommander
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
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
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
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.

More Related Content

What's hot

Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
Gabriele Lana
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
Pramod Kumar
 
Javascript basic course
Javascript basic courseJavascript basic course
Javascript basic course
Tran Khoa
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
brecke
 
Joose @jsconf
Joose @jsconfJoose @jsconf
Joose @jsconf
malteubl
 

What's hot (20)

Refactoring In Tdd The Missing Part
Refactoring In Tdd The Missing PartRefactoring In Tdd The Missing Part
Refactoring In Tdd The Missing Part
 
Use of Apache Commons and Utilities
Use of Apache Commons and UtilitiesUse of Apache Commons and Utilities
Use of Apache Commons and Utilities
 
JDK Power Tools
JDK Power ToolsJDK Power Tools
JDK Power Tools
 
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
Let's go Developer 2011 sendai Let's go Java Developer (Programming Language ...
 
Beyond Java: 자바 8을 중심으로 본 자바의 혁신
Beyond Java: 자바 8을 중심으로 본 자바의 혁신Beyond Java: 자바 8을 중심으로 본 자바의 혁신
Beyond Java: 자바 8을 중심으로 본 자바의 혁신
 
Oleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoC
 
Easy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVEEasy Going Groovy 2nd season on DevLOVE
Easy Going Groovy 2nd season on DevLOVE
 
Javascript basic course
Javascript basic courseJavascript basic course
Javascript basic course
 
Java best practices
Java best practicesJava best practices
Java best practices
 
Annotation Processing in Android
Annotation Processing in AndroidAnnotation Processing in Android
Annotation Processing in Android
 
Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)Refactoring to Java 8 (Devoxx BE)
Refactoring to Java 8 (Devoxx BE)
 
QTP Online Training
QTP Online Training QTP Online Training
QTP Online Training
 
Java Programming - 04 object oriented in java
Java Programming - 04 object oriented in javaJava Programming - 04 object oriented in java
Java Programming - 04 object oriented in java
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
 
The uniform interface is 42
The uniform interface is 42The uniform interface is 42
The uniform interface is 42
 
Jstl 8
Jstl 8Jstl 8
Jstl 8
 
Autoboxing and unboxing
Autoboxing and unboxingAutoboxing and unboxing
Autoboxing and unboxing
 
Joose @jsconf
Joose @jsconfJoose @jsconf
Joose @jsconf
 
JRuby hacking guide
JRuby hacking guideJRuby hacking guide
JRuby hacking guide
 
Grammatical Optimization
Grammatical OptimizationGrammatical Optimization
Grammatical Optimization
 

Viewers also liked

Why Is Obesity A Political Problem
Why Is Obesity A Political ProblemWhy Is Obesity A Political Problem
Why Is Obesity A Political Problem
ndaniels33
 
The Russian Provisional Government & its problems
The Russian Provisional Government & its problemsThe Russian Provisional Government & its problems
The Russian Provisional Government & its problems
colek2014
 
Report ethics in government service
Report ethics in government serviceReport ethics in government service
Report ethics in government service
Louie Medinaceli
 
Political and administrative structure
Political and administrative structurePolitical and administrative structure
Political and administrative structure
Alex Francis Cabrera
 

Viewers also liked (11)

Why Is Obesity A Political Problem
Why Is Obesity A Political ProblemWhy Is Obesity A Political Problem
Why Is Obesity A Political Problem
 
Karen Hill SIGMA-EU event on Public administration reform challenges Skopje 1...
Karen Hill SIGMA-EU event on Public administration reform challenges Skopje 1...Karen Hill SIGMA-EU event on Public administration reform challenges Skopje 1...
Karen Hill SIGMA-EU event on Public administration reform challenges Skopje 1...
 
The Russian Provisional Government & its problems
The Russian Provisional Government & its problemsThe Russian Provisional Government & its problems
The Russian Provisional Government & its problems
 
Pscn
PscnPscn
Pscn
 
Android ipm 20110409
Android ipm 20110409Android ipm 20110409
Android ipm 20110409
 
Report ethics in government service
Report ethics in government serviceReport ethics in government service
Report ethics in government service
 
Dynamism of Philippine Administrative System and its Role to National Develop...
Dynamism of Philippine Administrative System and its Role to National Develop...Dynamism of Philippine Administrative System and its Role to National Develop...
Dynamism of Philippine Administrative System and its Role to National Develop...
 
Philippine Administrative System (PAS)
Philippine Administrative System  (PAS)Philippine Administrative System  (PAS)
Philippine Administrative System (PAS)
 
Political and administrative structure
Political and administrative structurePolitical and administrative structure
Political and administrative structure
 
DPA 102 Philippine Administrative System
DPA 102 Philippine Administrative SystemDPA 102 Philippine Administrative System
DPA 102 Philippine Administrative System
 
Karen Hill, presentation,SIGMA Bilateral Event,Principles of Public Administr...
Karen Hill, presentation,SIGMA Bilateral Event,Principles of Public Administr...Karen Hill, presentation,SIGMA Bilateral Event,Principles of Public Administr...
Karen Hill, presentation,SIGMA Bilateral Event,Principles of Public Administr...
 

Similar to Recommending Method Invocation Context Changes

NetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience ReportNetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience Report
Anton Arhipov
 
Test-Driven Development for TYPO3
Test-Driven Development for TYPO3Test-Driven Development for TYPO3
Test-Driven Development for TYPO3
Oliver Klee
 
Test-driven Development for TYPO3
Test-driven Development for TYPO3Test-driven Development for TYPO3
Test-driven Development for TYPO3
Oliver Klee
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
brecke
 
Test-Driven Development for TYPO3 @ T3CON12DE
Test-Driven Development for TYPO3 @ T3CON12DETest-Driven Development for TYPO3 @ T3CON12DE
Test-Driven Development for TYPO3 @ T3CON12DE
Oliver Klee
 

Similar to Recommending Method Invocation Context Changes (20)

NetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience ReportNetBeans Plugin Development: JRebel Experience Report
NetBeans Plugin Development: JRebel Experience Report
 
Test-Driven Development for TYPO3
Test-Driven Development for TYPO3Test-Driven Development for TYPO3
Test-Driven Development for TYPO3
 
Test-driven Development for TYPO3
Test-driven Development for TYPO3Test-driven Development for TYPO3
Test-driven Development for TYPO3
 
Pragmatic unittestingwithj unit
Pragmatic unittestingwithj unitPragmatic unittestingwithj unit
Pragmatic unittestingwithj unit
 
Intro to Testing in Zope, Plone
Intro to Testing in Zope, PloneIntro to Testing in Zope, Plone
Intro to Testing in Zope, Plone
 
SOLID mit Java 8
SOLID mit Java 8SOLID mit Java 8
SOLID mit Java 8
 
Testing untestable code - DPC10
Testing untestable code - DPC10Testing untestable code - DPC10
Testing untestable code - DPC10
 
javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1javascript-cheat-sheet-v1_1
javascript-cheat-sheet-v1_1
 
Java q ref 2018
Java q ref 2018Java q ref 2018
Java q ref 2018
 
Tools09 – Reusing & Composing Tests with Traits
Tools09 – Reusing & Composing Tests with TraitsTools09 – Reusing & Composing Tests with Traits
Tools09 – Reusing & Composing Tests with Traits
 
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
EContent_11_2023_04_09_11_30_38_Unit_3_Objects_and_Classespptx__2023_03_20_12...
 
Generic Programming
Generic ProgrammingGeneric Programming
Generic Programming
 
Introduction to Client-Side Javascript
Introduction to Client-Side JavascriptIntroduction to Client-Side Javascript
Introduction to Client-Side Javascript
 
Java custom annotations example
Java custom annotations exampleJava custom annotations example
Java custom annotations example
 
DynaMine: Finding Common Error Patterns by Mining Software Revision Histories
DynaMine: Finding Common Error Patterns by Mining Software Revision HistoriesDynaMine: Finding Common Error Patterns by Mining Software Revision Histories
DynaMine: Finding Common Error Patterns by Mining Software Revision Histories
 
Test-Driven Development for TYPO3 @ T3CON12DE
Test-Driven Development for TYPO3 @ T3CON12DETest-Driven Development for TYPO3 @ T3CON12DE
Test-Driven Development for TYPO3 @ T3CON12DE
 
The Anatomy of Analysis Tools (EVO 2008)
The Anatomy of Analysis Tools (EVO 2008)The Anatomy of Analysis Tools (EVO 2008)
The Anatomy of Analysis Tools (EVO 2008)
 
Leveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better ValidationLeveraging Scala Macros for Better Validation
Leveraging Scala Macros for Better Validation
 
Spring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing SupportSpring 3.1 and MVC Testing Support
Spring 3.1 and MVC Testing Support
 
Java Annotation Processing: A Beginner Walkthrough
Java Annotation Processing: A Beginner WalkthroughJava Annotation Processing: A Beginner Walkthrough
Java Annotation Processing: A Beginner Walkthrough
 

Recently uploaded

Recently uploaded (20)

Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 

Recommending Method Invocation Context Changes

  • 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. 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. 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. 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. 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. Context changes tend to be similar Similar conditions for all methods Similar conditions for specific methods
  • 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. 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); }
  • 10. Pattern extraction process Context changes
  • 11. Pattern extraction process Context changes
  • 12. Pattern extraction process Context changes
  • 13. Pattern extraction process Context Invocation changes aggregation
  • 14. Pattern extraction process Context Invocation Pattern changes aggregation extraction
  • 15. Pattern extraction process Context Invocation Pattern changes aggregation extraction
  • 16. Invocation aggregation Method invocations Invocation signature list.add(myObject) java.util.List.add(MyClass)
  • 17. Invocation aggregation Method invocations Invocation signature list.add(myObject) java.util.List.add(MyClass)
  • 18. Invocation aggregation Method invocations Invocation signature list.add(myObject) java.util.List.add(MyClass)
  • 19. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass)
  • 20. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) Same Package
  • 21. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) Same Package Imports
  • 22. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) JDT Same Package Imports
  • 23. Invocation aggregation Method invocation Invocation signature list.add(anObject) java.util.List.add(MyClass) JDT Same Package Imports
  • 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. 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. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) list.add(myObject)
  • 27. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) list.add(myObject)
  • 28. Pattern extraction Aggregated invocations Context change patterns list != null && <qualifier> != null !list.contains(myObject) !<qualifier>.contains(<argument_0>) list.add(myObject)
  • 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. 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. 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. 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. 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. 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)
  • 38. Recommendation java.util.List.add(MyClass)
  • 39. Recommendation java.util.List.add(MyClass)
  • 40. Recommendation java.util.List.add(MyClass)
  • 41. Recommendation java.util.List.add(MyClass) x x Surrounding if already contains condition Filter predefined method invocations
  • 42. Recommendation java.util.List.add(MyClass) x x Surrounding if already contains condition Filter predefined method invocations
  • 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. 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. 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. 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.