arXiv:2608.28111cs.SEAug 2026

Manuscript Offprint

arXiv:2608.28111

CC4M: Code Clone Analysis and Visualization for Microservices

Gen Kawamata, Yuki Ota, Norihiro Yoshida, Shiyu Yang, Erina Makihara, Katsuro Inoue

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Gen Kawamata, Yuki Ota, Norihiro Yoshida, Shiyu Yang, Erina Makihara, Katsuro Inoue

Ritsumeikan University

Osaka, Japan

{is0665sp, is0607ih}@ed.ritsumei.ac.jp, {norihiro, yangsy, makihara, inoue-k}@fc.ritsumei.ac.jp

Abstract—Microservice architecture supports software evolution by decomposing a system into small, loosely coupled services that can be deployed independently. Contrary to the expectation of high modularity, prior studies have reported that code clones exist across service boundaries, some of which are co-modified in the same version. Such clones may require changes to be propagated across service boundaries, thereby undermining service independence and increasing maintenance costs. However, existing tools do not support microservice-aware clone analysis. We present CC4M, a microservice-aware clone analysis and visualization tool. CC4M detects and enriches clone pairs with service-boundary, co-modification, file-category, and metric information. The enriched clones are visualized in an interactive scatter plot with explicit service boundaries, supporting metric-based filtering to prioritize clones with potentially higher maintenance impact. Using an open-source microservice application, we illustrate how CC4M helps identify the potential impact scope of code changes. A demo video and the tool are available at https://www.youtube.com/watch?v=0xOIQPFbkUg and https://doi.org/10.5281/zenodo.21204195, respectively.

Index Terms—microservices, code clone, visualization

I. INTRODUCTION

Microservice architecture decomposes a software system into small, loosely coupled, and independently deployable services. It has been widely adopted in open-source and industrial projects to support software evolution through modularity and technology heterogeneity [1]-[3].

Because microservices emphasize modularity and service independence, one might expect clones across service boundaries to be limited. However, Mo et al. reported that code clones exist across microservices in open-source microservice projects, and showed that clones are co-modified across service boundaries between consecutive releases [4]. Here, code clones are identical or similar code fragments [5]; a clone pair is a pair of such fragments, and a clone set is a set of mutually similar fragments. Co-modification refers to the case in which the code fragments constituting a clone pair are modified together in the project's revision history. Following prior work [4], we classify clone pairs in microservice systems based on service boundaries. A clone pair is called a within-service clone pair when both fragments belong to the same service, and a cross-service clone pair when the two fragments belong to different services [4]. In subsequent work, Zhao et al. analyzed cross-service clones based on file categories and showed that the distribution and underlying causes of clones differ across categories [6].

These findings indicate that cross-service clones exist, are co-modified, and concentrate in specific file categories, suggesting that such clones may propagate changes across service boundaries and undermine service independence. However, existing clone detection and visualization tools [7]–[9] organize clone information by file system or program structure (e.g., directories, files, and classes) rather than by service boundaries. In particular, they lack two capabilities: (i) service-boundary awareness, so within-service and cross-service clone pairs are not distinguished and the scope of change impact is unclear; and (ii) co-modification awareness, so historical change coupling is not integrated, hindering the identification of clones that affect maintainability.

To address these limitations, we introduce CC4M, a tool for detecting and visualizing code clones in microservice systems. It detects Type-2 clones with CCFinderSW, a code clone detector that supports multiple programming languages [10], and identifies service boundaries with CLAIM [11]. CC4M then enriches each clone pair with service boundary, co-modification, and file-category information, the last of which is inspired by the file-level analysis of Zhao et al. [6]. Based on the enriched information, CC4M computes clone metrics, such as service span and co-modification frequency. The enriched clone pairs are visualized through three views: a Statistics View that summarizes project-wide clone statistics, an interactive Scatter Plot with explicit service boundaries, and a Metric View for metric-based prioritization and drill-down across services, clone sets, and files.

The contributions of this paper are as follows. First, we present CC4M, a microservice-aware clone analysis tool that enriches clone pairs with service-boundary, co-modification, and file-category information. Second, we introduce clone metrics, such as service span and co-modification frequency, to quantify the impact scope and change coupling across service boundaries. Third, we provide a scatter plot with explicit service boundaries and a Metric View for metric-based prioritization and drill-down.