Table of Contents
Fetching ...

Enhancing Software Maintenance: A Learning to Rank Approach for Co-changed Method Identification

Yiping Jia, Safwat Hassan, Ying Zou

TL;DR

The paper tackles the challenge of identifying co-change relationships by ranking co-changed methods at the pull-request level. It introduces a learning-to-rank (LtR) approach that fuses history-derived signals with static code features, evaluated on 150 open-source Java projects; Random Forest emerged as the strongest model, outperforming baselines by up to $537.5\%$ in $NDCG@5$ and requiring bi-monthly retraining for sustained performance. Ten features (historical, semantic, structural, and clone signals) are collected and refined via correlation analysis, with permutation importance showing that the frequency of past co-changes is the dominant predictor. The approach demonstrates robust performance across varying project characteristics and provides practical guidance on data-historical windows and retraining cadence for real-world deployment. Overall, this work advances software maintenance by enabling more accurate, scalable identification of co-changed methods to better manage dependencies and maintain quality across evolving codebases.

Abstract

With the increasing complexity of large-scale software systems, identifying all necessary modifications for a specific change is challenging. Co-changed methods, which are methods frequently modified together, are crucial for understanding software dependencies. However, existing methods often produce large results with high false positives. Focusing on pull requests instead of individual commits provides a more comprehensive view of related changes, capturing essential co-change relationships. To address these challenges, we propose a learning-to-rank approach that combines source code features and change history to predict and rank co-changed methods at the pull-request level. Experiments on 150 open-source Java projects, totaling 41.5 million lines of code and 634,216 pull requests, show that the Random Forest model outperforms other models by 2.5 to 12.8 percent in NDCG@5. It also surpasses baselines such as file proximity, code clones, FCP2Vec, and StarCoder 2 by 4.7 to 537.5 percent. Models trained on longer historical data (90 to 180 days) perform consistently, while accuracy declines after 60 days, highlighting the need for bi-monthly retraining. This approach provides an effective tool for managing co-changed methods, enabling development teams to handle dependencies and maintain software quality.

Enhancing Software Maintenance: A Learning to Rank Approach for Co-changed Method Identification

TL;DR

The paper tackles the challenge of identifying co-change relationships by ranking co-changed methods at the pull-request level. It introduces a learning-to-rank (LtR) approach that fuses history-derived signals with static code features, evaluated on 150 open-source Java projects; Random Forest emerged as the strongest model, outperforming baselines by up to in and requiring bi-monthly retraining for sustained performance. Ten features (historical, semantic, structural, and clone signals) are collected and refined via correlation analysis, with permutation importance showing that the frequency of past co-changes is the dominant predictor. The approach demonstrates robust performance across varying project characteristics and provides practical guidance on data-historical windows and retraining cadence for real-world deployment. Overall, this work advances software maintenance by enabling more accurate, scalable identification of co-changed methods to better manage dependencies and maintain quality across evolving codebases.

Abstract

With the increasing complexity of large-scale software systems, identifying all necessary modifications for a specific change is challenging. Co-changed methods, which are methods frequently modified together, are crucial for understanding software dependencies. However, existing methods often produce large results with high false positives. Focusing on pull requests instead of individual commits provides a more comprehensive view of related changes, capturing essential co-change relationships. To address these challenges, we propose a learning-to-rank approach that combines source code features and change history to predict and rank co-changed methods at the pull-request level. Experiments on 150 open-source Java projects, totaling 41.5 million lines of code and 634,216 pull requests, show that the Random Forest model outperforms other models by 2.5 to 12.8 percent in NDCG@5. It also surpasses baselines such as file proximity, code clones, FCP2Vec, and StarCoder 2 by 4.7 to 537.5 percent. Models trained on longer historical data (90 to 180 days) perform consistently, while accuracy declines after 60 days, highlighting the need for bi-monthly retraining. This approach provides an effective tool for managing co-changed methods, enabling development teams to handle dependencies and maintain software quality.

Paper Structure

This paper contains 33 sections, 3 equations, 6 figures, 6 tables, 1 algorithm.

Figures (6)

  • Figure 1: An example of the co-change relationship between the method 'execute' in class 'CustomShenyuPlugins' and the method 'doFilter' in class 'FallbackFilter' in the 'Shenyu' project.
  • Figure 2: An overview of the proposed approach.
  • Figure 3: Overview of the data creation pipeline for co-change prediction. This figure illustrates the pipeline for dataset creation as described in Algorithm \ref{['alg:dataset']}. The pipeline consists of two main periods: the feature collection period (from $t_s$ to $t_d$) and the labelling period (from $t_d$ to $t_e$). During the feature collection period, historical process and static features are extracted for all method pairs in the repository up to $t_d$. In the labelling period, co-change occurrences between method pairs are calculated as labels.
  • Figure 4: The performance of the RF model grouped by different characteristics of the studied projects.
  • Figure 5: Example Prompt and Prediction for StarCoder2
  • ...and 1 more figures