Automatic Repair of Semantic Defects Using Restraint Mechanisms

Recently, software, especially CPS and Internet of Things (IoT), increasingly have high requirements for quality, while program defects exist inevitably duo to the high complexity. Program defect repair faces serious challenges in that such repairs require considerable manpower, and the existing aut...

Full description

Bibliographic Details
Main Authors: Yukun Dong, Li Zhang, Shanchen Pang, Wenjing Yin, Mengying Wu, Meng Wu, Haojie Li
Format: Article
Language:English
Published: MDPI AG 2020-09-01
Series:Symmetry
Subjects:
Online Access:https://www.mdpi.com/2073-8994/12/9/1563
_version_ 1797553046933209088
author Yukun Dong
Li Zhang
Shanchen Pang
Wenjing Yin
Mengying Wu
Meng Wu
Haojie Li
author_facet Yukun Dong
Li Zhang
Shanchen Pang
Wenjing Yin
Mengying Wu
Meng Wu
Haojie Li
author_sort Yukun Dong
collection DOAJ
description Recently, software, especially CPS and Internet of Things (IoT), increasingly have high requirements for quality, while program defects exist inevitably duo to the high complexity. Program defect repair faces serious challenges in that such repairs require considerable manpower, and the existing automatic repair approaches have difficulty generating correct patches efficiently. This paper proposes an automatic method for repairing semantic defects in Java programs based on restricted sets which refer to the interval domains of related variables that can trigger program semantic defects. Our work introduces a repair mechanism symmetrically combining defect patterns and repair templates. First, the program semantic defects are summarized into defect patterns according to their grammar and semantic features. A repair template for each type of defect pattern is predefined based on a restricted-set. Then, for each specific defect, a patch statement is automatically synthesized according to the repair template, and the detected defect information is reported by the static detection tool (DTSJava). Next, the patch location is determined by the def-use chain of defect-related variables. Finally, we evaluate the patches generated by our method using DTSJava. We implemented the method in the defect automatic repair prototype tool DTSFix to verify the effect of repairing the semantic defects detected by DTSJava in 6 Java open-source projects. The experimental results showed that 109 of 129 program semantic defects were repaired.
first_indexed 2024-03-10T16:09:50Z
format Article
id doaj.art-968d10a2020042d6b9210acd5fbd25cb
institution Directory Open Access Journal
issn 2073-8994
language English
last_indexed 2024-03-10T16:09:50Z
publishDate 2020-09-01
publisher MDPI AG
record_format Article
series Symmetry
spelling doaj.art-968d10a2020042d6b9210acd5fbd25cb2023-11-20T14:34:49ZengMDPI AGSymmetry2073-89942020-09-01129156310.3390/sym12091563Automatic Repair of Semantic Defects Using Restraint MechanismsYukun Dong0Li Zhang1Shanchen Pang2Wenjing Yin3Mengying Wu4Meng Wu5Haojie Li6College of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaCollege of Computer Science and Technology, China University of Petroleum, Qingdao, 266580, ChinaRecently, software, especially CPS and Internet of Things (IoT), increasingly have high requirements for quality, while program defects exist inevitably duo to the high complexity. Program defect repair faces serious challenges in that such repairs require considerable manpower, and the existing automatic repair approaches have difficulty generating correct patches efficiently. This paper proposes an automatic method for repairing semantic defects in Java programs based on restricted sets which refer to the interval domains of related variables that can trigger program semantic defects. Our work introduces a repair mechanism symmetrically combining defect patterns and repair templates. First, the program semantic defects are summarized into defect patterns according to their grammar and semantic features. A repair template for each type of defect pattern is predefined based on a restricted-set. Then, for each specific defect, a patch statement is automatically synthesized according to the repair template, and the detected defect information is reported by the static detection tool (DTSJava). Next, the patch location is determined by the def-use chain of defect-related variables. Finally, we evaluate the patches generated by our method using DTSJava. We implemented the method in the defect automatic repair prototype tool DTSFix to verify the effect of repairing the semantic defects detected by DTSJava in 6 Java open-source projects. The experimental results showed that 109 of 129 program semantic defects were repaired.https://www.mdpi.com/2073-8994/12/9/1563automatic program repairprogram semantic defectdefect patternrestricted-setpatch synthesis
spellingShingle Yukun Dong
Li Zhang
Shanchen Pang
Wenjing Yin
Mengying Wu
Meng Wu
Haojie Li
Automatic Repair of Semantic Defects Using Restraint Mechanisms
Symmetry
automatic program repair
program semantic defect
defect pattern
restricted-set
patch synthesis
title Automatic Repair of Semantic Defects Using Restraint Mechanisms
title_full Automatic Repair of Semantic Defects Using Restraint Mechanisms
title_fullStr Automatic Repair of Semantic Defects Using Restraint Mechanisms
title_full_unstemmed Automatic Repair of Semantic Defects Using Restraint Mechanisms
title_short Automatic Repair of Semantic Defects Using Restraint Mechanisms
title_sort automatic repair of semantic defects using restraint mechanisms
topic automatic program repair
program semantic defect
defect pattern
restricted-set
patch synthesis
url https://www.mdpi.com/2073-8994/12/9/1563
work_keys_str_mv AT yukundong automaticrepairofsemanticdefectsusingrestraintmechanisms
AT lizhang automaticrepairofsemanticdefectsusingrestraintmechanisms
AT shanchenpang automaticrepairofsemanticdefectsusingrestraintmechanisms
AT wenjingyin automaticrepairofsemanticdefectsusingrestraintmechanisms
AT mengyingwu automaticrepairofsemanticdefectsusingrestraintmechanisms
AT mengwu automaticrepairofsemanticdefectsusingrestraintmechanisms
AT haojieli automaticrepairofsemanticdefectsusingrestraintmechanisms