| In the software development process,program defects are inevitable.However,manually repairing these defects by developers can be time-consuming and inefficient,which can impede the growth of the software industry.The usefulness of code similarity metrics in program repair technology is well-established,as they provide valuable guidance towards effective repairs.Thus,developing automatic program repair technology based on similarity metrics is crucial for improving repair efficiency and universality.The patch generation and verification aspects of automatic program repair have been extensively studied by researchers globally.However,some issues still require attention in this area.(1)Firstly,the applicability and repair preferences of automatic repair technology based on similarity metrics remain unclear,limitingq the full utilization of automatic repair technology.(2)Secondly,current automatic fixing methods mainly rely on a test-suite-based patch verification approach,which is expensive and time-consuming to verify candidate patches through running the test suite.To overcome these limitations,this thesis conducts research aimed at addressing the aforementioned shortcomings.(1)This thesis delves into the applicability and repair preferences of program automatic repair technology based on similarity metrics across various types of defects,with a focus on defect complexity and type.By leveraging defect complexity data and classification of defect types,the study investigates whether automatic repair techniques based on similarity metrics exhibit diverse repair preferences for different defect complexities and types,and whether they are impacted by similarity metrics methods.Findings reveal that automatic repair technology based on similarity metrics exhibits significantly lower complexity than the average overall defect complexity in the Defects4J dataset.Regarding defect types,the technology exhibits a pronounced preference for repairing return statement type defects,while repair tendencies for abnormal statement defects are relatively low.Moreover,variations in applicability and repair preferences are evident among different types of automatic repair technologies.(2)This thesis proposes a patch verification method based on deep learning and similarity metrics,which solves the patch verification problem without using a test suite.The method sorts and filters candidate patches by their textual similarity with the original faulty code fragment,then extracts multi-dimensional code features using a representation model based on code abstract syntax trees.Finally,these features are used to derive predictions of the correctness of the candidate patches.The proposed method shows significant improvement in F1 values over other related patch verification techniques in experiments that use a collection of patches generated by 18 automatic repair tools.The effectiveness and scalability of the method are assessed from multiple perspectives including embedding models,classifiers,and similarity metrics.(3)Based on the aforementioned research,DL&Sim,an automatic repair aid that utilizes deep learning and similarity metrics techniques,was designed and implemented.With DL&Sim,users can choose from a variety of automatic repair techniques to generate patches tailored to specific defect types.Additionally,the system ranks and predicts the accuracy of candidate patches generated.This thesis has 59 figures,9 tables and 121 references. |