<b>Boosting API Misuse Detection via Integrating API Constraints from Multiple Sources</b>
Creators: name: Green, Icey
Publisher: name: figshare
Year: 2023
Subjects: classificationCode: 461201
subject: Automated software engineering

description: Boosting API Misuse Detection via Integrating API Constraints from Multiple SourcesThis repository provides code used in the paper "Boosting API Misuse Detection via Integrating API Constraints from Multiple Sources". It includes client code constraint extraction, library code and library document constraint extraction, API constraint graph construction, and API misuse detection.Dataset:Our client project set includes 420 projects from github, you can find their download links in the data set <b><i>ClientProjectSet.rar</i></b> of the repository.We mine the API constraints of the target API set. It contains 128 target APIs, you can find the target API and the version of the library file in the data set <b><i>targetAPIs.xlsx</i></b> of the repository.For the qualitative analysis, we provide sample data and sampling results, which you can find in the dataset in the repository.Usage:1. To begin, you should download the corresponding dataset by following the instructions provided in our dataset description.2.You can use the myExtractor module to extract constraints from the client projects.Firstly, you can execute <b><i>AUGOrderRuleImprove.java</i></b> and <b><i>AUGOtherRuleImprove.java</i></b> to convert the client-side code into AUGs(API Usage Graphs) and extract constraint information.Secondly, you can execute<i> </i><b><i>AUGPreOrderAnalysis.java</i></b>, <b><i>AUGPostOrderAnalysis.java</i></b>, and <b><i>AUGOtherRuleAnalysis.java</i></b> to calculate the occurrences and frequency values of each constraint.Finally, you can use <b><i>AUGOrderFilter.java</i></b> and <b><i>AUGOtherFilter.java</i></b> to filter the constraints, ultimately obtaining client API constraints.Additionally, this module relies on <b><i>aug</i></b>, <b><i>mubench</i></b>, and <b><i>src2egroum2aug </i></b>to implement the functionality of converting code to AUGs. The corresponding dependencies and paths are configured in the pom file of this module.3.You can extract constraints from library code and API documentation using the myCLExtractor module.The project's <b><i>codeList1.txt</i></b> stores the index of the target APIs.After downloading the corresponding versions of library files based on the content in the dataset's <b><i>targetAPIs.xlsx</i></b>, you can run the project through <b><i>Main.java</i></b>.4.You can construct API constraint graphs through the myGraph module.The myGraph module contains the data structure of the constraint graph we constructed, along with the process of constructing the constraint graph based on API constraints.After obtaining API constraints from the three sources, you can construct the API constraint graphs by running the <b><i>Main.java</i></b> file in this module.5.You can implement API misuse detection through the myDetect module.The test set used here is the MuBench benchmark dataset for the API misuse detection domain. You can access the corresponding description and download links for this dataset at https://github.com/stg-tud/MUBench.By running the <b><i>DetectMain.java</i></b> file in this module, not only can you detect whether API misuse has occurred, but you can also provide reasons for the misuse of APIs for developers to reference.Paper and CitationMore technical details can be found in our paper. If you use this code, please consider citing us.