From c5a301718bc5058611765db6e24b855b5cacfda4 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Thu, 2 Jan 2025 12:17:18 -0500 Subject: [PATCH] Fix method pair mappings in commit https://github.com/junit-team/junit5/commit/abb5ed16be3a9ce552f4a45c11264ded608ae9da Rename Parameter object : T to executable : T in method public makeAccessible(executable T) : T from class org.junit.platform.commons.util.ReflectionUtils --- src/main/java/gr/uom/java/xmi/UMLOperation.java | 2 +- .../java/xmi/decomposition/UMLOperationBodyMapper.java | 10 ++++++++++ .../java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main/java/gr/uom/java/xmi/UMLOperation.java b/src/main/java/gr/uom/java/xmi/UMLOperation.java index aa1c37f0b1..d1deae0a51 100644 --- a/src/main/java/gr/uom/java/xmi/UMLOperation.java +++ b/src/main/java/gr/uom/java/xmi/UMLOperation.java @@ -807,7 +807,7 @@ public boolean equals(Object o) { return false; } - public boolean equalsIgoringTypeParameters(UMLOperation operation) { + public boolean equalsIgnoringTypeParameters(UMLOperation operation) { boolean thisEmptyBody = this.getBody() == null || this.hasEmptyBody(); boolean otherEmptyBody = operation.getBody() == null || operation.hasEmptyBody(); return this.className.equals(operation.className) && diff --git a/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java b/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java index 9116d71e34..ecb11aa32e 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java @@ -9734,6 +9734,16 @@ else if(identicalStringRepresentation2) { return Integer.compare(thisNonMapped, otherNonMapped); } else { + if(getOperation1() != null && getOperation2() != null && operationBodyMapper.getOperation1() != null && operationBodyMapper.getOperation2() != null) { + boolean thisEqualSignature = this.getOperation1().equalsIgnoringTypeParameters(this.getOperation2()); + boolean otherEqualSignature = operationBodyMapper.getOperation1().equalsIgnoringTypeParameters(operationBodyMapper.getOperation2()); + if(thisEqualSignature && !otherEqualSignature) { + return -1; + } + else if(!thisEqualSignature && otherEqualSignature) { + return 1; + } + } int thisEditDistance = this.editDistance(); int otherEditDistance = operationBodyMapper.editDistance(); if(thisEditDistance != otherEditDistance) { diff --git a/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java b/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java index 3529063348..0e1b230ccd 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java @@ -3397,7 +3397,7 @@ else if(removedOperation.equalsIgnoringNameCase(addedOperation) && !differentPar removedOperationsToBeRemoved.add(removedOperation); addedOperationsToBeRemoved.add(addedOperation); } - else if(removedOperation.equalsIgoringTypeParameters(addedOperation) && !differentParameterNames(removedOperation, addedOperation) && + else if(removedOperation.equalsIgnoringTypeParameters(addedOperation) && !differentParameterNames(removedOperation, addedOperation) && removedOperations.size() == addedOperations.size()) { UMLOperationBodyMapper operationBodyMapper = new UMLOperationBodyMapper(removedOperation, addedOperation, this); this.addOperationBodyMapper(operationBodyMapper);