From d50d439b5c5c32861f483cea1bc31f9eb1ae49f1 Mon Sep 17 00:00:00 2001 From: Pouryafard75 Date: Sat, 9 Aug 2025 02:06:33 -0400 Subject: [PATCH] Fix LeafMoveMatcherThetaE --- .../matchers/optimizations/LeafMoveMatcherThetaE.java | 6 ++++++ 1 file changed, 6 insertions(+) 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; }