Skip to content

Commit

Permalink
Handle Extract Method scenario where all statements in the original m…
Browse files Browse the repository at this point in the history
…ethod are matched square/okhttp@2864001d9
  • Loading branch information
tsantalis committed Oct 24, 2024
1 parent c20a12a commit 0362b4f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/main/java/org/codetracker/FileTrackerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,13 @@ private void processNestedStatementsAndComments(UMLModel rightModel, Version cur
rightSideOperations.remove(rightMethod.getUmlOperation());
}
}
if (containsCallToExtractedMethod(bodyMapper, rightSideOperations)) {
boolean allMapped =
bodyMapper.getNonMappedLeavesT1().size() == 0 &&
bodyMapper.getNonMappedLeavesT2().size() == 0 &&
bodyMapper.getNonMappedInnerNodesT1().size() == 0 &&
bodyMapper.getNonMappedInnerNodesT2().size() == 0 &&
bodyMapper.getMappings().size() > 0;
if (!allMapped && containsCallToExtractedMethod(bodyMapper, rightSideOperations)) {
UMLModelDiff umlModelDiffLocal = leftModel.diff(rightModel);
//this bodyMapper has mapping optimization
bodyMapper = findBodyMapper(umlModelDiffLocal, rightMethod, currentVersion, parentVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1798,7 +1798,13 @@ private void processNestedStatementsAndComments(UMLModel rightModel, Version cur
rightSideOperations.remove(rightMethod.getUmlOperation());
}
}
if (containsCallToExtractedMethod(bodyMapper, rightSideOperations)) {
boolean allMapped =
bodyMapper.getNonMappedLeavesT1().size() == 0 &&
bodyMapper.getNonMappedLeavesT2().size() == 0 &&
bodyMapper.getNonMappedInnerNodesT1().size() == 0 &&
bodyMapper.getNonMappedInnerNodesT2().size() == 0 &&
bodyMapper.getMappings().size() > 0;
if (!allMapped && containsCallToExtractedMethod(bodyMapper, rightSideOperations)) {
UMLModelDiff umlModelDiffLocal = leftModel.diff(rightModel);
//this bodyMapper has mapping optimization
bodyMapper = findBodyMapper(umlModelDiffLocal, rightMethod, currentVersion, parentVersion);
Expand Down

0 comments on commit 0362b4f

Please sign in to comment.