Refactoring is crucial for ensuring the long-term quality, readability, and maintainability of software code in evolving systems. The conventional methods for identifying refactoring are almost rule-based or heuristic-driven and have limitations due to the usage of handcrafted features and shallow structural inspection. Such methods generalise poorly across different codebases and often fail to capture the more abstract semantic similarity of source code. Deep learning has recently become significantly more powerful, enabling it to automate these tasks. However, available models are rarely optimised and do not integrate well with real-world development pipelines. To overcome this limitation, we present RefactoCNN-System, an efficient deep learning-based framework that predicts opportunities for macroscopic refactoring from raw Java source code. Syntax Trees (ASTs) and token sequences are thus used as structured representations of code. System maps them to embedding vectors, which are subsequently fed to a custom-made CNN model. The integration of Bayesian hyperparameter tuning and learning rate scheduling improves the model's predictive performance. The refactoring suggestions are generated by the mapping engine using heuristics that transform classification outputs into recommendations that are easy for developers to read. RefactoCNN extends a shallow feature-based classifier and handles common architecture adaptation problems such as heterogeneous datasets and automated feature discovery automatically using full deep learning capabilities, as experimental results show that RefactoCNN outperforms traditional machine learning classifiers and existing deep learning baselines when achieving 94.6% classification accuracy, 93.1% precision, 92.3% recall, and 92.7% F1-score on benchmark datasets. Qualitative analysis and examples from practice provide additional support for the system's practical usability. With a modular, extensible architecture, RefactoCNN serves as a significant resource for automated software maintenance, helping developers proactively manage and improve code quality. Our proposed framework represents a promising direction for improving automated, data-driven refactoring support. Implementation and reproducibility assets are available in our public GitHub repository: https://github.com/Erakasani/RefactoCNN-System.
Prasanna et al. (Tue,) studied this question.