Skip to content
Free planNo credit card requiredStart writing

Search 250 million research papers

Read the abstract, see who wrote it and who cites it, and get the citation in APA, MLA, Chicago or Harvard.

About 127 papers for “clone (Java method)”

A function level Java code clone detection method

Jun Yang, Yu Xiong, Jinxin Ma · 2019

In this article, we mainly propose a method of function level code clone detection for Java language. The method includes a source code preprocessing strategy which unifies some Java grammatical features such as lambda expressions, anonymous classes and generics through code preprocessing. After the source code is preprocessed, the function extraction is performed to get all functions from source code, and then a filtering mechanism is carried out to filter out the useless comparing pairs with large difference in sequence length. Finally, we combine the longest common subsequence algorithm and the suffix array algorithm to perform the similarity calculation according to the size of the function. The experimental results in twenty open source software show that our method improves both accuracy and efficiency.

Cited by 2

SJBCD: A Java Code Clone Detection Method Based on Bytecode Using Siamese Neural Network

Bangrui Wan, Shuang Dong, Jianjun Zhou et al. · Applied Sciences · 2023

Code clone detection is an important research topic in the field of software engineering. It is significant in developing software and solving software infringement disputes to discover code clone phenomenon effectively in and between software systems. In practical engineering applications, clone detection can usually only be performed on the compiled code due to the unavailability of the source code. Additionally, there is room for improvement in the detection effect of existing methods based on bytecode. Based on the above reasons, this paper proposes a novel code clone detection method for Java bytecode: SJBCD. SJBCD extracts opcode sequences from byte code files, use GloVe to vectorize opcodes, and builds a Siamese neural network based on GRU to perform supervised training. Then the trained network is used to detect code clones. In order to prove the effectiveness of SJBCD, this paper conducts validation experiments using the BigCloneBench dataset and provides a comparative analysis with four other methods. Experimental results show the effectiveness of the SJBCD method.

Cited by 10Open access

Detection of redundant clone relations based on clone subsumption

Ettore Merlo, Thierry Lavoie · PolyPublie (École Polytechnique de Montréal) · 2009

ABSTRACT: Clone detection has been presented in the literature at different levels of fragment granularity from functions, to syntactic blocks, to variable length strings of source code or tokens. String matching approaches, prefix and suffix trees, metrics, syntactic approaches and others can be used to compare fragments for similarity. Inclusion relations between source code lines may cause some clone relations to be redundant, when clones code fragments subsume each other. This may occur between nested blocks of source code, for example. An original method to analyze this kind of redundancy in clone relations is presented. The proposed method is based on efficiently combining clone subsumption information together with clone similarity relations on code fragments. The amount of redundancy in clone relations has been evaluated on two open source Java systems, Tomcat and Eclipse. Experimental results are presented. Execution time performance of redundancy analysis is measured and reported. Results are discussed together with further proposed research.

Cited by 0Open access

Clone detection through process algebras and Java bytecode

Antonella Santone · 2011

In this paper we present a formal method-based approach in detecting source code clones by means of analysing and comparing the Java Bytecode that is produced when the source code is compiled. A preliminary investigation has been also conducted to assess the validity of the proposed approach.

Cited by 34

Code Clone Refactoring in C# with Lambda Expressions

Takuto Kawamoto, Yoshiki Higo · arXiv (Cornell University) · 2025

"Extract Method" refactoring is a technique for consolidating code clones. Parameterization approaches are used to extract a single method from multiple code clones that contain differences. This approach parameterizes expressions and behaviors within a method. In particular, behavior parameterization has been extensively studied in Java programs, but little research has been conducted on other programming languages. Lambda expressions can be used to parameterize behaviors, but the specifications of each programming language significantly affect the applicability of this technique. Therefore, the optimal "Extract Method" approach may vary depending on the programming language. In this study, we propose a C#-specific technique that uses lambda expressions to analyze and consolidate code clones. We evaluated our proposed method by applying it to code clones detected by the NiCad clone detector and measuring how many of them could be successfully consolidated. In total, 2,217 clone pairs from 22 projects were included in our evaluation. For the clone pairs determined to be refactorable, we also attempted refactoring actually. The proposed approach determined that 35.0% of all clone pairs were suitable for refactoring. Among these, 28.9% were successfully refactored.

Cited by 0Open access

Code Clone Refactoring in C# with Lambda Expressions

Takuto Kawamoto, Yoshiki Higo · ArXiv.org · 2025

"Extract Method" refactoring is a technique for consolidating code clones. Parameterization approaches are used to extract a single method from multiple code clones that contain differences. This approach parameterizes expressions and behaviors within a method. In particular, behavior parameterization has been extensively studied in Java programs, but little research has been conducted on other programming languages. Lambda expressions can be used to parameterize behaviors, but the specifications of each programming language significantly affect the applicability of this technique. Therefore, the optimal "Extract Method" approach may vary depending on the programming language. In this study, we propose a C#-specific technique that uses lambda expressions to analyze and consolidate code clones. We evaluated our proposed method by applying it to code clones detected by the NiCad clone detector and measuring how many of them could be successfully consolidated. In total, 2,217 clone pairs from 22 projects were included in our evaluation. For the clone pairs determined to be refactorable, we also attempted refactoring actually. The proposed approach determined that 35.0% of all clone pairs were suitable for refactoring. Among these, 28.9% were successfully refactored.

Cited by 0Open access

Quantifying cross-language code reuse via function-level clone detection

Rong Ying, Yan Zhou · Journal of King Saud University - Computer and Information Sciences · 2025

Code reuse through cloning is common in software development, yet excessive or unchecked cloning can harm maintainability and raise plagiarism concerns. Detecting the proportion of reused (cloned) code in a software project, especially across different programming languages, is a challenging task. This paper defines code reuse proportion detection as measuring how much code in a target program is cloned (identical or similar) from elsewhere. Existing code clone detection techniques perform well in single-language settings but struggle with cross-language clones and do not directly quantify reuse proportion. To address these gaps, we propose a novel cross-language function-level code clone detection approach using a dual embedding Siamese neural network. Our method represents code in Java and Python using a unified abstract syntax structure and semantic embeddings, then uses a Siamese deep network to learn language-agnostic similarities. We also introduce a metric to quantify the clone-based reuse ratio for each function or program. Experiments on three public datasets (including a Java clone benchmark, a Python code clone corpus, and a cross-language Java–Python clone dataset) show that our approach outperforms ten baseline methods, including state-of-the-art and classical clone detectors. Ablation studies confirm the contribution of each component (structural embeddings, cross-language alignment, and contrastive learning) to performance gains. Our model achieves new state-of-the-art accuracy in code clone detection, enabling precise measurement of code reuse. These results demonstrate that the proposed approach can effectively detect cross-language code clones and quantify reuse proportion, benefiting software plagiarism detection and code quality assessment in multi-language projects.

Cited by 0Open access

Adaptive Prefix Filtering for Accurate Code Clone Detection in conjunction with Meta-Learning

Ralhan, Chavi · Data Archiving and Networked Services (DANS) · 2023

This research project has significantly contributed to the advancement of code duplication detection by in-troducing a new testing method and constructing a highly accurate meta-classifier. The evaluation of various architectures and utilization of a diverse dataset enabled the development of a novel and versatile solution for detecting duplicate code in both Java and Python programming languages. This process successfully constructed a novel classifier, demonstrating exceptional accuracy in detecting duplicate code. The algorithm was trained on a dataset comprising 19,988 data points, encompassing code metrics from both Java and Python programming languages. This diverse dataset enabled the model to learn and generalize across multiple language paradigms, enhancing its versatility and effectiveness in code clone detection. The proposed model outperformed the state-of-the-art models, which proves that it is the appropriate choice for constructing a meta-classifier for cloned code detection.

Cited by 0Open access

Adaptive Prefix Filtering for Accurate Code Clone Detection in conjunction with Meta-Learning

Ralhan, Chavi · Data Archiving and Networked Services (DANS) · 2023

This research project has significantly contributed to the advancement of code duplication detection by in-troducing a new testing method and constructing a highly accurate meta-classifier. The evaluation of various architectures and utilization of a diverse dataset enabled the development of a novel and versatile solution for detecting duplicate code in both Java and Python programming languages. This process successfully constructed a novel classifier, demonstrating exceptional accuracy in detecting duplicate code. The algorithm was trained on a dataset comprising 19,988 data points, encompassing code metrics from both Java and Python programming languages. This diverse dataset enabled the model to learn and generalize across multiple language paradigms, enhancing its versatility and effectiveness in code clone detection. The proposed model outperformed the state-of-the-art models, which proves that it is the appropriate choice for constructing a meta-classifier for cloned code detection.

Cited by 0Open access

IDENTIFICATION OF SOFTWARE CLONE FILES USING MACHINE LEARNING

Mediboyina Venkata Swapna · INTERANTIONAL JOURNAL OF SCIENTIFIC RESEARCH IN ENGINEERING AND MANAGEMENT · 2023

One technique to reduce the likelihood of introducing a bug is to identify code clone files. Refactoring, often known as removal, is the process of making software more understandable and maintainable. When additional clones are discovered in software programs, we need a method to help developers with refactored code and to enhance software quality. This method must tell developers which clone files require reworking. To provide developers with recommendations on which files require code refactoring, our research proposes a novel learning technique that automatically extracts features from the identified code clones and trains models to present a novel technique to enhance classification performance by transforming outliers into Unknown clone sets. The Eclipse dataset, which comprises 213 Java software files, was utilized for this project. Support Vector Machine (SVM), Random Forest, Bagging, and K-Nearest Neighbors (KNN) are the algorithms that are employed. We compare these four categorization models and recommend the model with the highest accuracy. Our tool can be developed and applied to reduce system bugs. By recognizing software clone files and eliminating duplication code, our study can enhance clone maintenance. Also, the possibility of bad design for a system, difficulty in a system improvement or modification, and introduction of a new bug can be decreased by identifying and refactoring clones. KEYWORDS: Cloning, Refactoring, Support Vector Machine (SVM), K-Nearest Neighbors (KNN), Decision trees.

Cited by 0Open access

TECCD: A Tree Embedding Approach for Code Clone Detection

Yifei Gao, Zan Wang, Shuang Liu et al. · 2019

Clone detection techniques have been explored for decades. Recently, deep learning techniques has been adopted to improve the code representation capability, and improve the state-of-the-art in code clone detection. These approaches usually require a transformation from AST to binary tree to incorporate syntactical information, which introduces overheads. Moreover, these approaches conduct term-embedding, which requires large training datasets. In this paper, we introduce a tree embedding technique to conduct clone detection. Our approach first conducts tree embedding to obtain a node vector for each intermediate node in the AST, which captures the structure information of ASTs. Then we compose a tree vector from its involving node vectors using a lightweight method. Lastly Euclidean distances between tree vectors are measured to determine code clones. We implement our approach in a tool called TECCD and conduct an evaluation using the BigCloneBench (BCB) and 7 other large scale Java projects. The results show that our approach achieves good accuracy and recall and outperforms existing approaches.

Cited by 31

A method for comparing multiple bacterial community structures from 16S rDNA clone library sequences.

Inae Hur, Jongsik Chun · PubMed · 2004

Culture-independent approaches, based on 16S rDNA sequences, are extensively used in modern microbial ecology. Sequencing of the clone library generated from environmental DNA has advantages over fingerprint-based methods, such as denaturing gradient gel electrophoresis, as it provides precise identification and quantification of the phylotypes present in samples. However, to date, no method exists for comparing multiple bacterial community structures using clone library sequences. In this study, an automated method to achieve this has been developed, by applying pair wise alignment, hierarchical clustering and principle component analysis. The method has been demonstrated to be successful in comparing samples from various environments. The program, named CommCluster, was written in JAVA, and is now freely available, at http://chunlab.snu.ac.kr/commcluster/.

Cited by 35

A Generative AI-Driven Method-Level Semantic Clone Detection Based on the Structural and Semantical Comparison of Methods

Aditi Gupta, Rinkaj Goyal · IEEE Access · 2024

Code fragments with identical or similar functionality are called code clones. This study aims to detect semantic clones in Java-based programs, focusing on the method-level granularity. To accomplish this, our approach extracts and compares both semantical and structural features of Java methods and applies certain heuristics to obtain the final result set. The semantics of a method are often described by its documentation, while its structural details are characterized by its implementation within the code body. However, Java methods may not always be accompanied by descriptive documentation. To address this, we have employed a Generative AI tool named ChatGPT, which has the ability to understand the given code and generate its documentation. To compare the documentation of methods, we have used various corpus-based and knowledge-based information retrieval (IR) techniques. However, for comparing a method’s structural details, we tokenized the method’s body and applied an information retrieval technique called VSM (Vector Space Modelling) on the tokenized body. Additionally, we also extracted and compared certain method-level metrics for this purpose. Further, while doing the semantical comparison of methods, eight IR variants are formed based on the internal processing requirements of different IR techniques. The technique proposed in this paper relies on the textual and metrics-based analysis of Java programs with few parsing requirements, making it lightweight and less computation-intensive. To examine the efficiency of the proposed technique, we have validated it using a semantic clone benchmark. The results show that the proposed technique detects semantic clones with high recall values ranging from 67% to 81% and precision values ranging from 60% to 96% for different IR variants explored in our research.

Cited by 9Open access

Enhancing Parameterization Process with Protected Access Weightage Value in Generic Code Clone Detection Model for Java Applications

Noormaizzattul Akmaliza Abdullah, Mohd Azwan Mohamad Hamza, Al-Fahim Mubarak-Ali et al. · 2025

Generic Code Clone Detection (GCCD) is a tool that implemented distance measure as the method to detect code clones in the Java applications. This tool detects irrespective of code clone type; clone Type-1 (exact clone), clone Type-2 (renamed clone), clone Type-3 (near-mis clone) and clone Type-4 (semantic clone). There are five main processes inside GCCD which are PreProcessing, Transformation, Parameterization, Categorization and Match Detection. These processes enable the code clone detection of all types in Java applications, utilizing Bellon’s benchmark data, which is scales up to 204,000 lines of codes. Previously, an experiment has been focused down to detect code clone Type-3 and clone Type-4 using GCCD is performed. Implementing Chi-square equation in the match detection to detect clone Type-3 and clone Type-4, it facilitated the detection reliability for the two clone types. However, the clone detection result of clone Type-1 and clone Type-2 remain unchanged, causing the clone detection result does not show any significant changes. As a part of the study, the paper proposed an enhancement on the parameterization process by using different weightage value. There are three weightage values involved in the experiment; public weightage value, private weightage value and protected weightage value. Findings from this enhancement indicate that protected weightage value shows the difference and provide the highest code clone detection rate. This experiment adds value of the contribution to the GCCD besides the application of Chi-square in Match Detection process, thus improving the code clone detection in Java applications.

Cited by 0

Language-independent clone detection applied to plagiarism detection

Romain Robbes, Romain Brixtel, Mathieu Fontaine et al. · 2010

Abstract—Clone detection is usually applied in the context of detecting small-to medium scale fragments of duplicated code in large software systems. In this paper, we address the problem of clone detection applied to plagiarism detection in the context of source code assignments done by computer science students. Plagiarism detection comes with a distinct set of constraints to usual clone detection approaches, which influenced the design of the approach we present in this paper. For instance, the source code can be heavily changed at a superficial level (in an attempt to look genuine), yet be functionally very similar. Since assignments turned in by computer science students can be in a variety of languages, we work at the syntactic level and do not consider the source-code semantics. Conse-quently, the approach we propose is endogenous and makes no assumption about the programming language being analysed. It is based on an alignment method using the parallel principle at local resolution (character level) to compute similarities between documents. We tested our framework on hundreds of real source files, involving a wide array of programming languages (Java, C, Python, PHP, Haskell, bash). Our approach allowed us to discover previously undetected frauds, and to empirically evaluate its accuracy and robustness.

Cited by 0

Enhancing generic code clone detection model through protected access modifier rule and weightage

Siti An Nasihah, Mohd Napi · UMP Institutional Repository (Universiti Malaysia Pahang) · 2016

Code clone is a common term used to refer codes that have been repeated multiple times in a program. There are four types of code clone which are type I, type II, type III and type IV. Code clone detection models have been used to detect clones apart from code clone detection approaches by applying the protected access modifier rule and weightage. The major challenge faced in detecting code clone using models is the lack of generality in detecting all clone types. This is due to the use of different code clone detection approaches in the models that represents different representation of the source codes; hence it affecting the type of code clones detected. Based on this weakness, it is essential to propose a code clone detection model that can support different type of code. To overcome this weakness, Generic Code Clone Detection model that consists of five processes which are Pre-processing, Transformation, Parameterization, Categorization or called as pooling and Match Detection process has been proposed. A prototype has been developed to detect all code clone types in Java. The proposed method was evaluated in two case studies comprised of three Java applications. The result shows the Generic Code Clone Model prototype was able to detect Type I, Type II, Type III and Type IV clone pairs. The results imply that the Generic Code Clone Model was able to detect all code clone types in Java applications and the generated Generic Code Clone Model have better visualization of the code clone detection results.

Cited by 0Open access

Finding Code Clones for Refactoring with Clone Metrics : A Case Study of Open Source Software

Eunjong Choi, Norihiro Yoshida, IshioTakashi et al. · OUKA (Osaka University Knowledge Archive) (Osaka University)

A code clone is a code fragment that has identical or similar code fragments to it in the source code. Code clone has been regarded as one of the factors that makes software maintenance more difficult. Therefore, to refactor code clones into one method is promising way to reduce maintenance cost in the future. In our previous study, we proposed a method to extract code clones for refactoring using clone metrics. We had conducted an empirical study on Java application developed by NEC Corporation. It turned out that our proposed method is effective to extract refactoring candidate code clones. In this paper, we show the result of applying our proposed method into open source software systems.

Cited by 5

Short Communication: Abundance and diversity of plant parasitic nematodes associated with BP 308 and BP 42 clones of robusta coffee in Java, Indonesia

MUTALAâ€TMLIAH MUTALAâ€TMLIAH, Siwi Indarti, Nugroho Susetya Putra · Biodiversitas Journal of Biological Diversity · 2018

Mutala’liah, Indarti S, Putra NS. 2018. Abundance and diversity of plant parasitic nematodes associated with BP 308 and BP 42 clones of robusta coffee in Java, Indonesia. Biodiversitas 19: xxxx. Plant parasitic nematodes are an important limiting factor in the productivity of coffee plantations. Clone resistance and soil texture influence the severity of plant infestation by parasitic nematodes. The aim of this research was to determine the diversity of plant parasitic nematodes in two clone of Robusta coffee (BP 308 and BP 42) on soils with different contents of sand. The research was carried out in Malangsari Field (East Java), Getas Field (Central Java) and Candiroto Field (Central Java). Nematodes were extracted from soil samples by the decanting method using a whitehead tray, while roots sample by the funnel spray method with a ‘mistifier’. Differences in diversity of nematode genera between clone and location combinations were analyzed by ANOVA. The results showed that there were five genera associated with Robusta coffee, i.e. Pratylenchus, Helicotylenchus, Radopholus, Rotylenchulus, and Meloidogyne. With clone BP 308 at the Malangsari Field site where soil contained 31.3 % sand, Pratylenchus was the most abundant genus i.e. 6 nematodes/100 mL soil. On the same clone, BP 308, at the Getas Field site where soil contained 26.9 % sand, Meloidogyne was the most abundant i.e. 14.4 nematodes/10 g roots. With clone BP 42 at the Candiroto Field site with 25.5 % sand in the soil, Pratylenchus was highly abundant i.e. 60 nematodes/10 g roots.

Cited by 5Open access

Evaluating few shot and Contrastive learning Methods for Code Clone Detection

Mohamad Khajezade, Fatemeh H. Fard, Mohamed Shehata · arXiv (Cornell University) · 2022

Context: Code Clone Detection (CCD) is a software engineering task that is used for plagiarism detection, code search, and code comprehension. Recently, deep learning-based models have achieved an F1 score (a metric used to assess classifiers) of $\sim$95\% on the CodeXGLUE benchmark. These models require many training data, mainly fine-tuned on Java or C++ datasets. However, no previous study evaluates the generalizability of these models where a limited amount of annotated data is available. Objective: The main objective of this research is to assess the ability of the CCD models as well as few shot learning algorithms for unseen programming problems and new languages (i.e., the model is not trained on these problems/languages). Method: We assess the generalizability of the state of the art models for CCD in few shot settings (i.e., only a few samples are available for fine-tuning) by setting three scenarios: i) unseen problems, ii) unseen languages, iii) combination of new languages and new problems. We choose three datasets of BigCloneBench, POJ-104, and CodeNet and Java, C++, and Ruby languages. Then, we employ Model Agnostic Meta-learning (MAML), where the model learns a meta-learner capable of extracting transferable knowledge from the train set; so that the model can be fine-tuned using a few samples. Finally, we combine contrastive learning with MAML to further study whether it can improve the results of MAML.

Cited by 3Open access

Development and benchmarking of multilingual code clone detector

Wenqing Zhu, Norihiro Yoshida, Toshihiro Kamiya et al. · Journal of Systems and Software · 2024

The diversity of programming languages is growing, making the language extensibility of code clone detectors crucial. However, this is challenging for most existing clone detection detectors because the source code handler needs modifications, which requires specialist-level knowledge of the targeted language and is time-consuming. Multilingual code clone detectors make it easier to add new language support by providing syntax information of the target language only. To address the shortcomings of existing multilingual detectors for language scalability and detection performance, we propose a multilingual code block extraction method based on ANTLR parser generation, and implement a multilingual code clone detector (MSCCD), which supports the most significant number of languages currently available and has the ability to detect Type-3 code clones. We follow the methodology of previous studies to evaluate the detection performance of the Java language. Compared to ten state-of-the-art detectors, MSCCD performs at an average level while it also supports a significantly larger number of languages. Furthermore, we propose the first multilingual syntactic code clone evaluation benchmark based on the CodeNet database. Our results reveal that even when applying the same detection approach, performance can vary markedly depending on the language of the source code under investigation. Overall, MSCCD is the most balanced one among the evaluated tools when considering detection performance and language extensibility.

Cited by 2Open access