A Two-stage Approach for Structurally-similar Cross-language Code-pair Detection
Feng Dai, Shigeru Chiba · 2025
A fast and reliable tool to detect structurally-similar cross-language code pairs is crucial when maintaining large projects across different programming languages. In this paper, we present a new tool1 for detecting such code pairs by adopting a two-stage approach. Our approach first uses models trained on two-level generic ASTs to filter candidates, and uses tree-based editing-distance algorithm for accurate comparison. We create a new cross-language dataset, including Java-Python, Java-C, Python-C structurally-similar method body pairs, and evaluate our approach on this dataset. We manage to obtain a much faster speed and similar detection accuracy in detecting structurally-similar cross-language code pairs compared with the state-of-the-art technique.