From 6309cb1957c823bb0c6db25d86ab9a7560d36477 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Thu, 2 Jan 2025 17:17:28 -0500 Subject: [PATCH] Fix matching of method pairs in annotation type declarations https://github.com/junit-team/junit5/commit/eb35aa9cdecd71f49af177f2cad32f5257311874 Rename Method public parameters() : String renamed to public parameterTypeNames() : String in class org.junit.platform.suite.api.SelectMethod --- .../xmi/decomposition/UMLOperationBodyMapper.java | 15 +++++++++++++++ .../gr/uom/java/xmi/diff/UMLClassBaseDiff.java | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) 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 e0e22ec56..cb49a0e80 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/UMLOperationBodyMapper.java @@ -9764,6 +9764,21 @@ else if(!thisEqualSignature && otherEqualSignature) { return 1; } } + if(this.getContainer1().getJavadoc() != null && this.getContainer2().getJavadoc() != null && + operationBodyMapper.getContainer1().getJavadoc() != null && operationBodyMapper.getContainer2().getJavadoc() != null) { + boolean thisCommonJavadoc = + this.getContainer1().getJavadoc().getText().contains(this.getContainer2().getJavadoc().getText()) || + this.getContainer2().getJavadoc().getText().contains(this.getContainer1().getJavadoc().getText()); + boolean otherCommonJavadoc = + operationBodyMapper.getContainer1().getJavadoc().getText().contains(operationBodyMapper.getContainer2().getJavadoc().getText()) || + operationBodyMapper.getContainer2().getJavadoc().getText().contains(operationBodyMapper.getContainer1().getJavadoc().getText()); + if(thisCommonJavadoc && !otherCommonJavadoc) { + return -1; + } + else if(!thisCommonJavadoc && otherCommonJavadoc) { + 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 0e1b230cc..53d6b8296 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java @@ -2031,7 +2031,8 @@ private boolean delegatesToAnotherRemovedOperation(UMLOperation removedOperation private void updateMapperSet(TreeSet mapperSet, UMLOperation removedOperation, UMLOperation addedOperation, int differenceInPosition) throws RefactoringMinerTimedOutException { boolean mapperWithZeroNonMappedStatementsOrIdenticalMethodName = false; for(UMLOperationBodyMapper mapper : mapperSet) { - if(mapper.getContainer1().getBodyHashCode() == mapper.getContainer2().getBodyHashCode()) { + if(mapper.getContainer1().getBody() != null && mapper.getContainer2().getBody() != null && + mapper.getContainer1().getBodyHashCode() == mapper.getContainer2().getBodyHashCode()) { return; } if(mapper.getContainer1().getName().equals(mapper.getContainer2().getName())) {