diff --git a/core/src/main/java/com/github/gumtreediff/matchers/optimizations/LeafMoveMatcherThetaE.java b/core/src/main/java/com/github/gumtreediff/matchers/optimizations/LeafMoveMatcherThetaE.java index 0fef34c25..e1971cd61 100644 --- a/core/src/main/java/com/github/gumtreediff/matchers/optimizations/LeafMoveMatcherThetaE.java +++ b/core/src/main/java/com/github/gumtreediff/matchers/optimizations/LeafMoveMatcherThetaE.java @@ -194,6 +194,12 @@ private void reevaluateLeaves(Tree firstParent, Tree secondParent, Mapping pair, for (Tree child : firstParent.getChildren()) { if (child.isLeaf() && !mappings.isDstMapped(child) && child.getType() == pair.second.getType() && child.getLabel().equals(pair.second.getLabel())) { + Tree dstForSrc = mappings.getDstForSrc(child); + if (dstForSrc != null) + mappings.removeMapping(child, dstForSrc); + Tree srcForDst = mappings.getSrcForDst(pair.second); + if (srcForDst != null) + mappings.removeMapping(srcForDst, pair.second); mappings.addMapping(child, pair.second); break; }