Font Size: a A A

Functionally Equivalent Research On The Automatic Detection Of Cloned Code

Posted on:2018-04-13Degree:MasterType:Thesis
Country:ChinaCandidate:F GaoFull Text:PDF
GTID:2358330515980709Subject:Computer application technology
Abstract/Summary:PDF Full Text Request
With the increasing scale of the software system,in order to save development costs,shorten the development cycle,programmers often copy and paste the code.The use of cloning code in the development process has indeed gained some benefits,but the harm caused by it can not be ignored,such as the transmission of the bug,increase the complexity of the program and so on.Therefore,the detection of cloning code is particularly necessary,on the one hand can locate the cloning code in order to facilitate the analysis of possible implied bug,on the other hand can also lay the foundation for the reconstruction of the code.Functionally equivalent cloning code belongs to the fourth type of cloning code,which,unlike the other three,the functionally equivalent cloning code has very low similarity in text,or even completely different.In this paper,we proposed IOM-Behavior algorithm to detect the method-level functionally equivalent cloning code.The algorithm first uses the reflection mechanism to obtain class methods from source code.The,use the number and type of method parameters and return type as the first filter,the methods with the same input and output are divided into a class,in order to find out the preliminary candidate cloning group,in this process,the method will be divided into four types,and the corresponding plans are proposed for different types of methods;then,the metrics of the method in the candidate clone group are calculated and used as the secondary filter,we take the similarity ratio no less than50% rather than exactly the same as the criteria for judging the equivalent of the method,thus get the final candidate clone group.Finally,the test set is constructed by stratified random sampling,and the random test of input and output is carried out to obtain the clone method group of functionally equivalent.In addition,this paper uses the Java language to implement the IOM-Behavior algorithm for detecting the method-level functionally equivalent cloning code.Using the algorithm program,combined with the manual construction of the test set to test the actual project in the Java source,and the experimental results show that the algorithm program’s correct rate of detecting the method-level functionally equivalent cloning code is not less than 66%,which proved that the proposed algorithm is reasonable,effective,a kind of new insights to detect the functionally equivalent cloning code,also provide a reference for practical applications analysis and solve theproblems caused by cloning code and other issues.
Keywords/Search Tags:code clone, functionally equivalent, code metric, reflection mechanism, random testing
PDF Full Text Request
Related items