Skip to content

Commit

Permalink
Add 1 blame test case
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Oct 10, 2024
1 parent 3c68268 commit b09baa9
Show file tree
Hide file tree
Showing 6 changed files with 1,540 additions and 96 deletions.
39 changes: 4 additions & 35 deletions src/main/java/org/codetracker/FileTrackerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
import gr.uom.java.xmi.diff.UMLDocumentationDiffProvider;
import gr.uom.java.xmi.diff.UMLEnumConstantDiff;
import gr.uom.java.xmi.diff.UMLModelDiff;
import gr.uom.java.xmi.UMLClass;
import gr.uom.java.xmi.UMLEnumConstant;
import gr.uom.java.xmi.UMLInitializer;
import gr.uom.java.xmi.UMLJavadoc;
Expand Down Expand Up @@ -1509,25 +1508,10 @@ private Map<Method, MethodTrackerChangeHistory> processMethodsWithSameSignature(
if (leftMethod == null) {
leftMethod = getMethod(leftModel, parentVersion, rightMethod::equalIdentifierIgnoringVersionAndAnnotation);
}
//check if there is another method in leftModel with identical bodyHashCode to the rightMethod
boolean otherExactMatchFound = false;
if (leftMethod != null) {
for (UMLClass leftClass : leftModel.getClassList()) {
for (UMLOperation leftOperation : leftClass.getOperations()) {
if (leftOperation.getBodyHashCode() == rightMethod.getUmlOperation().getBodyHashCode() && !leftOperation.equals(leftMethod.getUmlOperation())) {
otherExactMatchFound = true;
break;
}
}
if(otherExactMatchFound) {
break;
}
}
}
else {
if (leftMethod == null) {
notFoundMethods.put(rightMethod, startMethodChangeHistory);
}
if (leftMethod != null && !otherExactMatchFound) {
else {
if (!leftMethod.equalBody(rightMethod))
startMethodChangeHistory.get().addChange(leftMethod, rightMethod, ChangeFactory.forMethod(Change.Type.BODY_CHANGE));
if (!leftMethod.equalDocuments(rightMethod))
Expand Down Expand Up @@ -1581,25 +1565,10 @@ private Map<Method, MethodTrackerChangeHistory> processMethodsWithSameSignature(
}
//CHANGE BODY OR DOCUMENT
leftMethod = getMethod(leftModel, parentVersion, rightMethod::equalIdentifierIgnoringVersionAndDocumentAndBody);
//check if there is another method in leftModel with identical bodyHashCode to the rightMethod
boolean otherExactMatchFound = false;
if (leftMethod != null) {
for (UMLClass leftClass : leftModel.getClassList()) {
for (UMLOperation leftOperation : leftClass.getOperations()) {
if (leftOperation.getBodyHashCode() == rightMethod.getUmlOperation().getBodyHashCode() && !leftOperation.equals(leftMethod.getUmlOperation())) {
otherExactMatchFound = true;
break;
}
}
if(otherExactMatchFound) {
break;
}
}
}
else {
if (leftMethod == null) {
notFoundMethods.put(rightMethod, startMethodChangeHistory);
}
if (leftMethod != null && !otherExactMatchFound) {
else {
if (!leftMethod.equalBody(rightMethod))
startMethodChangeHistory.get().addChange(leftMethod, rightMethod, ChangeFactory.forMethod(Change.Type.BODY_CHANGE));
if (!leftMethod.equalDocuments(rightMethod))
Expand Down
39 changes: 4 additions & 35 deletions src/main/java/org/codetracker/FileTrackerWithLocalFilesImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import org.refactoringminer.rm1.GitHistoryRefactoringMinerImpl;

import gr.uom.java.xmi.UMLAttribute;
import gr.uom.java.xmi.UMLClass;
import gr.uom.java.xmi.UMLEnumConstant;
import gr.uom.java.xmi.UMLInitializer;
import gr.uom.java.xmi.UMLJavadoc;
Expand Down Expand Up @@ -1516,25 +1515,10 @@ private Map<Method, MethodTrackerChangeHistory> processMethodsWithSameSignature(
if (leftMethod == null) {
leftMethod = getMethod(leftModel, parentVersion, rightMethod::equalIdentifierIgnoringVersionAndAnnotation);
}
//check if there is another method in leftModel with identical bodyHashCode to the rightMethod
boolean otherExactMatchFound = false;
if (leftMethod != null) {
for (UMLClass leftClass : leftModel.getClassList()) {
for (UMLOperation leftOperation : leftClass.getOperations()) {
if (leftOperation.getBodyHashCode() == rightMethod.getUmlOperation().getBodyHashCode() && !leftOperation.equals(leftMethod.getUmlOperation())) {
otherExactMatchFound = true;
break;
}
}
if(otherExactMatchFound) {
break;
}
}
}
else {
if (leftMethod == null) {
notFoundMethods.put(rightMethod, startMethodChangeHistory);
}
if (leftMethod != null && !otherExactMatchFound) {
else {
if (!leftMethod.equalBody(rightMethod))
startMethodChangeHistory.get().addChange(leftMethod, rightMethod, ChangeFactory.forMethod(Change.Type.BODY_CHANGE));
if (!leftMethod.equalDocuments(rightMethod))
Expand Down Expand Up @@ -1588,25 +1572,10 @@ private Map<Method, MethodTrackerChangeHistory> processMethodsWithSameSignature(
}
//CHANGE BODY OR DOCUMENT
leftMethod = getMethod(leftModel, parentVersion, rightMethod::equalIdentifierIgnoringVersionAndDocumentAndBody);
//check if there is another method in leftModel with identical bodyHashCode to the rightMethod
boolean otherExactMatchFound = false;
if (leftMethod != null) {
for (UMLClass leftClass : leftModel.getClassList()) {
for (UMLOperation leftOperation : leftClass.getOperations()) {
if (leftOperation.getBodyHashCode() == rightMethod.getUmlOperation().getBodyHashCode() && !leftOperation.equals(leftMethod.getUmlOperation())) {
otherExactMatchFound = true;
break;
}
}
if(otherExactMatchFound) {
break;
}
}
}
else {
if (leftMethod == null) {
notFoundMethods.put(rightMethod, startMethodChangeHistory);
}
if (leftMethod != null && !otherExactMatchFound) {
else {
if (!leftMethod.equalBody(rightMethod))
startMethodChangeHistory.get().addChange(leftMethod, rightMethod, ChangeFactory.forMethod(Change.Type.BODY_CHANGE));
if (!leftMethod.equalDocuments(rightMethod))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ private static Stream<Arguments> testBlamerInputProvider(){
"https://github.com/mockito/mockito/commit/077562ea54f1fa87ff8dd233c3060ddbf0f1ce26, src/main/java/org/mockito/internal/invocation/MatchersBinder.java, /src/test/resources/blame/blameTestWithLocalRepo18.txt",
"https://github.com/hibernate/hibernate-search/commit/5b778035965d7588ad1d1ae522c4bafebd3a0e16, engine/src/main/java/org/hibernate/search/backend/impl/StreamingOperationDispatcher.java, /src/test/resources/blame/blameTestWithLocalRepo19.txt",
"https://github.com/eclipse/jetty.project/commit/fc5dd874f3deda71e6cd42af994a5af5cb6be4af, jetty-http2/http2-server/src/main/java/org/eclipse/jetty/http2/server/HttpTransportOverHTTP2.java, /src/test/resources/blame/blameTestWithLocalRepo20.txt",
"https://github.com/pmd/pmd/commit/d528dcd5d45582229ab3410deb7c40b2143d015d, pmd-java/src/main/java/net/sourceforge/pmd/lang/java/typeresolution/ClassTypeResolver.java, /src/test/resources/blame/blameTestWithLocalRepo21.txt",
"https://github.com/eclipse/jgit/commit/bd1a82502680b5de5bf86f6c4470185fd1602386, org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/pack/PackWriter.java, /src/test/resources/blame/blameTestUntilCommitZero.txt",
"https://github.com/JetBrains/intellij-community/commit/ecb1bb9d4d484ae63ee77f8ad45bdce154db9356, java/compiler/impl/src/com/intellij/compiler/CompilerManagerImpl.java, /src/test/resources/blame/blameTestUntilCommitZero2.txt",
"https://github.com/JetBrains/intellij-community/commit/ecb1bb9d4d484ae63ee77f8ad45bdce154db9356, java/compiler/impl/src/com/intellij/compiler/actions/CompileDirtyAction.java, /src/test/resources/blame/blameTestUntilCommitZero3.txt"
Expand Down
Loading

0 comments on commit b09baa9

Please sign in to comment.