Search-based refactoring recommendation methods, particularly those utilizing the non-dominated sorting genetic algorithm II (NSGA-II), have shown significant promise in automating software refactoring. However, existing approaches often rely on random initialization of the population and simplistic crossover operators, which can lead to suboptimal solutions and inefficient exploration of the search space. This paper proposes ReReC, a novel refactoring recommendation approach that enhances NSGA-II through constraint-based initialization and an adaptive crossover operator. ReReC introduces heuristic constraint rules for common refactoring types to generate a high-quality initial population, thereby reducing invalid refactoring operations. Furthermore, it employs an adaptive crossover strategy that distinguishes between common and differential refactoring operations, incorporating an elite gene guidance mechanism to accelerate convergence toward optimal solutions. To evaluate the effectiveness of ReReC, we evaluated it on six open-source projects. ReReC achieves an average of 81.95% F1 score, outperforming existing tools JMove and QMove by 7.48% and 5.50%, respectively. The results demonstrate that ReReC effectively improves both the accuracy and efficiency of refactoring recommendations.
The Move Method refactoring is crucial for mitigating the Feature Envy code smell, which enhances cohesion and reduces coupling by relocating methods to more suitable classes. Existing deep learning approaches often suffer from redundant features, limiting model generalization. To address this, this paper introduces GMove, a novel approach leveraging feature fusion and a hybrid deep learning architecture (Bi-LSTM and CNN branches) to recommend refactoring opportunities. By fusing semantic, structural, and metric features from a constructed 16,828-sample dataset, GMove effectively filters redundant information. Experimental results demonstrate that GMove achieves a high synthetic F1 score of 97.7% and significantly outperforms state-of-the-art refactoring tools, showing an average F1 improvement of 9.7% over the strongest modern baseline, affirming its effectiveness and novel fusion strategy.
Directed grey-box fuzzing (DGF) is central to vulnerability reproduction, patch testing, static analysis, and information-flow detection. However, most existing DGF tools rely on largely random mutation strategies and thus produce many ineffective inputs. To address this, we present SpeedDGF, a directed grey-box fuzzer that employs a lightweight per-byte mutation strategy. At runtime, SpeedDGF dynamically identifies path-sensitive bytes-those most influential for reaching target code regions-and assigns them higher byte-energy, increasing their likelihood of selection during mutation. The effectiveness of SpeedDGF was systematically evaluated across 26 real-world vulnerabilities. The experimental results demonstrate that SpeedDGF is 4.63 & times; faster in reaching the target locations and 5.78 & times; more effective in reproducing target vulnerabilities compared with existing fuzzing tools. This approach significantly enhances the capability of the fuzzing tool to reach specified target locations and efficiently reproduce vulnerabilities.
Behavioral consistency plays an important role in improving software evolution efficiency and guaranteeing software reliability in modern software refactoring. Although large language models (LLMs) demonstrate great potential in multiple software engineering tasks, including code generation, code completion, and code repair, few works have been conducted on LLM-based code refactoring. Furthermore, existing works are confused about how LLMs impact refactoring consistency. Therefore, there is an urgent need to conduct a systematic evaluation of behavioral consistency before and after refactoring. To this end, this paper conducts the first empirical study on LLM-based refactoring consistency. Firstly, we construct a high-quality dataset DataRef with 468 Java and 544 Python code segments, and refactor them using existing LLMs (e.g., ChatGPT-3.5/4.0, CodeLlama, CodeGeeX), generating 8,096 refactored code segments. Results demonstrate that a total of 928 refactored code segments exhibit behavioral inconsistencies, while 180 cases result in refactoring failures. We then establish a taxonomy to classify these inconsistency patterns. Thirdly, to evaluate the refactoring ability of representative state-of-the-art LLMs released in 2025, we construct a new dataset DataRef+ from inconsistent code segments, including 272 Java and 297 Python code segments. Experimental results show that 6.06
In large language model-based agents, memory serves as a critical capability for achieving personalization by storing and utilizing users' information. Although some previous studies have adopted memory to implement user personalization, they typically focus on preference alignment and simple question-answering. However, in the real world, complex tasks often require multi-hop reasoning on a large amount of user information, which poses significant challenges for current memory approaches. To address this limitation, we propose the multi-hop personalized reasoning task to explore how different memory mechanisms perform in multi-hop reasoning over personalized information. We explicitly define this task and construct a dataset along with a unified evaluation framework. Then, we implement various explicit and implicit memory methods and conduct comprehensive experiments. We evaluate their performance on this task from multiple perspectives and analyze their strengths and weaknesses. Besides, we explore hybrid approaches that combine both paradigms and propose the HybridMem method to address their limitations. We demonstrate the effectiveness of our proposed model through extensive experiments. To benefit the research community, we release this project at https://github.com/nuster1128/MPR.
Conditional branching provides a fundamental structure for executing a specific branch based on the value of a boolean expression at run-time. However, repeated or nested conditional branching can lead to increased complexity. Furthermore, fall-through semantics in conditional branching result in uncontrollable jumps. Refactoring conditional branching manually is error-prone, time-consuming, and tedious. There is a critical need to provide automated refactoring support for conditional branching. To this end, this paper presents ReBrancher, an automated refactoring approach to eliminate repeated or nested conditional branching. Firstly, ReBrancher parses source code into an abstract syntax tree and walks through conditional branching statements. Secondly, it removes redundant fall-through semantics by static program analysis and an automaton. The automaton is constructed from a control flow graph to match patterns of conditional branching. Finally, it converts a conditional branching into a switch expression and removes the fall-through semantics. ReBrancher was evaluated on nine real-world projects involving 25,137 conditional branchings. Experimental results show that a total of 1,790 conditional branching constructs are refactored within an average of 18.62 seconds per project. Furthermore, ReBrancher reduced the average cyclomatic complexity by 4.41% and removed 1,249 code smells, demonstrating its effectiveness in improving code quality.
To address the problem of excessive randomness introduced by the mechanical exchange of gene fragments in traditional crossover operators, which leads to the generation of invalid refactoring operations, this paper proposed a refactoring recommendation method called RefCross based on an adaptive crossover operator. Firstly, the submitted Java projects were parsed using source code analysis tools to construct a code structure model to extract code metrics. Then the fitness function was designed and the fitness value was calculated based on the extracted code metrics to guide the optimization direction of the crossover operator. Finally, the parent classification mechanism based on feature matching was constructed, and the crossover strategy was formulated. By combining with common gene retention, adaptive selection of differential genes, and the elite gene reinforcement strategy, the offspring refactoring sequences that balanced high-quality feature inheritance and diversity in the solution space was generated, thereby reducing the probability of generating ineffective refactoring operations. The results show that RefCross outperforms existing methods in precision, recall, and F1 score metrics on six open-source projects, achieving an average F1 score of 77.82%, representing a baseline improvement of 9.10 percentage points. This method effectively enhances the effectiveness and accuracy of refactoring recommendations, providing strong support for automated refactoring decisions.
Code vulnerability detection is crucial for securing systems against attacks. However, existing methods rely on the fine-tuning paradigm of pre-trained models, failing to grasp vulnerable code semantics and thus struggling to capture subtle semantic differences between vulnerable/non-vulnerable code. Furthermore, they treat code as sequential input, overlooking the structural information of the source code. To address these challenges, this paper proposes Vul-CGBT, a novel approach for code vulnerability detection by integrating contrastive semantic learning with graph embeddings, which enhances detection performance by extracting vulnerability deep semantics and code structural characteristics. Firstly, a Transformer model is pre-trained via masked language model and contrastive semantic learning, with momentum contrastive learning enhancing its grasp of vulnerability semantic patterns, producing code sequence embeddings. Secondly, the abstract syntax tree of source code is parsed via Tree-sitter to construct a control flow and data flow graph, from which a graph convolutional network is used to learn graph embeddings. Finally, sequence and graph embeddings are fused and fed into a fully connected network for detection. Experimental results on the ReVeal, Big-Vul, and CodeXGLUE-Defect datasets show that Vul-CGBT achieves an F1-score of 51.17%, 61.15%, and 66.19%, respectively, outperforming baselines like PDBERT and LineVul by 3.07% similar to 34.15%, 2.25% similar to 50.49%, and 3.83% similar to 22.24% across three datasets, demonstrating its effectiveness and generalizability.
Refactoring engines are an essential part of modern IDEs, supporting automated or semi-automated software refactorings. However, these refactoring engines suffer from software bugs, just like other complex software systems, and buggy refactoring engines may silently inject fatal errors into software projects. Consequently, thorough testing of refactoring engines is highly desirable. To this end, this paper proposes an automated approach called EngineTest to test refactoring engines. Unlike existing approaches, it is the first in this line to leverage both LLMs and bug reports of refactoring types other than the targeted refactoring type. The key rationale is that the same mistake, e.g., ignoring the potential name shadowing, may result in similar errors in multiple refactoring types.Consequently, we may retrieve a bug report for a refactoring type and carefully construct a few-shot example as input, guiding LLMs to migrate it into test programs for exercising other refactoring types.Finally, we run the test cases and validate them with differential testing and LLM-based inconsistent checking. We evaluate the proposed approach with widely used state-of-the-practice refactoring engines in Eclipse, NetBeans, and IntelliJ IDEA. Our evaluation results demonstrate that a total of 85 previously unknown bugs (including Java, C/C++, and Python) have been identified, and 30 of them have been manually confirmed by the tool vendors.
Logging statements are essential for software debugging and maintenance. However, existing approaches to automatic logging generation rely on static analysis and produce statements in a single pass without considering runtime behavior. They are also typically evaluated by similarity to developer-written logs, assuming these logs form an adequate gold standard. This assumption is increasingly limiting in the LLM era, where logs are consumed not only by developers but also by LLMs for downstream tasks. As a result, optimizing logs for human similarity does not necessarily reflect their practical utility. To address these limitations, we introduce ReLog, an iterative logging generation framework guided by runtime feedback. ReLog leverages LLMs to generate, execute, evaluate, and refine logging statements so that runtime logs better support downstream tasks. Instead of comparing against developer-written logs, we evaluate ReLog through downstream debugging tasks, including defect localization and repair. We construct a benchmark based on Defects4J under both direct and indirect debugging settings. Results show that ReLog consistently outperforms all baselines, achieving an F1 score of 0.520 and repairing 97 defects in the direct setting, and the best F1 score of 0.408 in the indirect setting where source code is unavailable. Additional experiments across multiple LLMs demonstrate the generality of the framework, while ablations confirm the importance of iterative refinement and compilation repair. Overall, our work reframes logging as a runtime-guided, task-oriented process and advocates evaluating logs by their downstream utility rather than textual similarity.
Code smell severity refers to the different levels of impact extent that smelly instances may have upon a specific project when more than one kind of code smell exists. Severity classification helps developers better understand a code smell and prioritize multiple refactoring operations more efficiently, thus improving the efficiency of software maintenance. However, existing studies on code smell severity assessment and classification suffer from insufficient quantitative evaluation and low accuracy. To this end, this paper proposes DeepCSS, a novel approach to classify code smell severity based on deep learning. To evaluate the severity of code smells reasonably and accurately, a quantitative evaluation framework is proposed to evaluate the importance of assessing each related metric. With this evaluation framework, datasets are constructed for four types of code smell (including data class, god class, long method, and feature envy) extracted from 100 real-world projects. DeepCSS acquires structural and semantic information from which features are extracted by leveraging BiLSTM-Attention and the improved CNN model. Then the final classification is done by a fully connected network containing the Attention mechanism and softmax functions. The experimental results show that DeepCSS can achieve an accuracy ranging from 95.11
Move method refactoring is a prevalent technique typically applied when a method relies more on members of other classes than on its original class. Existing approaches for move method refactoring recommendations have improved accuracy based on deep learning. However, it is challenging to capture the deep semantics behind the code and the true intention of the developer. Furthermore, the accuracy of move method refactoring needs to be improved. To alleviate these problems, this paper proposes MoveRec, a move method refactoring recommendation based on deep learning and LLM-generated information. To generate the dataset, MoveRec selects 58 real-world projects from which it extracts metric, textual, and semantic features. Metric features are derived using static analysis tools. Textual features are generated with LLM to obtain code summaries, and the pre-trained model is used to produce word vectors. Semantic features are obtained by calculating the similarity between the original and target classes. Finally, we construct a dataset with 12,475 samples. A deep learning model CNN-LSTM-GRU is designed for refactoring recommendations. We evaluate MoveRec on this dataset and experimental results show that the average F1 is 74%. Compared to existing methods including PathMove, JDeodorant, JMove, and RMove, MoveRec improves F1 ranging from 9.4% to 53.4%, demonstrating its effectiveness.
Feature selection plays a significant role in reducing the curse of dimensionality and enhancing the performance of deep learning models. To address the shortcomings of existing feature selection techniques in handling complex correlations between features and their lack of explainability, we propose an explainable feature selection method based on feature importance analysis, called FeatureImp. The method evaluates the contribution of features to model predictions through feature perturbation and uses statistical analysis methods to determine the relationships between different features and the potential associations between features and labels. It further identifies combinations of multiple features that may significantly impact the prediction results, thereby optimizing the feature contribution values by simultaneously perturbing multiple features. During the feature selection process, the optimal feature subset is determined based on the feature contribution values and correlation coefficients. Different from existing feature selection methods, FeatureImp quantifies the contribution of features to the model and is applicable to all types of model architectures. We apply FeatureImp to eight public datasets with varying feature dimensions using four types of deep learning models. The results show that FeatureImp reduces the number of features by an average of 30.57%. When models are trained and tested using the datasets after feature selection, the performance of 81.25 % of the models is improved. In addition, FeatureImp is compared with the existing feature selection techniques, the F-measure is increased by an average of 1.57%, and the MAE is decreased by an average of 5.07 %, which validates the effectiveness of FeatureImp.
Detecting objects in aerial images with complex backgrounds remains a significant challenge. This difficulty arises not only from the requirement of precise regression of bounding boxes but also from the presence of confusing backgrounds that share visual similarities with target objects. Existing object detectors primarily focus on improving convolutional representations for objects, with limited attention given to background proposal sampling. This paper introduces the Self-Rectification Faster R-CNN, a novel object detector designed to address the hard background proposal sampling problem for most of the object detector. The proposed method incorporates four key innovations: a balanced batch sampler, a balanced minibatch sampler, a hard background image sampler, and the SRNMS (Self-Rectification Non-Maximum Suppression) technique. Experiments demonstrate that the Self-Rectification Faster R-CNN achieves at least 7% improvement in F1-score compared to three state-of-the-art object detectors evaluated on our waterfowl detection dataset.
Software refactoring is widely employed to improve software quality. However, conducting refactorings manually is tedious, time-consuming, and error-prone. Consequently, automated and semi-automated tool support is highly desirable for software refactoring in the industry, and most of the main-stream IDEs provide powerful tool support for refactoring. However, complex refactoring engines are prone to errors, which in turn may result in imperfect and incorrect refactorings. To this end, in this paper, we propose a ChatGPT-based approach to testing refactoring engines. We first manually analyze bug reports and test cases associated with refactoring engines, and construct a feature library containing fine-grained features that may trigger defects in refactoring engines. The approach automatically generates prompts according to both predefined prompt templates and features randomly selected from the feature library, requesting ChatGPT to generate test programs with the requested features. Test programs generated by ChatGPT are then forwarded to multiple refactoring engines for differential testing. To the best of our knowledge, it is the first approach in testing refactoring engines that guides test program generation with features derived from existing bugs. It is also the first approach in this line that exploits LLMs in the generation of test programs. Our initial evaluation of four main-stream refactoring engines suggests that the proposed approach is effective. It identified a total of 115 previously unknown bugs besides 28 inconsistent refactoring behaviors among different engines. Among the 115 bugs, 78 have been manually confirmed by the original developers of the tested engines, i.e., IntelliJ IDEA, Eclipse, VScode-Java, and NetBeans.
Structured concurrency treats multiple tasks running in different threads as a single unit, thereby improving reliability and enhancing observability. The existing IDE (Integrated Development Environment) does not provide sufficient support to leverage such an advanced structure and conduct refactoring automatically. Manual refactoring is tedious and error prone. There is an urgent need to provide adequate support to perform automatic refactoring. To this end, this paper proposes ReStruct, an automatic refactoring approach to transform unstructured concurrency to structured concurrency. ReStruct first employs visitor pattern analysis to acquire the target code for refactoring and then performs a precondition to filter out the code that meets the refactoring criteria. Subsequently, it performs scope analysis to guide the refactoring process. Finally, ReStruct performs refactoring on the AST of the source program. ReStruct is implemented as an Eclipse plugin and is evaluated in seven real-world projects via the number of refactorings and changes to LOCs (lines of code), time, and performance after refactoring. The experimental results illustrate that a total of 82 unstructured codes are refactored, with an average of 27.3 s per project. Furthermore, the performances of these refactored projects are improved by an average of 6.5%, demonstrating its effectiveness.
Move method refactoring (MMR) is one of the most commonly used software maintenance techniques to improve feature envy. Existing work focuses on how to identify and recommend MMR. However, little is known about how MMR impacts program performance. There is a gap between MMR and its impact on performance. To reduce this gap, this paper proposes a novel approach to predict MMR performance based on deep learning and feature interaction. Firstly, construction of the first dataset in this domain. Secondly, FMPerf is built by combining Factor Machine and DeepPerf. Finally, We evaluate FMPerf on real-world projects including JUnit, LC-problems, and Kevin. The experimental results show that FMPerf obtains an average of 7.31 % MRE, illustrating that the predicted value is close to the real value. Furthermore, FMPerf improves MRE ranging from 2.29 % to 11.02 % compared to existing approaches, including Convolutional Neural Networks(CNN), Factorization-Machine based Neural Network(DeepFM), Performance Prediction with Deep Sparse Neural Network(DeepPerf), and Hierarchical Inter-action Neural Network for Performance Prediction(HINNPerf), demonstrating its effectiveness.
The tomato is a nutrient-rich vegetable with multiple health benefits for humans. However, leaf diseases have a greater impact on quality. The present methods for identifying leaf diseases are beset by difficulties in extracting multi-scale disease features, insufficient global feature capture, and low recognition accuracy. As a result, we present our deep learning model Multi-Head Latent and Self-Attention (MLSA) for identifying tomato leaf diseases. The suggested model is built on an enhanced AlexNet and includes the multi-head latent attention mechanism, which is noise resistant and focuses on local characteristics, as well as the multi-head self-attention mechanism, which is used to simulate global features. First, the classical AlexNet is optimized to enhance feature extraction depth. Second, the multi-head latent and self-attention mechanisms are integrated to promote the capacity of global feature modeling. Finally, the early stop mechanism is included to improve the model's classification performance. The experimental data consists of 8599 images, including healthy leaves and three typical diseases (i.e., target spot, leaf blight, and early blight). Experimental results demonstrate that the proposed MLSA model achieves an identification accuracy of 99.47 % with 16.34 M parameters. Compared to the state-of-the-art algorithms EfficientNet-B0, MobileOne-S0, and OverLoCK-B, the proposed approach has a faster computation speed, higher recognition precision, and stronger generalization ability. The current strategy is conducive to the deployment of edge computing devices and has a wide range of promotional significance and application potential in smart agriculture.
ProblemAccurate diagnosis of plant diseases is crucial for ensuring crop yield and food safety. This study aims to explore a deep learning based intelligent recognition methods for plant leaf diseases to solve the automatic recognition problem of various pea leaf diseases.MethodologyWe propose a novel deep learning framework called TSSC. First, a three-neighbor channel attention is designed to promote the effectiveness of feature extraction. Second, a complementary squeeze and excitation mechanism is introduced to enhance the ability to extract key features. Finally, a split attention module is embedded to reduce model complexity.ResultsThe experimental results demonstrate that the proposed model achieves an overall classification accuracy of 99.61% and outperforms other excellent deep learning models.ContributionThe currently proposed system provides an effective solution for image recognition of complex plant diseases and has reference value for the development of mobile disease detection equipment.
To address the challenges of uneven user coverage and limited spectrum resources in Space-Air-Ground Integrated Networks, this paper proposes a power-domain non-orthogonal multiple access communication framework based on the cooperation of low Earth orbit satellites, unmanned aerial vehicles, and reconfigurable intelligent surfaces. In this system, a near user U1 receives superimposed signals directly from the satellite and performs reliable decoding using successive interference cancellation. Meanwhile, the far user U2 receives signals through both the direct satellite link and an RIS-assisted link, where the RIS dynamically adjusts the reflection path using a programmable phase matrix to compensate for long-range fading. We derive exact and asymptotic closed-form expressions for the outage probability, ergodic rate, and energy efficiency of both U1 and U2, and further analyze the diversity gain of the system under high signal-to-noise ratio conditions. In addition, delay-independent ergodic rate expressions for both users are analytically obtained using the exponential integral function. Numerical simulations validate the theoretical analysis: under low SNR conditions, the proposed RIS-NOMA cooperative architecture reduces the outage probability by up to 70%, improves the ergodic sum rate by approximately 45%, and significantly enhances the energy efficiency compared with conventional OMA and non-RIS benchmarks. As the number of RIS reflecting elements increases and the phase configurations are optimized, the system exhibits improved spectral efficiency and resilience to fading.