Skip to content

Commit

Permalink
Correct Extract Interface reporting in case of multiple source folders
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 29, 2024
1 parent c457b84 commit 0bca5a9
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -2238,8 +2238,29 @@ private List<ExtractSuperclassRefactoring> identifyExtractSuperclassRefactorings
processAddedGeneralization(addedClass, subclassSetBefore, subclassSetAfter, addedGeneralization);
}
}
Map<String, Integer> nonConflictingSourceFolders = new LinkedHashMap<String, Integer>();
Map<String, Integer> conflictingSourceFolders = new LinkedHashMap<String, Integer>();
for(UMLRealization addedRealization : addedRealizations) {
String supplier = addedRealization.getSupplier();
if(addedClass.getLocationInfo().getSourceFolder().equals(addedRealization.getClient().getLocationInfo().getSourceFolder())) {
if(nonConflictingSourceFolders.containsKey(supplier))
nonConflictingSourceFolders.put(supplier, nonConflictingSourceFolders.get(supplier) + 1);
else
nonConflictingSourceFolders.put(supplier, 1);
}
else {
if(conflictingSourceFolders.containsKey(supplier))
conflictingSourceFolders.put(supplier, conflictingSourceFolders.get(supplier) + 1);
else
conflictingSourceFolders.put(supplier, 1);
}
}
for(UMLRealization addedRealization : addedRealizations) {
String supplier = addedRealization.getSupplier();
boolean conflict = conflictingSourceFolders.containsKey(supplier) && nonConflictingSourceFolders.containsKey(supplier);
if(conflict && !addedClass.getLocationInfo().getSourceFolder().equals(addedRealization.getClient().getLocationInfo().getSourceFolder())) {
continue;
}
if(looksLikeSameType(supplier, addedClassName) && topLevelOrSameOuterClass(addedClass, addedRealization.getClient()) && getAddedClass(addedRealization.getClient().getName()) == null) {
UMLClassBaseDiff clientClassDiff = getUMLClassDiff(addedRealization.getClient().getName());
int implementedInterfaceOperations = 0;
Expand Down

0 comments on commit 0bca5a9

Please sign in to comment.