Font Size: a A A

Research On Enhancing Code Structure Information For API Call Patterns

Posted on:2024-03-06Degree:MasterType:Thesis
Country:ChinaCandidate:Y X ZhuFull Text:PDF
GTID:2568307112476404Subject:Computer Science and Technology
Abstract/Summary:PDF Full Text Request
In modern software development processes,Application Programming Interfaces(APIs)are widely used.By calling APIs,developers are able to quickly build projects and save a lot of development time.However,with the continuous development of internet technology and the increasing demand for software,the scale of software is constantly expanding,and developers are increasingly dependent on the use of APIs in software development.However,the vast number of APIs and the lack of complete reference documentation present significant challenges for developers when using APIs.Despite the fact that many researchers currently use various clustering algorithms to mine API calling patterns from open-source projects,these API calling patterns still suffer from problems such as a lack of structural information and high redundancy in results,which reduces the practicality of mining results and hinders their usefulness for developers as reference.This dissertation presents a method for enhancing the code structure information of API call patterns.The method focuses on Java open source project source code with frequent API method calls on Git Hub,as well as API mining tools such as PAM to extract API call patterns from these source codes.In order to obtain the relevant structural information of these API call patterns in the source code,this dissertation uses the Extended Branch-Reserving Call Graph(EBRCG)to represent the structural information of Java class methods.In EBRCG,API call statements,branch statements(including if statements and all loop statements in this dissertation),switch-case multibranch statements,and exception statements are all considered.Furthermore,in order to obtain the structural information of a certain API call pattern from the EBRCG of a class method,this dissertation proposes the EBRCG pruning algorithm to mark the API call pattern and its relevant structural context,prune the EBRCG of the class method,and obtain the code structure of a certain API call pattern.Additionally,to address the issue of multiple structures for a given API call pattern,this dissertation uses clustering and sorting methods to extract attribute information such as effective code lines,number of branch statements,weighted node depth,maximum width,and depth from the structural information of the API call pattern.The K-Means clustering algorithm is then used to group multiple structures,selecting a representative node from each cluster,and sorting the results to obtain the representative code structure of the API call pattern and resolve the redundancy issue in the generated structural information.Finally,this dissertation presents three sets of experiments to compare the code structure of API call patterns obtained by the proposed method with those obtained by the Text Rank method.The completeness of API call patterns under the two methods is compared,as well as the semantic and structural similarities between the API call patterns and the source code corresponding to the method body under both methods.The results show that the proposed method has certain research significance and can provide some reference for software developers.
Keywords/Search Tags:API call pattern, the Extended Branch-Reserving Call Graph, code structure, K-Means clustering
PDF Full Text Request
Related items