Skip to content

Commit

Permalink
ASTDiff: Fixes #846
Browse files Browse the repository at this point in the history
  • Loading branch information
pouryafard75 authored and tsantalis committed Jan 6, 2025
1 parent f2edbd0 commit 87a5fee
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,12 @@ private void processFieldDeclaration(Tree srcTree, Tree dstTree, UMLAttribute sr
new JavaDocMatcher(optimizationData, srcUMLAttribute.getJavadoc(), dstUMLAttribute.getJavadoc(), umlJavadocDiff)
.match(srcTree, dstTree, mappingStore);
if (srcVarDeclaration != null && dstVarDeclaration != null)
mappingStore.addMapping(srcVarDeclaration.getChild(0),dstVarDeclaration.getChild(0));
if (!srcVarDeclaration.getChildren().isEmpty() && !dstVarDeclaration.getChildren().isEmpty())
mappingStore.addMapping(srcVarDeclaration.getChild(0),dstVarDeclaration.getChild(0));
}

private void matchFieldAllModifiers(Tree srcFieldDeclaration, Tree dstFieldDeclaration, UMLAttribute srcUMLAttribute, UMLAttribute dstUMLAttribute, ExtendedMultiMappingStore mappingStore) {
if (srcFieldDeclaration == null || dstFieldDeclaration == null) return;
matchModifiersForField(srcFieldDeclaration,dstFieldDeclaration,srcUMLAttribute.getVisibility().toString(),dstUMLAttribute.getVisibility().toString(),mappingStore);
if (srcUMLAttribute.isFinal() && dstUMLAttribute.isFinal())
matchModifierForField(srcFieldDeclaration,dstFieldDeclaration,Constants.FINAL,mappingStore);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,10 @@ public static boolean isFromType(Tree t1, String type) {
return t1.getType().name.equals(type);
}

public static Tree findFirstByType(Tree srcFieldDeclaration, String typeName) {
public static Tree findFirstByType(Tree inputTree, String typeName) {
if (inputTree == null) return null;
Tree fieldAnnotation = null;
for (Tree child : srcFieldDeclaration.getChildren()) {
for (Tree child : inputTree.getChildren()) {
if (isFromType(child, typeName)) {
fieldAnnotation = child;
break;
Expand Down

0 comments on commit 87a5fee

Please sign in to comment.