LSRepair: Live Search of Fix Ingredients for Automated Program Repair

Dongsun Kim
Dongsun KimResearch Associate
LSRepair: Live Search of Fix Ingredients
for Automated Program Repair
Kui Liu, Anil Koyuncu, Kisub Kim, Dongsun Kim, and Tegawendé F. Bissyandé
SnT, University of Luxembourg, Luxembourg
@ Nara Japan, 25th APSEC 2018December 7, 2018
1
> Basic Process of Automated Program Repair (APR)
Fault
Localization
Test
Pass
Fail
Patch
Candidate
APR
Tools
Suspicious
buggy code
Where is the code to be fixed? How to generate patches? Is the patch correct?
passing
tests
Passing
tests
Failing
tests
State-of-the-art APR tools for Java bugs: jGenProg [9], jKali [9], jMutRepair [9], HDRepair [10], Nopol [28], ACS [29],
ssFix [54], ELIXIR [55], SketchFix [56], CapGen [13], and SimFix1.
1. Jiang, Jiajun, et al. "Shaping Program Repair Space with Existing Patches and Similar Code." ISSTA 2018.
Plausible
Patch
2
> Statement Level Bug Fixing
Class name Line No. Suspiciousness
…..…..
Suspicious statements of bug Chart-1 in Defects4J reported by GZoltar 0.1.1.
…..…..
Bug Chart_1 in Defects4J fixed by jMutRepair, ELIXIR, ssFix, JAID,
SketchFix, CapGen, SimFix.
org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
3
> Search Space Issues
P
P
P
P P
P P
P
P
P
PP P
P
P
P
P
PP P
P
P
P
P P
P P
P
P
P
PP
P
P
P
P
P Incorrect patch.
P Correct patch.
P Plausible but incorrect patch.
P
P
(1) The search space could be too
small to include correct patches.
(2) The search space could be too
big to include more plausible but
incorrect patches.
P
P
Search space: a set of patches generated by APR tools.
4
> Suspicious but non-buggy statements in one method
5
> Question
Could we fix bugs at method declaration level
to reduce the search space of fix ingredients
for incorrect patches and purify the search
space for correct patches?
6
> Intuition
Developers write code or clone code to address similar tasks.
program1
program2
program3 DesignsDeveloping Routine
Our intuition is that while some code may be buggy, the
similar code may have been fixed.
7
> LSRepair Approach
Live Search of fix ingredients in real-world code bases to repair bugs automatically.
Overview of LSRepair
Suspicious
methods
Fault localization
Search similar methods
Generate and Validate
patches
8
LSRepair DESIGN
9
> Fault Localization
passing
tests
Passing
tests
Failing
tests
Gzoltar 0.1.1
Suspicious
statement list
Suspicious method list
…
...
…
...
…
...
…..…..
Bug Chart_1 in Defects4J.
org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
10
> Search Strategies for Similar Methods
……..
...
Suspicious method Search similar methods
S1. Signature-similar methods.
S2. Syntactically similar methods.
S3. Semantically similar methods.
Method Signature (MS):
MS = (rt, mn, Args),
rt: return type.
mn: method name.
Args: a set of parameter types.
Method code  search syntactic-similar
methods with deep learning technique in
our previous study [52] (TSE’18).
Method code  search semantic-similar
methods with FaCoY [50] (ICSE’18).
11
> Patch Generation
1. Signature-similar methods.
Replacing the buggy method with signature-similar methods directly.
12
> Patch Generation
1. Signature-similar methods.
Replacing the buggy method with signature-similar methods directly.
2. Syntactically similar methods.
3. Semantically similar methods.
Pivot statements (buggy code and patch candidate):
IfStatement, ExpressionStatement, VariableDeclaration, and ReturnStatement [53].
if (dataset != null) {
……
}
if (element == null) {
……
}
IfStatement: Modify its conditional expression by checking their differences on non-variable code.
Others: 1) Insert an IfStatement.
2) Delete the IfStatement.
3) Modify the IfStatement.
Buggy Code Code in similar methods
if (dataset == null) {
……
}
Patch Code
Type var = var2.get();
Buggy code
if (var_ != null) {
Type var = var_.get();
}
Code in similar methods
Type var = var2.get();
Buggy code
if (var_ != null) {
Type var = var_.get();
}
Code in similar methods
if (var2 == null) {
Type var = var2.get();
}
Buggy code
if (var_ == null) {
Type var = var_.get();
}
Code in similar methods
13
ASSESSMENT
14
> Real World Code Bases
10,449 GitHub Java projects used in FaCoy (11,043,044 methods).
Search space of similar methods:
• Signature-similar methods: all similar methods in our data set.
• Syntactically similar methods: top-10 most similar methods.
• Semantically similar methods: top-10 most similar methods.
15
> RQ: to what extent real-world bugs can be fixed by
LSRepair?
Project # Bugs kLoC # Tests
Chart 26 96 2,205
Closure 133 90 7,927
Lang 65 22 2,245
Math 106 85 3,602
Mockito 38 11 1,457
Time 27 28 4,130
Total 395 332 22,954
Defects4J [57] Dataset Information.
16
> Bugs correctly fixed by LSRepair
Bugs in Defects4J are correctly fixed by LSRepair.
S1. Signature-similar methods.
S2. Syntactically similar methods.
S3. Semantically similar methods.
17
> Quantitative Comparison with State-of-the-art APR Tools
APR Tool # plausibly fixed bugs # correctly fixed bugs
LSRepair 38 19
jGenProg [9] 29 5
HDRepair [10] 16 13
Nopol [28] 35 5
ACS [29] 21 18
ssFix [54] 60 20
ELIXIR [55] 41 26
SketchFix [56] 26 19
CapGen [13] 25 21
Chart-4,
Lang-29,46,48, 52, 54.
Math-91, 94.
Mockito-13.
Bugs are firstly and correctly
fixed by LSRepair.
LSRepair can be complementary to the state-of-the-art
automated program repair techniques.
18
> Limitation and Discussion
3. Method level granularity.
It cannot fix the bugs located in TypeDeclaration or FieldDeclaration.
2. Code Transformation.
Our prototype uses straightforward heuristics to transform the ingredients.
1. Syntactically or Semantically Similar Code Search Problem.
We use naive heuristics to prioritize code, based on the cosine similarity (e.g., syntactic and semantic) with
a given buggy code.
19
> Summary
13
> Bugs correctly fixed by LSRepair
Bugs in Defects4J are correctly fixed by LSRepair.
10
> Search Strategies
……..
...
Suspicious method Search similar methods
1. Signature-similar methods.
2. Syntactically similar methods.
3. Semantically similar methods.
5
> Motivation
Developers write code to address similar tasks, or clone code.
program1
program2
program3 DesignsDeveloping Routine
Our intuition is that while some code may be buggy, the
similar code may have been fixed .
6
> LSRepair Approach
Live Search of fix ingredients in real-world code bases to repair bugs automatically.
Fault Localization to
identify faulty methods
Generate patches
By code transform
Validate and
check correctness
Selection of code
search strategy
Program
https://github.com/AutoProRepair/LSRepair
1 of 20

Recommended

You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati... by
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...Dongsun Kim
529 views29 slides
A Closer Look at Real-World Patches by
A Closer Look at Real-World PatchesA Closer Look at Real-World Patches
A Closer Look at Real-World PatchesDongsun Kim
425 views26 slides
TBar: Revisiting Template-based Automated Program Repair by
TBar: Revisiting Template-based Automated Program RepairTBar: Revisiting Template-based Automated Program Repair
TBar: Revisiting Template-based Automated Program RepairDongsun Kim
379 views26 slides
Mining Fix Patterns for FindBugs Violations by
Mining Fix Patterns for FindBugs ViolationsMining Fix Patterns for FindBugs Violations
Mining Fix Patterns for FindBugs ViolationsDongsun Kim
641 views59 slides
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization by
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug LocalizationBench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug LocalizationDongsun Kim
780 views57 slides
iFixR: Bug Report Driven Program Repair by
iFixR: Bug Report Driven Program RepairiFixR: Bug Report Driven Program Repair
iFixR: Bug Report Driven Program RepairDongsun Kim
554 views35 slides

More Related Content

What's hot

Automated Program Repair Keynote talk by
Automated Program Repair Keynote talkAutomated Program Repair Keynote talk
Automated Program Repair Keynote talkAbhik Roychoudhury
5.7K views46 slides
Isorc18 keynote by
Isorc18 keynoteIsorc18 keynote
Isorc18 keynoteAbhik Roychoudhury
11.3K views50 slides
Repair dagstuhl jan2017 by
Repair dagstuhl jan2017Repair dagstuhl jan2017
Repair dagstuhl jan2017Abhik Roychoudhury
27K views38 slides
Symbexecsearch by
SymbexecsearchSymbexecsearch
SymbexecsearchAbhik Roychoudhury
16.6K views45 slides
Automated Repair - ISSTA Summer School by
Automated Repair - ISSTA Summer SchoolAutomated Repair - ISSTA Summer School
Automated Repair - ISSTA Summer SchoolAbhik Roychoudhury
10.6K views85 slides
Mobilesoft 2017 Keynote by
Mobilesoft 2017 KeynoteMobilesoft 2017 Keynote
Mobilesoft 2017 KeynoteAbhik Roychoudhury
23.9K views45 slides

What's hot(20)

Automated Repair - ISSTA Summer School by Abhik Roychoudhury
Automated Repair - ISSTA Summer SchoolAutomated Repair - ISSTA Summer School
Automated Repair - ISSTA Summer School
Abhik Roychoudhury10.6K views
Code Analysis-run time error prediction by NIKHIL NAWATHE
Code Analysis-run time error predictionCode Analysis-run time error prediction
Code Analysis-run time error prediction
NIKHIL NAWATHE723 views
STAR: Stack Trace based Automatic Crash Reproduction by Sung Kim
STAR: Stack Trace based Automatic Crash ReproductionSTAR: Stack Trace based Automatic Crash Reproduction
STAR: Stack Trace based Automatic Crash Reproduction
Sung Kim7K views
Crowd debugging (FSE 2015) by Sung Kim
Crowd debugging (FSE 2015)Crowd debugging (FSE 2015)
Crowd debugging (FSE 2015)
Sung Kim1.9K views
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014) by Sung Kim
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
Sung Kim6.4K views
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs by Dacong (Tony) Yan
SherLog: Error Diagnosis by Connecting Clues from Run-time LogsSherLog: Error Diagnosis by Connecting Clues from Run-time Logs
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs
Griffin: Grouping Suspicious Memory-Access Patterns to Improve Understanding... by Sangmin Park
Griffin: Grouping Suspicious Memory-Access Patterns to Improve Understanding...Griffin: Grouping Suspicious Memory-Access Patterns to Improve Understanding...
Griffin: Grouping Suspicious Memory-Access Patterns to Improve Understanding...
Sangmin Park412 views
Effective Fault-Localization Techniques for Concurrent Software by Sangmin Park
Effective Fault-Localization Techniques for Concurrent SoftwareEffective Fault-Localization Techniques for Concurrent Software
Effective Fault-Localization Techniques for Concurrent Software
Sangmin Park837 views
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria... by Sung Kim
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
Sung Kim2.5K views
Static analysis works for mission-critical systems, why not yours? by Rogue Wave Software
Static analysis works for mission-critical systems, why not yours? Static analysis works for mission-critical systems, why not yours?
Static analysis works for mission-critical systems, why not yours?
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014) by Sung Kim
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Sung Kim1.9K views
Deep API Learning (FSE 2016) by Sung Kim
Deep API Learning (FSE 2016)Deep API Learning (FSE 2016)
Deep API Learning (FSE 2016)
Sung Kim1.4K views

Similar to LSRepair: Live Search of Fix Ingredients for Automated Program Repair

A preliminary study on using code smells to improve bug localization by
A preliminary study on using code smells to improve bug localizationA preliminary study on using code smells to improve bug localization
A preliminary study on using code smells to improve bug localizationkrws
38 views24 slides
Iterative code reviews system for detecting and correcting faults from softwa... by
Iterative code reviews system for detecting and correcting faults from softwa...Iterative code reviews system for detecting and correcting faults from softwa...
Iterative code reviews system for detecting and correcting faults from softwa...IAEME Publication
210 views7 slides
Multi step automated refactoring for code smell by
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smelleSAT Journals
185 views5 slides
Multi step automated refactoring for code smell by
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smelleSAT Publishing House
370 views5 slides
A Tale of Experiments on Bug Prediction by
A Tale of Experiments on Bug PredictionA Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug PredictionMartin Pinzger
757 views45 slides
Static Slicing Technique with Algorithmic Approach by
Static Slicing Technique with Algorithmic ApproachStatic Slicing Technique with Algorithmic Approach
Static Slicing Technique with Algorithmic ApproachIOSR Journals
323 views4 slides

Similar to LSRepair: Live Search of Fix Ingredients for Automated Program Repair(20)

A preliminary study on using code smells to improve bug localization by krws
A preliminary study on using code smells to improve bug localizationA preliminary study on using code smells to improve bug localization
A preliminary study on using code smells to improve bug localization
krws38 views
Iterative code reviews system for detecting and correcting faults from softwa... by IAEME Publication
Iterative code reviews system for detecting and correcting faults from softwa...Iterative code reviews system for detecting and correcting faults from softwa...
Iterative code reviews system for detecting and correcting faults from softwa...
IAEME Publication210 views
Multi step automated refactoring for code smell by eSAT Journals
Multi step automated refactoring for code smellMulti step automated refactoring for code smell
Multi step automated refactoring for code smell
eSAT Journals185 views
A Tale of Experiments on Bug Prediction by Martin Pinzger
A Tale of Experiments on Bug PredictionA Tale of Experiments on Bug Prediction
A Tale of Experiments on Bug Prediction
Martin Pinzger757 views
Static Slicing Technique with Algorithmic Approach by IOSR Journals
Static Slicing Technique with Algorithmic ApproachStatic Slicing Technique with Algorithmic Approach
Static Slicing Technique with Algorithmic Approach
IOSR Journals323 views
A Literature Review on Plagiarism Detection in Computer Programming Assignments by IRJET Journal
A Literature Review on Plagiarism Detection in Computer Programming AssignmentsA Literature Review on Plagiarism Detection in Computer Programming Assignments
A Literature Review on Plagiarism Detection in Computer Programming Assignments
IRJET Journal9 views
Course Breakup Plan- C by swatisinghal
Course Breakup Plan- CCourse Breakup Plan- C
Course Breakup Plan- C
swatisinghal793 views
A tale of experiments on bug prediction by Martin Pinzger
A tale of experiments on bug predictionA tale of experiments on bug prediction
A tale of experiments on bug prediction
Martin Pinzger819 views
Method-Level Code Clone Modification using Refactoring Techniques for Clone M... by acijjournal
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
acijjournal1.2K views
SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY by IJDKP
SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITYSOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY
SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY
IJDKP1.5K views
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow... by Yuki Ueda
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
Yuki Ueda68 views
A NOVEL APPROACH TO ERROR DETECTION AND CORRECTION OF C PROGRAMS USING MACHIN... by IJCI JOURNAL
A NOVEL APPROACH TO ERROR DETECTION AND CORRECTION OF C PROGRAMS USING MACHIN...A NOVEL APPROACH TO ERROR DETECTION AND CORRECTION OF C PROGRAMS USING MACHIN...
A NOVEL APPROACH TO ERROR DETECTION AND CORRECTION OF C PROGRAMS USING MACHIN...
IJCI JOURNAL86 views
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations by Dongsun Kim
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis ViolationsAVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
Dongsun Kim468 views
techniques for removing smallest Stopping sets in LDPC codes by Shankar Lal
techniques for removing smallest Stopping sets in LDPC codestechniques for removing smallest Stopping sets in LDPC codes
techniques for removing smallest Stopping sets in LDPC codes
Shankar Lal316 views
Algorithm Identification In Programming Assignments by Karin Faust
Algorithm Identification In Programming AssignmentsAlgorithm Identification In Programming Assignments
Algorithm Identification In Programming Assignments
Karin Faust6 views

Recently uploaded

Ransomware is Knocking your Door_Final.pdf by
Ransomware is Knocking your Door_Final.pdfRansomware is Knocking your Door_Final.pdf
Ransomware is Knocking your Door_Final.pdfSecurity Bootcamp
55 views46 slides
Mini-Track: Challenges to Network Automation Adoption by
Mini-Track: Challenges to Network Automation AdoptionMini-Track: Challenges to Network Automation Adoption
Mini-Track: Challenges to Network Automation AdoptionNetwork Automation Forum
12 views27 slides
Five Things You SHOULD Know About Postman by
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About PostmanPostman
33 views43 slides
Scaling Knowledge Graph Architectures with AI by
Scaling Knowledge Graph Architectures with AIScaling Knowledge Graph Architectures with AI
Scaling Knowledge Graph Architectures with AIEnterprise Knowledge
30 views15 slides
The details of description: Techniques, tips, and tangents on alternative tex... by
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...BookNet Canada
127 views24 slides

Recently uploaded(20)

Five Things You SHOULD Know About Postman by Postman
Five Things You SHOULD Know About PostmanFive Things You SHOULD Know About Postman
Five Things You SHOULD Know About Postman
Postman33 views
The details of description: Techniques, tips, and tangents on alternative tex... by BookNet Canada
The details of description: Techniques, tips, and tangents on alternative tex...The details of description: Techniques, tips, and tangents on alternative tex...
The details of description: Techniques, tips, and tangents on alternative tex...
BookNet Canada127 views
Business Analyst Series 2023 - Week 3 Session 5 by DianaGray10
Business Analyst Series 2023 -  Week 3 Session 5Business Analyst Series 2023 -  Week 3 Session 5
Business Analyst Series 2023 - Week 3 Session 5
DianaGray10248 views
STPI OctaNE CoE Brochure.pdf by madhurjyapb
STPI OctaNE CoE Brochure.pdfSTPI OctaNE CoE Brochure.pdf
STPI OctaNE CoE Brochure.pdf
madhurjyapb14 views
Serverless computing with Google Cloud (2023-24) by wesley chun
Serverless computing with Google Cloud (2023-24)Serverless computing with Google Cloud (2023-24)
Serverless computing with Google Cloud (2023-24)
wesley chun11 views
Case Study Copenhagen Energy and Business Central.pdf by Aitana
Case Study Copenhagen Energy and Business Central.pdfCase Study Copenhagen Energy and Business Central.pdf
Case Study Copenhagen Energy and Business Central.pdf
Aitana16 views
SAP Automation Using Bar Code and FIORI.pdf by Virendra Rai, PMP
SAP Automation Using Bar Code and FIORI.pdfSAP Automation Using Bar Code and FIORI.pdf
SAP Automation Using Bar Code and FIORI.pdf
Special_edition_innovator_2023.pdf by WillDavies22
Special_edition_innovator_2023.pdfSpecial_edition_innovator_2023.pdf
Special_edition_innovator_2023.pdf
WillDavies2217 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...

LSRepair: Live Search of Fix Ingredients for Automated Program Repair

  • 1. LSRepair: Live Search of Fix Ingredients for Automated Program Repair Kui Liu, Anil Koyuncu, Kisub Kim, Dongsun Kim, and Tegawendé F. Bissyandé SnT, University of Luxembourg, Luxembourg @ Nara Japan, 25th APSEC 2018December 7, 2018
  • 2. 1 > Basic Process of Automated Program Repair (APR) Fault Localization Test Pass Fail Patch Candidate APR Tools Suspicious buggy code Where is the code to be fixed? How to generate patches? Is the patch correct? passing tests Passing tests Failing tests State-of-the-art APR tools for Java bugs: jGenProg [9], jKali [9], jMutRepair [9], HDRepair [10], Nopol [28], ACS [29], ssFix [54], ELIXIR [55], SketchFix [56], CapGen [13], and SimFix1. 1. Jiang, Jiajun, et al. "Shaping Program Repair Space with Existing Patches and Similar Code." ISSTA 2018. Plausible Patch
  • 3. 2 > Statement Level Bug Fixing Class name Line No. Suspiciousness …..….. Suspicious statements of bug Chart-1 in Defects4J reported by GZoltar 0.1.1. …..….. Bug Chart_1 in Defects4J fixed by jMutRepair, ELIXIR, ssFix, JAID, SketchFix, CapGen, SimFix. org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
  • 4. 3 > Search Space Issues P P P P P P P P P P PP P P P P P PP P P P P P P P P P P P PP P P P P P Incorrect patch. P Correct patch. P Plausible but incorrect patch. P P (1) The search space could be too small to include correct patches. (2) The search space could be too big to include more plausible but incorrect patches. P P Search space: a set of patches generated by APR tools.
  • 5. 4 > Suspicious but non-buggy statements in one method
  • 6. 5 > Question Could we fix bugs at method declaration level to reduce the search space of fix ingredients for incorrect patches and purify the search space for correct patches?
  • 7. 6 > Intuition Developers write code or clone code to address similar tasks. program1 program2 program3 DesignsDeveloping Routine Our intuition is that while some code may be buggy, the similar code may have been fixed.
  • 8. 7 > LSRepair Approach Live Search of fix ingredients in real-world code bases to repair bugs automatically. Overview of LSRepair Suspicious methods Fault localization Search similar methods Generate and Validate patches
  • 10. 9 > Fault Localization passing tests Passing tests Failing tests Gzoltar 0.1.1 Suspicious statement list Suspicious method list … ... … ... … ... …..….. Bug Chart_1 in Defects4J. org/jfree/chart/renderer/category/AbstractCategoryItemRenderer.java
  • 11. 10 > Search Strategies for Similar Methods …….. ... Suspicious method Search similar methods S1. Signature-similar methods. S2. Syntactically similar methods. S3. Semantically similar methods. Method Signature (MS): MS = (rt, mn, Args), rt: return type. mn: method name. Args: a set of parameter types. Method code  search syntactic-similar methods with deep learning technique in our previous study [52] (TSE’18). Method code  search semantic-similar methods with FaCoY [50] (ICSE’18).
  • 12. 11 > Patch Generation 1. Signature-similar methods. Replacing the buggy method with signature-similar methods directly.
  • 13. 12 > Patch Generation 1. Signature-similar methods. Replacing the buggy method with signature-similar methods directly. 2. Syntactically similar methods. 3. Semantically similar methods. Pivot statements (buggy code and patch candidate): IfStatement, ExpressionStatement, VariableDeclaration, and ReturnStatement [53]. if (dataset != null) { …… } if (element == null) { …… } IfStatement: Modify its conditional expression by checking their differences on non-variable code. Others: 1) Insert an IfStatement. 2) Delete the IfStatement. 3) Modify the IfStatement. Buggy Code Code in similar methods if (dataset == null) { …… } Patch Code Type var = var2.get(); Buggy code if (var_ != null) { Type var = var_.get(); } Code in similar methods Type var = var2.get(); Buggy code if (var_ != null) { Type var = var_.get(); } Code in similar methods if (var2 == null) { Type var = var2.get(); } Buggy code if (var_ == null) { Type var = var_.get(); } Code in similar methods
  • 15. 14 > Real World Code Bases 10,449 GitHub Java projects used in FaCoy (11,043,044 methods). Search space of similar methods: • Signature-similar methods: all similar methods in our data set. • Syntactically similar methods: top-10 most similar methods. • Semantically similar methods: top-10 most similar methods.
  • 16. 15 > RQ: to what extent real-world bugs can be fixed by LSRepair? Project # Bugs kLoC # Tests Chart 26 96 2,205 Closure 133 90 7,927 Lang 65 22 2,245 Math 106 85 3,602 Mockito 38 11 1,457 Time 27 28 4,130 Total 395 332 22,954 Defects4J [57] Dataset Information.
  • 17. 16 > Bugs correctly fixed by LSRepair Bugs in Defects4J are correctly fixed by LSRepair. S1. Signature-similar methods. S2. Syntactically similar methods. S3. Semantically similar methods.
  • 18. 17 > Quantitative Comparison with State-of-the-art APR Tools APR Tool # plausibly fixed bugs # correctly fixed bugs LSRepair 38 19 jGenProg [9] 29 5 HDRepair [10] 16 13 Nopol [28] 35 5 ACS [29] 21 18 ssFix [54] 60 20 ELIXIR [55] 41 26 SketchFix [56] 26 19 CapGen [13] 25 21 Chart-4, Lang-29,46,48, 52, 54. Math-91, 94. Mockito-13. Bugs are firstly and correctly fixed by LSRepair. LSRepair can be complementary to the state-of-the-art automated program repair techniques.
  • 19. 18 > Limitation and Discussion 3. Method level granularity. It cannot fix the bugs located in TypeDeclaration or FieldDeclaration. 2. Code Transformation. Our prototype uses straightforward heuristics to transform the ingredients. 1. Syntactically or Semantically Similar Code Search Problem. We use naive heuristics to prioritize code, based on the cosine similarity (e.g., syntactic and semantic) with a given buggy code.
  • 20. 19 > Summary 13 > Bugs correctly fixed by LSRepair Bugs in Defects4J are correctly fixed by LSRepair. 10 > Search Strategies …….. ... Suspicious method Search similar methods 1. Signature-similar methods. 2. Syntactically similar methods. 3. Semantically similar methods. 5 > Motivation Developers write code to address similar tasks, or clone code. program1 program2 program3 DesignsDeveloping Routine Our intuition is that while some code may be buggy, the similar code may have been fixed . 6 > LSRepair Approach Live Search of fix ingredients in real-world code bases to repair bugs automatically. Fault Localization to identify faulty methods Generate patches By code transform Validate and check correctness Selection of code search strategy Program https://github.com/AutoProRepair/LSRepair

Editor's Notes

  1. In order to reduce the manual debugging effort, various automated program repair tools have been proposed. Now, let’s take a look at the basic process of Automated program repair. Given a buggy program with its passing and failing tests, fault localization techniques are used to locate the suspicious buggy code positions. Automated program tools are designed to mutate the suspicious code to generate patch candidates. Only the patch candidate that can pass all tests is considered as a plausible patch of the buggy program. For Java program bugs, the state-of-the-art APR tools are designed in this way. This kind of bug fixing focuses on the statement level.
  2. For example, given the bug Chart-1 in Defects4J, the fault localization tool, Gzoltar, reports the suspicious code in this way. The column means the suspicious buggy class names, the second line is the suspicious code line number in the suspicious buggy file. The last column denotes the suspiciousness value of the current code line, which is calculated with the tests running traces. Therefore, APR tools are going to mutate these suspicious statements one by one, until a plausible patch is generated, or time out. The exact the bug position of Chart-1 is Line 1797 in file …. Thus, APR tools need to try all the suspicious code positions before this one.
  3. In this way to fix bugs, there are two critical issues which must be considered. We assume that, there is a patch universe which contains many incorrect patches, some plausible but incorrect patches, and a few correct patches. If APR tools limit the search space size, it might be too small to include correct patches. If APR tools enlarge the search space, it could enlarge the possibility of including correct patches, but it also enlarge the possibility of including more plausible patches. How to resolve or relieve these two issues is important to search based automated program repair.
  4. Considering several statements in one method could be reported as suspicious statements, thus, could we ….
  5. Considering several statements in one method could be reported as suspicious statements, thus, could we ….
  6. As we known, many programs have the same or similar developing routine, data structure and designs. Thus, developers always write code and clone code to address similar tasks. Our intuition is that ….
  7. With our intuition, we propose to repair bugs with live search of fix ingredients in real-world code bases. The overflow of LSRepair is, given a buggy program ……
  8. Now, let’s take a look at the LSRepair design.