diff --git a/src/main/java/gr/uom/java/xmi/UMLOperation.java b/src/main/java/gr/uom/java/xmi/UMLOperation.java index aa1c37f0b..d1deae0a5 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 9116d71e3..ecb11aa32 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 352906334..0e1b230cc 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);