Font Size: a A A

Design And Implementation Of Clone Code Detecting Tool Based On Static Detecting

Posted on:2020-07-02Degree:MasterType:Thesis
Country:ChinaCandidate:C Y XuFull Text:PDF
GTID:2428330596475125Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
With the advent of mobile Internet era,various types of software applications have penetrated into various fields of society.As important ways to improve software development efficiency,techniques like code reuse,design patterns theory,software development framework,and integrated open-source component have played a more and more important role in the process of software development.While improving the software development efficiency,such techniques also inevitably introduce more and more clone code in the software system.Therefore,how to effectively detect the clone code is becoming more and more important in software engineering.The detection and management of clone code in software system is not only related to the maintenance and upgrade of software system,but also more and more related to software security,intellectual property protection and other issues.Based on the above background,this thesis proposes and implements a clone code detecting tool based on static detecting.The proposed tool takes function or class as the basic unit of clone detection,and uses the TXL programming language to implement the extraction of function or class as well as the normalization of source code.What's more,this thesis implements clone code detection with a double-granularity detecting mechanism,which consists of coarse-grained detection and fine-grained detection.Thus the proposed tool can achieve effective detection of Type1,Type2,Type3 and Type4 clone code in C,C++,Java,Python,PHP source code,at the same time ensure the efficiency of detection.The work done in this thesis is divided into the following parts:1.Designs and implements the source code function extraction module and source code normalization module.Based on the syntax of different programming languages,this thesis uses TXL to write the corresponding source code function extraction rules and source code normalization rules,then constructs source code function extraction module and source code normalization module.The source code function extraction module and source code normalization module support function extraction and code normalization of C,C++,Java,Python and PHP.The proposed tool supports more programming language than NiCad and Sim Cad.2.Implements the detection of class-level clone code in Java source code.In objectoriented programming,class is the template of the object and the abstract of the nature of things.Therefore,the detection of class-level clone code is of great significance to further explore the clone behavior in the source code.This thesis takes Java language as an example to explore the detction of class-level clone code in object-oriented programming language,uses TXL to achieve the extraction of Java classes in source code,and further implements the detection of clone code of class-level.The test results show that the proposed tool can realize the effective detection of class-level clone code in Java program.3.Designs and implements the coarse-grained clone detection mechanism and finegrained clone detection mechanism.After fully studying the function structure,this thesis proposes the concept of function-body quantization feature,and designs the coarse-grained clone detection mechanism based on the function-body quantization feature.At the same time,based on the LCS algorithm,this thesis realizes the finegrained clone detection mechanism.The test results show that the double-granularity clone detecting mechanism can realize the effective detection of Type1-3 clone code,and perform better than Ni Cad and Sim Cad in detecting Type4 clone,meanwhile,double-granularity clone detecting mechanism has a higher detecting efficiency than NiCad and Sim Cad.4.Tests the proposed clone code detecting tool.Firstly,this thesis tests the source code function extraction module,source code normalization module,coarse-grained clone detection module and fine-grained clonal detection module respectively,and verifies that the above modules can effectively process the source code of various languages.Then the whole tool is tested to verify that the tool can achieve efficient detection of various types of clone code.At the same time,the proposed tool is compared with other mainstream source code clone detection tool to prove the tool's improvement in performance.Finally,this thesis tests the ability of the proposed tool on detecting class-level clone code in Java program.
Keywords/Search Tags:clone code, clone detection, TXL, function-body quantization feature, LCS algorithm
PDF Full Text Request
Related items