Foundation Models as Oracles for Refactoring Correctness Detection
Rohit Gheyi, Rian Melo, Jonhnanthan Oliveira, Marcio Ribeiro, Baldoino Fonseca

TL;DR
This paper investigates the use of foundation models as oracles for detecting refactoring bugs in Java, demonstrating promising accuracy and potential to support developer workflows.
Contribution
It evaluates zero-shot prompting of foundation models on real refactoring bugs, showing their effectiveness and potential to complement traditional detection methods.
Findings
GPT-OSS-20B achieved 80.5% accuracy
GPT-5.4 achieved 93.8% accuracy
Model predictions are consistent under semantics-preserving variations
Abstract
Refactoring tools in popular Integrated Development Environments (IDEs) can introduce unintended behavioral changes or compilation errors, a persistent challenge that undermines developer trust in automated transformations. Traditional detection approaches rely on handcrafted preconditions, and static and dynamic analyses, yet remain limited in adaptability and can miss subtle correctness issues. This study examines the potential of foundation models to serve as oracles for detecting refactoring bugs in Java programs. We evaluate zero-shot prompting, without task-specific training, across 226 real refactoring bugs collected over more than a decade from widely used Java IDEs (IntelliJ-IDEA, Eclipse, and NetBeans), spanning 47 refactoring types. Our results indicate that foundation models can be effective for this task, although performance varies across models. In the first-run setting,…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
