Lune

FSE2021Top-tier venue

Cross-language code search using static and dynamic analyses

George Mathew, Kathryn T. Stolee

Abstract

As code search permeates most activities in software development, code-to-code search has emerged to support using code as a query and retrieving similar code in the search results. Applications include duplicate code detection for refactoring, patch identification for program repair, and language translation. Existing code-to-code search tools rely on static similarity approaches such as the comparison of tokens and abstract syntax trees (AST) to approximate dynamic behavior, leading to low precision. Most tools do not support cross-language code-to-code search, and those that do, rely on machine learning models that require labeled training data.

We present Code-to-Code Search Across Languages (COSAL), a cross-language technique that uses both static and dynamic analyses to identify similar code and does not require a machine learning model. Code snippets are ranked using non-dominated sorting based on code token similarity, structural similarity, and behavioral similarity. We empirically evaluate COSAL on two datasets of 43,146 Java and Python files and 55,499 Java files and find that 1) code search based on non-dominated ranking of static and dynamic similarity measures is more effective compared to single or weighted measures; and 2) COSAL has better precision and recall compared to state-of-the-art within-language and cross-language code-tocode search tools. We explore the potential for using COSAL on large open-source repositories and discuss scalability to more languages and similarity metrics, providing a gateway for practical, multi-language code-to-code search.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

2 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • CPVis: Evidence-based Multimodal Learning Analytics for Evaluation in Collaborative Programming cites SLACC: simion-based language agnostic code clones
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers2

  1. CPVis: Evidence-based Multimodal Learning Analytics for Evaluation in Collaborative ProgrammingGefei Zhang, Shenming Ji, Yicao Li, Jingwei Tang et al.CHI 2025 · 8 citations
  2. Finding Compiler Bugs through Cross-Language Code Generator and Differential TestingQiong Feng, Xiaotian Ma, Ziyuan Feng, Marat Akhin et al.OOPSLA 2025 · 2 citations

Builds on3

  1. You Get Where You're Looking for: The Impact of Information Sources on Code SecurityYasemin Acar, Michael Backes, Sascha Fahl, Doowon Kim et al.S&P 2016 · 325 citations
  2. InferCode: Self-Supervised Learning of Code Representations by Predicting SubtreesNghi D. Q. Bui, Yijun Yu, Lingxiao JiangICSE 2021 · 106 citations
  3. SLACC: simion-based language agnostic code clonesGeorge Mathew, Chris Parnin, Kathryn T. StoleeICSE 2020 · 21 citations

Related papers

  1. Zero-Shot Cross-Domain Code Search without Fine-TuningKeyu Liang, Zhongxin Liu, Chao Liu, Zhiyuan Wan et al.FSE 2025 · 2 citations
  2. Accelerating Code Search with Deep Hashing and Code ClassificationWenchao Gu, Yanlin Wang, Lun Du, Hongyu Zhang et al.ACL 2022
  3. Multilingual Code Co-evolution using Large Language ModelsJiyang Zhang, Pengyu Nie, Junyi Jessy Li, Milos GligoricFSE 2023 · 34 citations
  4. Disentangled Code Representation Learning for Multiple Programming LanguagesJingfeng Zhang, Haiwen Hong, Yin Zhang, Yao Wan et al.ACL Findings 2021 · 16 citations
  5. CoCoSoDa: Effective Contrastive Learning for Code SearchEnsheng Shi, Yanlin Wang, Wenchao Gu, Lun Du et al.ICSE 2023 · 45 citations
Dusk over the sea between two cliffs drawn in fine vertical lines