Skip to content

Commit

Permalink
Fix empty blames due to Extract Method handling
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Sep 4, 2024
1 parent e15b492 commit a9a851d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 25 deletions.
4 changes: 4 additions & 0 deletions src/main/java/org/codetracker/FileTrackerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -985,6 +985,10 @@ else if (key2 instanceof Annotation) {
found = true;
break;
}
if (methodChangeHistory.getCurrent() != null && codeElement.getUmlOperation().equals(methodChangeHistory.getCurrent().getUmlOperation())) {
found = true;
break;
}
}
}
if (!found && remainingBlames(startMethod).size() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -992,6 +992,10 @@ else if (key2 instanceof Annotation) {
found = true;
break;
}
if (methodChangeHistory.getCurrent() != null && codeElement.getUmlOperation().equals(methodChangeHistory.getCurrent().getUmlOperation())) {
found = true;
break;
}
}
}
if (!found && remainingBlames(startMethod).size() > 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/blame/blameTestUntilCommitZero2.txt
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ df9c43479 java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java
06156396f java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java (Alexey Kudravtsev 2017-04-25 14:19:19 +0000 220) @Override
0f4051917 java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java (Eugene Zhuravlev 2011-01-21 17:24:16 +0000 221) public void compile(@NotNull VirtualFile[] files, CompileStatusNotification callback) {
0f4051917 java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java (Eugene Zhuravlev 2011-01-21 17:24:16 +0000 222) compile(createFilesCompileScope(files), callback);
223) }
7460e5ada source/com/intellij/compiler/CompilerManagerImpl.java (Maxim Shafirov 2005-01-13 20:44:30 +0000 223) }
224)
06156396f java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java (Alexey Kudravtsev 2017-04-25 14:19:19 +0000 225) @Override
0f4051917 java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java (Eugene Zhuravlev 2011-01-21 17:24:16 +0000 226) public void compile(@NotNull Module module, CompileStatusNotification callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/blame/blameTestWithLocalRepo4.txt
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ cc13f68e3 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpre
cc13f68e3 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/LexicalDifferenceCalculator.java (Federico Tomassetti 2017-02-23 16:19:33 +0000 141) }
2d3f5e219 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/Difference.java (Thomas Leu 2018-06-07 20:54:17 +0000 142) }
cc13f68e3 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/LexicalDifferenceCalculator.java (Federico Tomassetti 2017-02-23 16:19:33 +0000 143) } while (diffIndex < diffElements.size() || originalIndex < originalElements.size());
144) }
c73ae5d79 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/LexicalDifferenceCalculator.java (Federico Tomassetti 2017-02-23 16:19:33 +0000 144) }
145)
2d3f5e219 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/Difference.java (Thomas Leu 2018-06-07 20:54:17 +0000 146) private boolean applyLeftOverOriginalElements() {
2d3f5e219 javaparser-core/src/main/java/com/github/javaparser/printer/lexicalpreservation/Difference.java (Thomas Leu 2018-06-07 20:54:17 +0000 147) boolean isLeftOverElement = false;
Expand Down
Loading

0 comments on commit a9a851d

Please sign in to comment.