Skip to content

Commit

Permalink
Fix for annotations within changed attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
pouryafard75 committed Apr 16, 2024
1 parent 8e7344e commit 5487ef2
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ private void processFieldDeclaration(Tree srcTree, Tree dstTree, UMLAttribute sr

mappingStore.addMapping(srcFieldDeclaration,dstFieldDeclaration);
matchFieldAllModifiers(srcFieldDeclaration,dstFieldDeclaration,srcUMLAttribute,dstUMLAttribute,mappingStore);
matchFieldAnnotations(srcFieldDeclaration, dstFieldDeclaration, mappingStore);
if (srcUMLAttribute.getType().getLocationInfo() == null || dstUMLAttribute.getType().getLocationInfo() == null) {
if (srcUMLAttribute instanceof UMLEnumConstant && dstUMLAttribute instanceof UMLEnumConstant) {
//JavaDocs are mapped as well.
Expand All @@ -1100,6 +1101,23 @@ private void processFieldDeclaration(Tree srcTree, Tree dstTree, UMLAttribute sr
mappingStore.addMapping(srcVarDeclaration.getChild(0),dstVarDeclaration.getChild(0));
}

private void matchFieldAnnotations(Tree srcFieldDeclaration, Tree dstFieldDeclaration, ExtendedMultiMappingStore mappingStore) {
Tree srcField = findFirstByType(srcFieldDeclaration, Constants.MARKER_ANNOTATION);
Tree dstField = findFirstByType(dstFieldDeclaration, Constants.MARKER_ANNOTATION);
new LeafMatcher().match(srcField, dstField, mappingStore);
}

private static Tree findFirstByType(Tree srcFieldDeclaration, String typeName) {
Tree fieldAnnotation = null;
for (Tree child : srcFieldDeclaration.getChildren()) {
if (child.getType().name.equals(typeName)) {
fieldAnnotation = child;
break;
}
}
return fieldAnnotation;
}

private void matchFieldAllModifiers(Tree srcFieldDeclaration, Tree dstFieldDeclaration, UMLAttribute srcUMLAttribute, UMLAttribute dstUMLAttribute, ExtendedMultiMappingStore mappingStore) {
//Pair<Tree, Tree> attributeAccessModifierPair = findAttributeAccessModifierPair(srcFieldDeclaration, dstFieldDeclaration, srcUMLAttribute, dstUMLAttribute);
//if (attributeAccessModifierPair.first != null && attributeAccessModifierPair.second != null)
Expand Down

0 comments on commit 5487ef2

Please sign in to comment.