SlideShare a Scribd company logo
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

More Related Content

PPTX
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
PPTX
A Closer Look at Real-World Patches
PPTX
TBar: Revisiting Template-based Automated Program Repair
PDF
Mining Fix Patterns for FindBugs Violations
PDF
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
PPTX
iFixR: Bug Report Driven Program Repair
PDF
Impact of Tool Support in Patch Construction
PDF
Learning to Spot and Refactor Inconsistent Method Names
You Cannot Fix What You Cannot Find! --- An Investigation of Fault Localizati...
A Closer Look at Real-World Patches
TBar: Revisiting Template-based Automated Program Repair
Mining Fix Patterns for FindBugs Violations
Bench4BL: Reproducibility Study on the Performance of IR-Based Bug Localization
iFixR: Bug Report Driven Program Repair
Impact of Tool Support in Patch Construction
Learning to Spot and Refactor Inconsistent Method Names

What's hot (20)

PPTX
Automated Program Repair Keynote talk
PPTX
Isorc18 keynote
PPTX
Repair dagstuhl jan2017
PPTX
Symbexecsearch
PPTX
Automated Repair - ISSTA Summer School
PPTX
Mobilesoft 2017 Keynote
PPT
Code Analysis-run time error prediction
PPTX
Abhik-Satish-dagstuhl
PPTX
STAR: Stack Trace based Automatic Crash Reproduction
PPT
Crowd debugging (FSE 2015)
DOCX
Test final jav_aaa
PPTX
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
PDF
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs
PPTX
APSEC2020 Keynote
PPTX
Griffin: Grouping Suspicious Memory-Access Patterns to Improve Understanding...
PDF
Effective Fault-Localization Techniques for Concurrent Software
PPTX
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
PPTX
Static analysis works for mission-critical systems, why not yours?
PPTX
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
PPTX
Deep API Learning (FSE 2016)
Automated Program Repair Keynote talk
Isorc18 keynote
Repair dagstuhl jan2017
Symbexecsearch
Automated Repair - ISSTA Summer School
Mobilesoft 2017 Keynote
Code Analysis-run time error prediction
Abhik-Satish-dagstuhl
STAR: Stack Trace based Automatic Crash Reproduction
Crowd debugging (FSE 2015)
Test final jav_aaa
CrashLocator: Locating Crashing Faults Based on Crash Stacks (ISSTA 2014)
SherLog: Error Diagnosis by Connecting Clues from Run-time Logs
APSEC2020 Keynote
Griffin: Grouping Suspicious Memory-Access Patterns to Improve Understanding...
Effective Fault-Localization Techniques for Concurrent Software
REMI: Defect Prediction for Efficient API Testing (

ESEC/FSE 2015, Industria...
Static analysis works for mission-critical systems, why not yours?
Automatically Generated Patches as Debugging Aids: A Human Study (FSE 2014)
Deep API Learning (FSE 2016)
Ad

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

PDF
A preliminary study on using code smells to improve bug localization
PDF
Iterative code reviews system for detecting and correcting faults from softwa...
PDF
Multi step automated refactoring for code smell
PDF
Multi step automated refactoring for code smell
PDF
A Tale of Experiments on Bug Prediction
PDF
Static Slicing Technique with Algorithmic Approach
PDF
A Literature Review on Plagiarism Detection in Computer Programming Assignments
DOC
Course Breakup Plan- C
PDF
Introduction to algorithms
PDF
A survey of fault prediction using machine learning algorithms
PDF
A tale of experiments on bug prediction
PDF
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
PDF
SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY
PPTX
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
PDF
A NOVEL APPROACH TO ERROR DETECTION AND CORRECTION OF C PROGRAMS USING MACHIN...
PPTX
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
PPTX
Semantic-Aware Code Model: Elevating the Future of Software Development
PDF
FSE-Journal-First-Automated code editing with search-generate-modify.pdf
PDF
Debug me
PDF
A systematic analysis on machine learning classifiers with data pre-processin...
A preliminary study on using code smells to improve bug localization
Iterative code reviews system for detecting and correcting faults from softwa...
Multi step automated refactoring for code smell
Multi step automated refactoring for code smell
A Tale of Experiments on Bug Prediction
Static Slicing Technique with Algorithmic Approach
A Literature Review on Plagiarism Detection in Computer Programming Assignments
Course Breakup Plan- C
Introduction to algorithms
A survey of fault prediction using machine learning algorithms
A tale of experiments on bug prediction
Method-Level Code Clone Modification using Refactoring Techniques for Clone M...
SOURCE CODE RETRIEVAL USING SEQUENCE BASED SIMILARITY
Automatically Customizing Static Analysis Tools to Coding Rules Really Follow...
A NOVEL APPROACH TO ERROR DETECTION AND CORRECTION OF C PROGRAMS USING MACHIN...
AVATAR : Fixing Semantic Bugs with Fix Patterns of Static Analysis Violations
Semantic-Aware Code Model: Elevating the Future of Software Development
FSE-Journal-First-Automated code editing with search-generate-modify.pdf
Debug me
A systematic analysis on machine learning classifiers with data pre-processin...
Ad

Recently uploaded (20)

PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
Cloud computing and distributed systems.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
cuic standard and advanced reporting.pdf
PDF
KodekX | Application Modernization Development
PPTX
Big Data Technologies - Introduction.pptx
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
A Presentation on Artificial Intelligence
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
DOCX
The AUB Centre for AI in Media Proposal.docx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Cloud computing and distributed systems.
Per capita expenditure prediction using model stacking based on satellite ima...
cuic standard and advanced reporting.pdf
KodekX | Application Modernization Development
Big Data Technologies - Introduction.pptx
Review of recent advances in non-invasive hemoglobin estimation
A Presentation on Artificial Intelligence
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
NewMind AI Monthly Chronicles - July 2025
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
The AUB Centre for AI in Media Proposal.docx

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

  • #3: 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.
  • #4: 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.
  • #5: 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.
  • #6: Considering several statements in one method could be reported as suspicious statements, thus, could we ….
  • #7: Considering several statements in one method could be reported as suspicious statements, thus, could we ….
  • #8: 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 ….
  • #9: 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 ……
  • #10: Now, let’s take a look at the LSRepair design.