JavaCapsule: Iterative Java Code Generation and Debugging Based on Structured Feedback


JavaCapsule: Iterative Java Code Generation and Debugging Based on Structured Feedback

Alexandrov D.V. (NRU HSE, Moscow, Russia)
Vasilevskiy V.I. (NRU HSE, Moscow, Russia)
Rezunik L.A. (NRU HSE, Moscow, Russia)
Kuligin L.A. (NRU HSE, Moscow, Russia)
Manushkina A.V. (NRU HSE, Moscow, Russia)
Dumkin N.A. (NRU HSE, Moscow, Russia)
Prozorskiy M.A. (NRU HSE, Moscow, Russia)
Pinigin K.Y. (Innopolis University, Innopolis, Russia)

Abstract

Large language models demonstrate limitations in tasks that require precise information retrieval from very long input sequences. This limitation affects code generation in large object-oriented systems, where correctness depends on complex inter-class dependencies and the analysis of long execution traces that exceed standard context window sizes. This paper presents JavaCapsule, a technology for automated generation and iterative debugging of Java code based on structured feedback. The approach incorporates unit test results and execution traces into an iterative refinement loop. For reliable evaluation, JavaBench+ is introduced as an improved benchmark with corrected structural inconsistencies and extended feedback that includes access to test specifications and execution logs. In addition, the Associative Recurrent Memory Transformer (ARMT) is investigated as a mechanism for accurate information retrieval from long sequences. The study is based on controlled experiments using JavaBench+ and comparative evaluation with a strong baseline model. The results show that JavaCapsule improves Pass@1 by 20 percentage points compared to Google Gemma-3-27B-it on medium-complexity tasks and demonstrates consistent improvements on larger projects. In addition, experiments with ARMT demonstrate accurate information retrieval from sequences of up to one million tokens. The obtained results characterize the capabilities of iterative debugging and long-context processing as two complementary components of the proposed approach.

Keywords

code generation; intelligent debugging; long-context models; memory-augmented transformers; ARMT; java; large language models.

Edition

Proceedings of the Institute for System Programming, vol. 38, issue 5, 2026, pp. 73-90

ISSN 2220-6426 (Online), ISSN 2079-8156 (Print).

DOI: 10.15514/ISPRAS-2026-38(5)-5

For citation

Alexandrov D.V., Vasilevskiy V.I., Rezunik L.A., Kuligin L.A., Manushkina A.V., Dumkin N.A., Prozorskiy M.A., Pinigin K.Y. JavaCapsule: Iterative Java Code Generation and Debugging Based on Structured Feedback. Proceedings of the Institute for System Programming, vol. 38, issue 5, 2026, pp. 73-90 DOI: 10.15514/ISPRAS-2026-38(5)-5.

Full text of the paper in pdf (in Russian) Back to the contents of the volume