Saved in:
Bibliographic Details
Main Authors: Pirapuraj, Ponnampalam, Mondal, Tamal, Gupta, Sharanya, Lal, Akash, Aditya, Somak, Vedurada, Jyothi
Format: Preprint
Published: 2026
Subjects:
Online Access:https://arxiv.org/abs/2604.07891
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866918436481794048
author Pirapuraj, Ponnampalam
Mondal, Tamal
Gupta, Sharanya
Lal, Akash
Aditya, Somak
Vedurada, Jyothi
author_facet Pirapuraj, Ponnampalam
Mondal, Tamal
Gupta, Sharanya
Lal, Akash
Aditya, Somak
Vedurada, Jyothi
contents Application Programming Interfaces (APIs) are crucial to software development, enabling integration of existing systems with new applications by reusing tried and tested code, saving development time and increasing software safety. In particular, the Java standard library APIs, along with numerous third-party APIs, are extensively utilized in the development of enterprise application software. However, their misuse remains a significant source of bugs and vulnerabilities. Furthermore, due to the limited examples in the official API documentation, developers often rely on online portals and generative AI models to learn unfamiliar APIs, but using such examples may introduce unintentional errors in the software. In this paper, we present AFGNN, a novel Graph Neural Network (GNN)-based framework for efficiently detecting API misuses in Java code. AFGNN uses a novel API Flow Graph (AFG) representation that captures the API execution sequence, data, and control flow information present in the code to model the API usage patterns. AFGNN uses self-supervised pre-training with AFG representation to effectively compute the embeddings for unknown API usage examples and cluster them to identify different usage patterns. Experiments on popular API usage datasets show that AFGNN significantly outperforms state-of-the-art small language models and API misuse detectors.
format Preprint
id arxiv_https___arxiv_org_abs_2604_07891
institution arXiv
publishDate 2026
record_format arxiv
spellingShingle AFGNN: API Misuse Detection using Graph Neural Networks and Clustering
Pirapuraj, Ponnampalam
Mondal, Tamal
Gupta, Sharanya
Lal, Akash
Aditya, Somak
Vedurada, Jyothi
Software Engineering
Application Programming Interfaces (APIs) are crucial to software development, enabling integration of existing systems with new applications by reusing tried and tested code, saving development time and increasing software safety. In particular, the Java standard library APIs, along with numerous third-party APIs, are extensively utilized in the development of enterprise application software. However, their misuse remains a significant source of bugs and vulnerabilities. Furthermore, due to the limited examples in the official API documentation, developers often rely on online portals and generative AI models to learn unfamiliar APIs, but using such examples may introduce unintentional errors in the software. In this paper, we present AFGNN, a novel Graph Neural Network (GNN)-based framework for efficiently detecting API misuses in Java code. AFGNN uses a novel API Flow Graph (AFG) representation that captures the API execution sequence, data, and control flow information present in the code to model the API usage patterns. AFGNN uses self-supervised pre-training with AFG representation to effectively compute the embeddings for unknown API usage examples and cluster them to identify different usage patterns. Experiments on popular API usage datasets show that AFGNN significantly outperforms state-of-the-art small language models and API misuse detectors.
title AFGNN: API Misuse Detection using Graph Neural Networks and Clustering
topic Software Engineering
url https://arxiv.org/abs/2604.07891