Skip to content
Open access

Fine-Tuning UniXcoder for Code Smell Detection in Java Projects

2026 · IEEE Access · Vol 14, pp. 142999-143021 · 0 citations · 60 references

TL;DR

This study investigates the application of UniXcoder, a pre-trained transformer model for source code, to classify Java source code methods across multiple projects as smell or clean, with a particular focus on the Switch Statements smell, and confirms that pre-trained transformer models, particularly UniXcoder, are capable of understanding both the semantic and syntactic structures of code.

Abstract

Code smells are symptoms of poor software design that hinder maintainability and increase technical debt interest. Automated detection of code smells is crucial in software development industry, where manual inspection is costly and error-prone. Although several studies have explored code smell detection, most existing approaches, both structural/metric-based and textual/transformer-based, still exhibit limitations in capturing the semantic context of source code to handle complex smells effectively. This study investigates the application of UniXcoder, a pre-trained transformer model for source code, to classify Java source code methods across multiple projects as smell or clean, with a particular focus on the Switch Statements smell. The proposed method fine-tunes UniXcoder and evaluates its performance using standard metrics, namely accuracy, precision, recall, and F1-score, in comparison with traditional machine learning models based on structural metrics and textual representations. Experimental results show that the fine-tuned UniXcoder achieves the highest classification accuracy of 80.2%, the highest precision among all baseline methods evaluated, indicating its effectiveness in minimizing false positives. These findings confirm that pre-trained transformer models, particularly UniXcoder, are capable of understanding both the semantic and syntactic structures of code and demonstrate stronger performance than frequency-based textual representation approaches as well as software metrics-based approaches. Furthermore, the results highlight UniXcoder’s potential for integration into industrial software engineering workflows, supporting automated code smell detection as part of continuous code quality assurance.

Read PDF

Similar papers

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
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
Open access Oct 2026

Paired Code Smells and Test Smells: A Fine-Grained Longitudinal Empirical Study

As software systems grow in complexity, ensuring maintainability is essential, but often hindered by various quality issues. Among them, code smells and test smells are widely recognized indicators of technical debt that degrade system quality. While production code and test suites are intrinsically coupled and evolve...

Zi-Wen Cai · 0 citations
Open access 2026

A Text-Based Refactoring Dataset for Multi-Type Prediction Using Code Snippets and Software Metrics

Refactoring is a disciplined process of improving the internal structure of software without changing its external behavior. Empirical studies have shown that refactoring contributes to maintainability and code quality; however, existing machine learning approaches for refactoring prediction rely predominantly on struc...

Amal Alazba, Muna Alrazgan, Nada Al Jamaan et al. · 0 citations
Sep 2026

Analyzing and fixing code generation errors of foundation large language models

The goal is to understand the code generation errors of foundation LLMs and explore the solution to resolve directly fixable errors, and to design and evaluate the LlmFix fixing method and constructed the LlmErrorEval dataset.

Hao Wen, Yue-Heng Zhu, Chao Liu et al. · 0 citations
#software testing Preprint Aug 2026

Benchmarking the Titans: A Multi-Dimensional Empirical Evaluation of LLM Code Generation Quality in the .NET Ecosystem

An automated, multi-dimensional evaluation framework for C# code generation, applying it to four state-of-the-art LLMs: GPT, Gemini, Claude, and Grok is presented and a substantial gap between correctness and quality attributes is revealed.

Seyed Mohammad Mahdi Ghalandarian, Majid Bazargani, Masoumeh Taromirad · 0 citations

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