ABSTRACT Software defect prediction identifies high‐risk code early, reducing development costs and improving software quality. Early studies primarily relied on handcrafted features, which struggled to capture semantic differences and structural information within programs. Later research fused semantic features extracted from abstract syntax trees (ASTs) or graph structures with handcrafted features, improving prediction performance. However, existing fusion methods still face challenges such as insufficient deep semantic mining, inadequate global dependency capture, and weak cross‐project generalization. To address these limitations, this paper proposes DP‐GCN, a defect prediction model integrating GraphCodeBERT, graph convolutional network (GCN), and contrastive learning. Specifically, GraphCodeBERT extracts semantic and structural code representations, GCN captures global dependencies among code elements, and contrastive learning optimizes the feature space distribution to enhance discriminability. The optimized deep features are then fused with handcrafted features and fed into a logistic regression classifier for defect prediction. Experiments on 10 projects from the PROMISE dataset show that DP‐GCN outperforms existing methods in both within‐project and cross‐project scenarios, validating its effectiveness and the synergistic advantages of the three integrated techniques.
Liu et al. (Wed,) studied this question.