Skip to content
Conference

Understanding and Reducing Code Smells in AI-Generated Java Code Using Explainable AI and Prompt Optimization

Jul 2026 · IEEE Jordan Conference on Applied Electrical Engineering and Computing Technologies · pp. 347-352 · 0 citations · 8 references

Abstract

Recently, Developers have been relying on AI tools to support them in their daily work by generating code. While the use of large language model-based AI tools has improved productivity, the quality of the generated code wasn't always optimal. In a lot of cases, the code includes design issues known as code smells, which negatively impact readability, maintainability, and future development. This paper investigates these issues in AI-generated Java code, with a focus on common object-oriented problems such as switch statements, temporary fields, and refused bequest. A structured approach is proposed that combines static analysis tools with explainable AI techniques to better understand why these problems appear. Based on the realized insights, prompts are optimized to guide the AI model towards generating cleaner and more structured code. The results showed clear improvement after the prompt optimization, where the number of detected code smells was reduced by 66%, and completely removed (100% reduction) in some cases. Overall, the study showed that improving prompt design, supported by explainable analysis, can significantly enhance the quality of AI-generated code.

View source

Similar papers

Preprint Aug 2026

Comparing the Quality of Code Generated by Vibe Coding Tools

This study compares the structural quality of code produced by three widely adopted vibe coding tools --- Lovable, v0, and Replit --- starting from a single generation prompt and suggests that choosing between vibe coding tools involves structural trade-offs that go beyond perceived productivity.

Gustavo Rubin da Mota, Kiev Gama · 0 citations
Preprint Aug 2026

Unreliable in Practice? A Comprehensive Study of Errors in LLM-Generated Code

It is observed that generated code often omits basic input validation or memory-safety checks, which can lead to overflows, resource exhaustion, or other reliability/security issues, and even the largest models frequently make simple mistakes.

Rodrigo Pato Nogueira, Marco Vieira, João R. Campos · 0 citations
Aug 2026

Observatory software management in the era of AI-assisted software engineering

Thanks to advancements in generative AI and Large Language Models (LLMs), the last five years have seen exponential growth in the adoption of AI-Assisted software engineering across many industries. Simple developer tools used for code completion, static analysis and syntax linting have been augmented by semi-autonomous agents, able to contribute to a broad set of Software Engineering practices including code generation, documentation generation, test creation, refactoring, architectural assistance, enhanced Integrated Developer Environment (IDE) tools and analysis and verification. The way we develop, analyze and test software is rapidly changing. Recent industry reports show that at least 84% of professional software developers already use AI coding assistants regularly, with 52% of developers reporting that AI tools have had a positive effect on their productivity. At GMTO, we stand to benefit from these technologies and adopting industry best practices. However, it needs to be done in a way that carefully considers our unique concerns and risks. These include code quality, maintainability and technical debt; scientific and engineering integrity, governance, trust and over-reliance; and ethical, talent and workforce issues. In this paper we describe how we are starting to utilize AI-assisted software engineering at GMTO, why these common industry concerns matter for Observatory software teams, and future plans.

M. Cox, J. Filgueira, Chien Peng et al. · 0 citations
Open access Aug 2026

Leveraging Generative AI in Software Development: Advantages and Difficulties

The paper is trying to deeply analyze the pros and cons of implementing GenAI into software development, analysing current applications used in software development life cycle (SDLC), drawing upon case studies and programmer experience, and examining effect on code quality, team working and project timeline.

P. Arun, Jagdale, Deepti Ameta et al. · 0 citations
Open access Aug 2026

An Exploratory Study on Code Smells Detection and Refactoring using LLMs

This paper focuses on four common smells and considers five prompts of diverse complexity, asking the model for detecting and removing the identified code smells, and suggests that general-purpose LLMs cannot be reliably used for that.

Giorgia Paisi, Francesca Arcelli Fontana, Bartosz Walter · 0 citations
Preprint Aug 2026

SmellCC: A Tool for Automated Code Smells Remediation

SmellCC, a Visual Studio Code extension that augments SonarQube with an LLM-based pipeline to automatically detect and refactor Python code smells, provides in-place, one-click remediation for the top-10 most frequent smells, effectively preventing the accumulation of technical debt during development.

Xiaoting Zhang, Yujie Zhang, Zhi-Peng Gao et al. · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.