Cross-language Clone Detection for Mobile Apps - Jimenez, Stephannie; Rakic, Gordana; Takahashi, Silvia; Cardozo, Nicolás (Anais do Congresso Ibero-Americano em Engenharia de Software (CIbSE); 2023: Anais do XXVI Congresso Ibero-Americano em Engenharia de Software, 2023)
Clone detection provides insight about replicated fragments in a code base. With the rise of multi-language code bases, new techniques addressing cross-language code clone detection enable the analysis of polyglot systems. Such techniques have not yet been applied to the mobile apps’ domain, which are naturally polyglot. Native mobile app developers must synchronize their code base in at least two different programming languages. App synchronization is a difficult and time-consuming maintenance task, as features can rapidly diverge between platforms, and feature identification must be performed manually. Our goal is to provide an analysis framework to reduce the impact of app synchronization. A first step in this direction consists on a structural algorithm for cross-language clone detection exploiting the idea behind enriched concrete syntax trees. Such trees are used as a common intermediate representation built from programming languages’ grammars, to detect similarities between app code bases. Our technique finds code similarities with 79% precision for controlled tests where Type 1-3 clones are manually injected for the analysis of both single- and cross-language cases for Kotlin and Dart. We evaluate our tool on a corpus of 52 mobile apps identifying code similarities with a precision of 65% to 84% for the full application logic.