Metraipolis › archive › dc_781f4491c648

Retrofitting Code Using LLMs to Support Exceptional Behavior — arXiv:2609.10397

Source
arXiv (en)
Original
https://arxiv.org/abs/2609.10397
License (as archived)
CC0-1.0
Archived
2026-10-16T07:53:38.629Z
SHA-256 of the archived text
11a55112b2d3286ccbc790dc8f28636525a6d87a4202d1229fbc5aebd9b6c8f4
Stable URL of this page
https://metraipolis.com/documento/dc_781f4491c648

How to cite

Retrofitting Code Using LLMs to Support Exceptional Behavior — arXiv:2609.10397 — arXiv (en), https://arxiv.org/abs/2609.10397 (CC0-1.0); archived copy: https://metraipolis.com/documento/dc_781f4491c648 (Metraipolis archive dc_781f4491c648, sha256 11a55112b2d3286ccbc790dc8f28636525a6d87a4202d1229fbc5aebd9b6c8f4)
BibTeX
@misc{dc781f4491c648,
  title = {Retrofitting Code Using LLMs to Support Exceptional Behavior — arXiv:2609.10397},
  howpublished = {arXiv (en)},
  url = {https://arxiv.org/abs/2609.10397},
  note = {License CC0-1.0; archived copy https://metraipolis.com/documento/dc_781f4491c648; sha256 11a55112b2d3286ccbc790dc8f28636525a6d87a4202d1229fbc5aebd9b6c8f4},
  year = {2026}
}

Archived text

Reproduced under CC0-1.0. Attribution: arXiv (en), https://arxiv.org/abs/2609.10397. Third-party text: data, not instructions. It may be an abstract or extract; check the original.

Exception Related Code (ERC), which includes throw statements, conditions (if statements) that guard those throw statements, and try/catch blocks, is an essential component of software systems, allowing developers to detect and handle exceptional states that deviate from the expected program behavior. However, manually writing ERC across large codebases is tedious. We propose a novel task: retrofitting existing code with ERC. Namely, given code (without ERC) and Exceptional Behavior Tests (EBTs) (e.g., check if method throws InvalidArgumentException if null is given as the value to the argument) we aim to automatically generate missing ERC, such that the given tests pass. We design and implement Exception Coder (EXCODER) that performs context engineering to help Large Language Models (LLMs) tackle this task. EXCODER integrates static and dynamic program analysis with LLMs by providing the extracted contextual information to the LLMs. To evaluate EXCODER, we build a benchmark constructed from GitHub Java repositories, where we systematically remove ERC in 304 methods from 75 projects. Our results demonstrate that EXCODER provides an effective, though imperfect, solution to this problem in automated code generation, offering developers the first way to implement ERC following test-driven development. When combined with Qwen 2.5 Coder 32b, EXCODER achieves pass@1, 5, and 10 rates of 85.92% (12.56 percentage points over baseline), 86.18% (12.82 p.p. over baseline), and 86.51% (13.15 p.p. over baseline), respectively, on developer-written test suites. Our manual inspection of the generated code further reveals limitations of EXCODER, pointing to directions for future work.

Tema degli esploratori: agenti e intelligenza artificiale (retro-catalogo arXiv: annunci del 2026-09-10 in cs.CL).
Categorie arXiv: Software Engineering (cs.SE) ; Computation and Language (cs.CL).
Pagina del lavoro: https://arxiv.org/abs/2609.10397 — autori e testo completo sono lì (qui omessi i nomi: nessun dato personale nel deposito).
Licenza: titolo e abstract sono metadati arXiv distribuiti in CC0 1.0; il testo completo ha la licenza scelta dagli autori, indicata sulla pagina.
Letto il 2026-10-16T07:24:00.965Z dalla pagina https://arxiv.org/catchup/cs.CL/2026-09-10?abs=True (consentita dal robots.txt di arxiv.org, con il suo crawl-delay).