Font Size: a A A

Research On Code Similarity Detection And Code Consistency Maintenance

Posted on:2018-04-19Degree:DoctorType:Dissertation
Country:ChinaCandidate:X ChengFull Text:PDF
GTID:1368330590455269Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
Due to the practice of copy-and-paste a code fragment with or without any modification in software development and maintenance,software systems commonly contain many similar code fragments.In literature,these similar code fragments are called code clones.Code clones are beneficial to the efficiency of the development,however,they bring a great challenge into the software maintenance.When one of the code fragment in the clones is changed,the consistency of the clones is violated,which may introduce clone-related bugs into the software systems.Code clone detection can help developers to discover the similar code fragments in software systems,and code consistency maintenance can help maintainer to manage these similar code fragments to avoid clone related bugs.Code clone detection techniques are grouped into single-language clone detection and cross-language clone detection according to the programming language of the code clones.Existing code clone detection techniques mainly focus on single-language clone detection.There exist great challenges in cross-language clone detection.Different programming languages are different in grammars and APIs.Even if the code fragments in different programming language implements the same functionality,their code structure can be different.So far,the crosslanguage clone detecting technique can only support crossing.NET language family since they share the same intermediate.However,other different programming languages almost have no common intermediate representation for comparing the code fragments and determining clones.Therefore,this thesis introduces a revision-history based approach to detecting cross-language clones without intermediate.In addition,this thesis further utilizes the approach to investigate the code similarity between the mobile applications across different platforms.The maintenance of the consistency of the similar code is another important technique to avoid clone-related bugs.In code clones,when a change occurs in a code fragment,other similar code fragments are likely to need the same or similar change to keep the consistency.So far,researches on the maintenance of the similar code consistency lag behind detection.Existing technique on the maintenance of the consistency of the single-language clones only target at the code clones which have small difference in structure,but it can not meet the requirement of maintaining consistency of the code clones which are quite different in structure.Therefore,an rule-directed approach is proposed to maintain the consistency of those ones with big difference.In addition,a bidirectional transformation based approach is proposed to maintain the consistency of the code before and after refactoring which are also with big difference.This paper make the following main contributions:· The thesis proposes the first approach,CLCMiner,to detecting cross-language clones intermediate.This approach mines cross-language clones from the revision histories and reduces the cross-language clone detection into a diff matching problem.· This thesis investigates the similarity of the same application,which is implemented in different programming languages,on different platforms and exams the feasibility of detecting cross-platform code clones via identifier similarity.· This thesis describes a rule-based approach,CCSync,to synchronizing code clones.This approach paves the difference between the code structures of clones,extracts the syn-chronization rules from the relationship between clones.When a code fragment in the clone pair is updated,it propagate the update to the other code fragment in the same clone pair.· This thesis introduces a bidirectional transformation based approach to synchronizing code before and after refactoring and utilizes this approach to support selective undo for refactoring.We implemented this approach on a recent refactoring to evaluate its effectiveness.The prototypes for the above approaches are developed to conduct the experiments and the experimental results verified the effectiveness of our approaches.
Keywords/Search Tags:code clone, cross-language, similarity, consistency, synchronization
PDF Full Text Request
Related items