Abstract
Code cloning is one of the most popular code reusing techniques where similar pieces of code are replicated within or between code repositories. Interface similarity is a kind of replication that refers to the similarity of method names, return types and parameter types which repeat across the code repositories. Two methods with similar interfaces are prone to be cloned if those perform analogous functions either entirely or at least partially. An exploratory study is performed in this paper, to explore the relationship and effects of interface similarity in code clones. It is investigated that interface similarity can be helpful for code clone detection. First, clone methods are detected in code repositories. Then, interface information is extracted from source code and several interface similarities are measured using that information. The experimental corpus contains three different types of code repositories with 35, 109 and 24,558 Java projects respectively. The detected clone pairs in three code repositories are, on average 57,457, 102,745 and 123,576 respectively. Promising results are found as it shows on average 87.91% intra-project and 59.17% inter-project clones contain similar interfaces (i.e., return types and at least one keyword and one parameter type are similar). Besides, the average similarity of interfaces in Type-1, Type-2 and Type-3 clones are 100%, 83.47% and 81.90% respectively. These results prove the strong relationship between code clones and interface similarities. In future, it can be useful to design and develop interface driven clone detection tools.
Talk to us
Join us for a 30 min session where you can share your feedback and ask us any queries you have