StaAgent: An Agentic Framework for Testing Static Analyzers
Preprint
Abstract
Static analyzers play a critical role in identifying bugs early in the software development lifecycle, but their rule implementations are often under-tested and prone to inconsistencies. To address this, we propose StaAgent, an agentic framework that harnesses the generative capabilities of Large Language Models (LLMs) to systematically evaluate static analyzer rules. StaAgent comprises four specialized agents: a Seed Generation Agent that translates bug detection rules into concrete, bug-inducing seed programs; a Code Validation Agent that ensures the correctness of these seeds; a Mutation Generation Agent that produces semantically equivalent mutants; and an Analyzer Evaluation Agent that performs metamorphic testing by comparing the static analyzer's behavior on seeds and their corresponding mutants. By revealing inconsistent behaviors, StaAgent helps uncover flaws in rule implementations. This LLM-driven, multi-agent framework offers a scalable and adaptable solution to improve the reliability of static analyzers. We evaluated StaAgent with five state-of-the-art LLMs (CodeL-lama, DeepSeek, Codestral, Qwen, and GPT-4o) across five widely used static analyzers (SpotBugs, SonarQube, ErrorProne, Infer, and PMD). The experimental results show that our approach can help reveal 64 problematic rules in the latest versions of these five static analyzers (i.e., 28 in SpotBugs, 18 in SonarQube, 6 in ErrorProne, 4 in Infer, and 8 in PMD). In addition, 53 out of the 64 bugs cannot be detected by the SOTA baseline. We have reported all the bugs to developers, with two of them already fixed. Three more have been confirmed by developers, while the rest are awaiting response. These results demonstrate the effectiveness of our approach and underscore the promise of agentic, LLM-driven data synthesis to advance software engineering.Keywords
All Related Versions
This publication has 13 references indexed in Scilit:
- A Survey on LLM-Based Code Generation for Low-Resource and Domain-Specific Programming LanguagesACM Transactions on Software Engineering and Methodology, 2026
- Bugs in large language models generated code: an empirical studyEmpirical Software Engineering, 2025
- LLM-Based Test-Driven Interactive Code Generation: User Study and Empirical EvaluationIEEE Transactions on Software Engineering, 2024
- ClarifyGPT: A Framework for Enhancing LLM-Based Code Generation via Requirements ClarificationProceedings of the ACM on Software Engineering, 2024
- Finding and Understanding Defects in Static Analyzers by Constructing Automated OraclesProceedings of the ACM on Software Engineering, 2024
- Understanding and Detecting Annotation-Induced Faults of Static AnalyzersProceedings of the ACM on Software Engineering, 2024
- Enhancing Static Analysis for Practical Bug Detection: An LLM-Integrated ApproachProceedings of the ACM on Programming Languages, 2024
- Evaluating C/C++ Vulnerability Detectability of Query-Based Static Application Security Testing ToolsIEEE Transactions on Dependable and Secure Computing, 2024
- LLM-powered Data Augmentation for Enhanced Cross-lingual Performance2023
- CoCoFuzzing: Testing Neural Code Models With Coverage-Guided FuzzingIEEE Transactions on Reliability, 2022