Skip to content

Commit

Permalink
Support the detection of inlined methods within merged method (#725)
Browse files Browse the repository at this point in the history
Merge Method	[private routeLoggingToSlf4J() : void, private addLogToDisk() : void] to private initLogging(args String[]) : void in class org.jabref.Launcher

Inline Method	private initializeLogger() : void inlined to private initLogging(args String[]) : void in class org.jabref.Launcher
  • Loading branch information
tsantalis committed May 27, 2024
1 parent 080e0e6 commit 82bbcad
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -2593,6 +2593,27 @@ private void checkForInlinedOperations() throws RefactoringMinerTimedOutExceptio
}
}
}
Set<Refactoring> refactoringsToBeAdded = new LinkedHashSet<Refactoring>();
for(Refactoring r : refactorings) {
if(r instanceof MergeOperationRefactoring) {
MergeOperationRefactoring merge = (MergeOperationRefactoring)r;
for(UMLOperationBodyMapper mapper : merge.getMappers()) {
InlineOperationDetection detection = new InlineOperationDetection(mapper, removedOperations, this, modelDiff);
List<UMLOperation> sortedRemovedOperations = detection.getRemovedOperationsSortedByCalls();
for(UMLOperation removedOperation : sortedRemovedOperations) {
List<InlineOperationRefactoring> refs = detection.check(removedOperation);
for(InlineOperationRefactoring refactoring : refs) {
refactoringsToBeAdded.add(refactoring);
UMLOperationBodyMapper operationBodyMapper = refactoring.getBodyMapper();
inlinedOperationMappers.add(operationBodyMapper);
mapper.addChildMapper(operationBodyMapper);
operationsToBeRemoved.add(removedOperation);
}
}
}
}
}
refactorings.addAll(refactoringsToBeAdded);
MappingOptimizer optimizer = new MappingOptimizer(this);
for(UMLOperationBodyMapper mapper : getOperationBodyMapperList()) {
optimizer.optimizeDuplicateMappingsForInline(mapper, refactorings);
Expand Down

0 comments on commit 82bbcad

Please sign in to comment.