Skip to content

Commit

Permalink
More accurate instanceAttributeMovedAlongWithMethod() rule
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Jan 11, 2025
1 parent 0bff4ae commit 7e7315f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -1793,7 +1793,7 @@ private boolean instanceAttributeMovedAlongWithMethod(UMLAttribute addedAttribut
UMLClassBaseDiff targetClassDiff = getUMLClassDiff(addedAttribute.getClassName());
if(sourceClassDiff != null) {
for(UMLAttribute attribute : sourceClassDiff.getNextClass().getAttributes()) {
if(attribute.getType() != null && addedAttribute.getClassName().endsWith(attribute.getType().getClassType())) {
if(attribute.getType() != null && addedAttribute.getClassName().endsWith("." + attribute.getType().getClassType())) {
return true;
}
if(targetClassDiff != null) {
Expand All @@ -1802,12 +1802,18 @@ private boolean instanceAttributeMovedAlongWithMethod(UMLAttribute addedAttribut
return true;
}
}
UMLType superclassType = targetClassDiff.getNextClass().getSuperclass();
if(superclassType != null) {
if(attribute.getType().equals(superclassType)) {
return true;
}
}
}
}
}
if(targetClassDiff != null) {
for(UMLAttribute attribute : targetClassDiff.getRemovedAttributes()) {
if(attribute.getType() != null && removedAttribute.getClassName().endsWith(attribute.getType().getClassType())) {
if(attribute.getType() != null && removedAttribute.getClassName().endsWith("." + attribute.getType().getClassType())) {
return true;
}
}
Expand Down

0 comments on commit 7e7315f

Please sign in to comment.