Empir Software Eng
https://doi.org/10.1007/s10664-017-9586-1
Understanding semi-structured merge conflict
characteristics in open-source Java projects
Paola Accioly
1
· Paulo Borba
1
·
Guilherme Cavalcanti
1
© Springer Science+Business Media, LLC, part of Springer Nature 2017
Abstract Empirical studies show that merge conflicts frequently occur, impairing develop-
ers’ productivity, since merging conflicting contributions might be a demanding and tedious
task. However, the structure of changes that lead to conflicts has not been studied yet.
Understanding the underlying structure of conflicts, and the involved syntactic language
elements might shed light on how to better avoid merge conflicts. To this end, in this paper
we derive a catalog of conflict patterns expressed in terms of the structure of code changes
that lead to merge conflicts. We focus on conflicts reported by a semi-structured merge tool
that exploits knowledge about the underlying syntax of the artifacts. This way, we avoid
analyzing a large number of spurious conflicts often reported by typical line based merge
tools. To assess the occurrence of such patterns in different systems, we conduct an empiri-
cal study reproducing 70,047 merges from 123 GitHub Java projects. Our results show that
most semi-structured merge conflicts in our sample happen because developers indepen-
dently edit the same or consecutive lines of the same method. However, the probability of
creating a merge conflict is approximately the same when editing methods, class fields, and
modifier lists. Furthermore, we noticed that most part of conflicting merge scenarios, and
merge conflicts, involve more than two developers. Also, that copying and pasting pieces
of code, or even entire files, across different repositories is a common practice and cause of
conflicts. Finally, we discuss how our results reveal the need for new research studies and
suggest potential improvements to tools supporting collaborative software development.
Communicated by: Romain Robbes
Paola Accioly
prga@cin.ufpe.br
Paulo Borba
phmb@cin.ufpe.br
Guilherme Cavalcanti
gjcc@cin.ufpe.br
1
Informatics Center, Federal University of Pernambuco, Recife, Brazil