Enhancing Software Maintenance: A Learning to Rank Approach for Co-changed Method Identification
Yiping Jia, Safwat Hassan, Ying Zou · ACM Transactions on Software Engineering and Methodology · 2026
With the growing complexity of large-scale software systems, it is challenging to accurately identify all the needed modifications to implement a specific change. Co-changed methods in software engineering refer to methods that frequently change together over time. They are often considered to be closely related, as changes made to one method may also impact the other one. Identifying the co-change relationships between methods can help development teams better understand and maintain their systems (e.g., accurately identifying all needed modifications to implement a specific change). Prior work faces several limitations in identifying co-changed methods, e.g., generating large result sets with high false positive rates. Focusing on the pull request (PR) level, rather than individual commits, offers a more comprehensive view of related changes that may span multiple commits, capturing essential co-change relationships. To address the limitations of existing methods, we propose a learning-to-rank (LtR) approach that combines source code characteristics with code change history to predict and rank likely co-changes at the PR level. Our extensive experiments, conducted on 150 open-source Java projects totaling 41.5 million lines of code and 634,216 pull requests, show that the Random Forest (RF) model outperforms other LtR models by 2.5%–12.8% in Normalized Discounted Cumulative Gain (NDCG@5). It also surpasses baseline methods—including support ranking, file proximity, code clone detection, FCP2Vec, and the StarCoder 2 model—by 4.7%–573.5% in NDCG@5. Models trained on longer historical data (90–180 days) deliver more consistent performance, while prediction accuracy begins to decline after 60 days, suggesting a need for bi-monthly retraining. This approach offers a practical tool for software teams to prioritize co-changed methods, enhancing their ability to manage complex dependencies and maintain software quality.