A generic code clone detection model with match detection and parameterization process for java applications
Noormaizzattul Akmaliza Binti Abdullah
- xv, 130 pages : illustrations (some color) ; 30 cm. + 1 CD-ROM
Faculty of Computing
Thesis (Master of Science) -- Universiti Malaysia Pahang – 2024
Includes bibliographical references
Code cloning is an activity of duplicating a code via copy and paste with no or slight modifications into another fragment code recurrently in a program. Four code clone types are identified in the code clone domain which are Type-1, Type-2, Type-3 and Type-4. Code clone detection approaches and tools have been found to reduce code cloning in a program. The development of a code clone model increases the detection certainty as it solves the lack of generality in detection approaches and tools. Code clone detection for each clone type has been restricted due to different intermediate source representations. The Generic Code Clone Detection (GCCD) model was designed to detect all clones in Java applications. This tool was developed with five main processes namely preprocessing, transformation, parameterization, categorization and match detection process. Nonetheless, based on the result from the GCCD prototype, it was identified that GCCD was unable to detect a large number of clones in comparison to existing code clone detection tools such as CLAN, NiCad, and CloneManager. Specifically, GCCD depicted unstable results of overall total clone pairs and total clone pairs based on clone types detected in four Java applications compared to existing code clone detection tools. Therefore, this research proposes three experiments to enhance the detection result of GCCD. These experiments are in line with the objectives of this research. The first experiment is to enhance the match detection process of GCCD using Chi-Square distance. This experiment tested out the GCCD prototype with different distance measure formulae to explore the suitability of the distance measure formula. Chi-Square managed to detect the highest overall total clone pairs and total clone pairs based on clone types compared to other distance measures. Next, the second experiment was an enhancement on the parameterization process of GCCD using the protected access modifier weightage value as the constant parameter. This experiment was performed after the first experiment with a Java access modifier to find a feasible constant parameter. Based on the second experiment, protected access as a constant value managed to detect the highest overall total clone pairs and total clone pairs based on clone types. Although there was a slight difference in detection rate in one of the tested Java applications, protected weightage remained as the highest clone rate recorded among other Java access modifiers. The third experiment was a comparative analysis performed together with existing code clone detection tools and the novel GCCD to validate the enhanced GCCD. Generally, the findings of this experiment showed that the enhanced GCCD depicted an inconstant higher total clone pair and overall total clone pairs. Other code clone detection tools achieved superior clone detection performance, which is primarily attributed to their distinct intermediate representation and detection approach, necessitating tool-specific detection procedures that allowed the code clone detection results to be varied. Nonetheless, this improved GCCD contributes to GCCD’s performance, adding to the current literature in constructing a code clone detection model. The dataset for this research was based on Java applications from Bellon’s benchmark data, with the size of largest Java application being 204,000 lines of code and 538 source files. Meanwhile, the smallest Java application had 19,000 lines of code as well as 101 source files. In conclusion, the detection result from the enhanced GCCD recorded a higher detection result for overall total clone pairs and clone pairs based on clone types and overcame the weakness of the state-of-art GCCD by achieving successful experiments
THE0009918 (Local)
Faculty of Computing--Dissertations
Universities and colleges--Dissertations Theses--Dissertations