Skip to content

Commit

Permalink
ASTDiff: Fix JavaDocMatcher (TagName)
Browse files Browse the repository at this point in the history
  • Loading branch information
pouryafard75 authored and tsantalis committed Dec 5, 2024
1 parent 7936d80 commit e255f3f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

import java.util.Optional;

import static org.refactoringminer.astDiff.utils.TreeUtilFunctions.areBothFromThisType;
import static org.refactoringminer.astDiff.utils.TreeUtilFunctions.isFromType;
import static org.refactoringminer.astDiff.utils.TreeUtilFunctions.*;

/* Created by pourya on 2024-05-22*/
public class JavaDocMatcher extends OptimizationAwareMatcher implements TreeMatcher {
Expand Down Expand Up @@ -93,8 +92,14 @@ private void processJavaDocs(Tree srcTree, Tree dstTree, UMLJavadoc srcUMLJavaDo
{
if (srcTag.isIsoStructuralTo(dstTag))
optimizationData.getSubtreeMappings().addMappingRecursively(srcTag,dstTag);
else
optimizationData.getSubtreeMappings().addMapping(srcTag,dstTag);
else {
optimizationData.getSubtreeMappings().addMapping(srcTag, dstTag);
Tree srcTagName = findFirstByType(srcTag, Constants.TAG_NAME);
Tree dstTagName = findFirstByType(dstTag, Constants.TAG_NAME);
if (srcTagName != null && dstTagName != null)
if (srcTagName.isIsoStructuralTo(dstTagName))
optimizationData.getSubtreeMappings().addMapping(srcTagName, dstTagName);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public class Constants {
public static final String JAVA_DOC = "Javadoc";
public static final String TEXT_ELEMENT = "TextElement";
public static final String TAG_ELEMENT = "TagElement";
public static final String TAG_NAME = "TAG_NAME";

public static final String SIMPLE_TYPE = "SimpleType";
public static final String EXPRESSION_METHOD_REFERENCE = "ExpressionMethodReference";
Expand All @@ -92,4 +93,5 @@ public class Constants {

public static final String LINE_COMMENT = "LineComment";
public static final String BLOCK_COMMENT = "BlockComment";

}

0 comments on commit e255f3f

Please sign in to comment.