
Context: Traditional file-level defect prediction methods struggle to precisely pinpoint the specific lines of code containing defects, limiting their practical value in code reviews. Furthermore, line-level defect prediction faces significant challenges in effectively leveraging the inherent complex semantic and structural information within code. Additionally, existing approaches often overlook the interdependencies between file-level and line-level labels, and perform poorly in scenarios with extreme data imbalance where defect lines are scarce. Objectives: This study aims to propose a novel line-level defect prediction method, LineCodeGSeq, designed to achieve precise defect localization and significantly reduce inspection costs. The objective is to overcome the limitations of current approaches by effectively integrating multimodal information — specifically code semantics, sequential context, and structural context — while balancing multi-granularity tasks through a unified training framework. Methods: First, it utilizes a pre-trained CodeBERT model to extract deep semantic feature representations for each line of code. Second, it employs a Bidirectional Gated Recurrent Unit (Bi-GRU) to capture sequential contextual information. Third, a Multi-Relational Gated Graph Neural Network (MR-GGNN) is introduced to model both control flow and data flow within the Program Dependence Graph (PDG), capturing structured contextual information. Finally, the model uses a Multi-Task Learning (MTL) framework with uncertainty-based adaptive weighting to jointly train file-level and line-level prediction tasks. Results: Experimental results demonstrate that LineCodeGSeq outperforms 5 state-of-the-art line-level prediction methods and 4 file-level baselines. The results demonstrate that in Within-Project Defect Prediction (WPDP) and Cross-Project Defect Prediction (CPDP) tasks, LineCodeGSeq improves Recall@Top20%LOC by 21%–130% and 15.8%–120%, respectively, while reducing Effort@Top20%Recall by 14%–57% and 5%–55.8%, respectively. Conclusion: LineCodeGSeq achieves superior defect localization efficiency and lower inspection costs by fusing semantic, sequential, and structural information. Furthermore, the end-to-end joint learning framework leverages the multi-granularity complementary enhancement between file-level and line-level supervision signals, providing a robust solution for fine-grained defect prediction in both within-project and cross-project scenarios.
Context: Code smells are suboptimal design and implementation choices in software development. Although they do not cause immediate program failures, they increase maintenance costs, reduce code readability, and are prone to accumulating hidden risks as the software evolves. To tackle these challenges, researchers are exploring better ways to detect code smells. Objective: The aim of this study is to propose a semantic robustness evaluation method for deep learning-based code smell detection models using adversarial attack methods, and to evaluate the models’ robustness in response to input perturbations. Methods: We conduct an evaluation across two programming languages (Java and C#), four code smells (Complex Method, Complex Conditional, Feature Envy, and Multifaceted Abstraction), and four model architectures (RNN-LSTM, CodeBERT, AutoEncoder, and Qwen3.5-9B). We apply four categories of adversarial attacks, including NLP-level, Semantic (AST-based variable synonym substitution), Structural (control-flow transformations), and Hybrid, at three adversarial ratios (10%, 30%, 50%). Adversarial training is then applied to the trainable models, while Adv-ICL is applied to the zero-shot LLM, to enhance model robustness. Results: Most models exhibit performance degradation under adversarial perturbations, with hybrid and structural attacks generally producing the largest effects. Adversarial training substantially restores detection performance on perturbed inputs for many trainable models, while Adv-ICL provides smaller improvements for Qwen on CM and CC. On clean data, F1 improves in many configurations, although the effects on AUC-ROC and minority-smell detection vary across models and smell types. Conclusion: The results demonstrate the broad but configuration-dependent effectiveness of adversarial training for code smell detection. Its benefits depend on the model architecture, smell type, programming language, and adversarial ratio, while severe class imbalance remains a major limitation for minority-smell detection.
Context: Databases are widely used as infrastructure software. Once a bug occurs in the database, it dramatically impacts enterprises and end-users. Redis is a high-representative, high-performance key–value storage NoSQL database. Objective: An in-depth understanding of the characteristics of historical bugs can help detect and fix future bugs, thereby improving the quality of software. To understand the characteristics of bugs in the Redis database in terms of time, location, symptoms, affected features, bug-fixing, and root causes, we conduct an empirical study in this paper. Methods: The empirical study involves 1763 bug reports and 1141 revisions in the Redis repository. The analysis mainly covers five aspects: when and where, symptoms, affected features, bug-fixing, and root causes. Results: (1) Bug reports surged after 2020, their peak in 2020–2021 may be related to the release of Redis 6.0; the component with the most bugs is the server component; the two source files with the most bugs are src/server.c and src/server.h, both related to the server component. (2) The most frequent symptoms of bugs are Behavior Error, Crash, and Nonfatal Error. (3) The three features most affected by bugs are Command/Redis-cli, Datastructure, and Persistence (RDB, AOF). (4) Most bugs can be fixed with a few lines of modified code and a small number of modified files, and more than half of the bugs are fixed within one month. (5) The most common root cause of bugs is Semantic bugs, followed by Memory and Environment/Configuration; Processing bugs and Missing Features are the most common Semantic bugs. Conclusion: These findings could help developers improve development quality, help maintainers and testers discover and fix bugs more effectively and comprehensively, and provide some usage advice to users.
Context: Detecting whether source code is human-written or generated by large language models (LLMs) is increasingly relevant to programming assessment and software provenance analysis. However, high reported accuracy can be misleading when detectors rely on low-level stylistic cues that do not transfer across coding contexts. Objectives: This study evaluates human–LLM code discrimination under leakage-controlled distribution shift, with emphasis on style-controlled educational programming. We examine how training mixtures, model family, and task adaptation affect robustness and relied-upon signals. Methods: We introduce iJudge, a curated dataset of authentic student Python submissions collected from an institutional online judge operating under a shared style/quality regime. Using iJudge, CodeChef-extended, and CoDet–M4, we define a unified protocol and report a full train × test matrix with out-of-distribution summaries. We evaluate support vector machines, XGBoost, encoder-based CodePTMs (UniXcoder and CodeBERT), and decoder-based CodeLLMs (Qwen2.5-Coder-1.5B and StarCoder2-3B) under frozen probing and task-adapted settings, complemented by attribution analysis. Results: Robustness depends strongly on training distribution and mixture design. Single-source training achieves high in-domain performance but often transfers poorly across pools. Rebalancing dominant sources improves uniformity for feature-based and neural models. Task-adapted decoder-based CodeLLMs achieve the strongest overall performance, but remain sensitive to source coverage and mixture balance. Feature-level attribution over hand-crafted features and qualitative token-level diagnostics suggest that incorporating iJudge shifts reliance away from layout/lexical cues toward more syntactic and structural signals. Conclusion: iJudge complements existing code authorship datasets by providing a style-controlled educational evaluation regime. The results show that reliable human–LLM code detection requires cross-pool evaluation, deliberate mixture design, and cautious use as assessment support rather than standalone evidence of misconduct.
Context: Autonomous and self-adaptive systems increasingly rely on black-box predictive models to support runtime decision making in critical domains. However, the lack of transparency of such models enlarges the adaptation search space and increases optimization costs. Objective: This paper addresses the problem of multi-objective optimization in opaque autonomous systems through cost-effective explanation-driven adaptation. Method: We propose GLASS, a self-adaptation approach that integrates model-agnostic interpretable machine learning into a feedback loop. Building on our previous work, GLASS combines global explanations (Partial Dependence Plots) with local explanations (counterfactuals) to guide runtime adaptation decisions and reduce the search space toward goal-relevant configurations. Results: An empirical evaluation on three cyber–physical systems benchmarks shows that GLASS achieves competitive or superior adaptation effectiveness while significantly reducing execution time compared to three state-of-the-art baselines, including up to two orders of magnitude lower overhead than black-box optimization. Conclusion: GLASS enables transparent and efficient runtime self-adaptation by jointly leveraging global and local explanations to optimize adaptation search while preserving effectiveness.