Improving code merging accuracy with transformations and member identity - Teles, André Duarte Rocha (2023)
Conventionally, merging code files is performed in an unstructured manner, using generic linebased merging algorithms (e.g., diff3) that are unaware of the syntax and semantics of the programming language in which the merged code is written, resulting in several conflicts that could be avoided. Structured and semistructured merging techniques take into consideration the programming language syntax and are capable of merging processes that lead to fewer conflicts. However, there are still issues to be solved regarding false positives (conflicts that could be avoided, e.g., member signature changes) and false negatives (conflicts that go undetected resulting in noncompilable code). This dissertation presents a merging technique that combines semistructured and transformationbased strategies, where conflict detection is aware of syntactic and semantic aspects of the programming language. We developed Jaid, a prototype merging tool for Java based on the assumption that code structural elements evolve with “attached” UUIDs (identity). While this has drawbacks and may require dedicated code editors for good usability, it has the advantage of allowing merging processes to detect with precision renaming, moving, and referencing of code elements, and in turn, avoid both false positives and false negatives. Jaid takes into account syntactic and semantic aspects to apply a merge process based on transformations, having the key difference from previous approaches of relying on identity to locate and reference code elements. We performed an experiment with 100 merge scenarios from three open-source projects to test the technique and assess its feasibility in practice.