From bb47b0f70c2d76378ae140b23100e4722d8b04c7 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Sat, 28 Dec 2024 22:26:26 -0500 Subject: [PATCH] Enable detection of Extract Method refactoring in commit https://github.com/spring-projects/spring-framework/commit/8b51b36729af4653450114a238b1b22d2a5383a4 Extract Method private handle(adapter RequestMappingHandlerAdapter, controller Object, exchange ServerWebExchange, timeout Duration, methodName String, parameterTypes Class...) : HandlerResult extracted from private handle(adapter RequestMappingHandlerAdapter, controller Object, methodName String) : HandlerResult in class org.springframework.web.reactive.result.method.annotation.ControllerAdviceTests --- .../gr/uom/java/xmi/diff/UMLClassBaseDiff.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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 8defc6ac3d..9ab74a4fc0 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java @@ -2503,21 +2503,31 @@ private UMLOperationBodyMapper findBestMapper(TreeSet ma UMLOperationBodyMapper bestMapper = mapperSet.first(); VariableDeclarationContainer bestMapperOperation1 = bestMapper.getContainer1(); VariableDeclarationContainer bestMapperOperation2 = bestMapper.getContainer2(); + int bestCommonParameterTypes = bestMapperOperation1.commonParameterTypes(bestMapperOperation2).size(); + VariableDeclarationContainer secondBestMapperOperation1 = mapperList.size() > 1 ? mapperList.get(1).getContainer1() : null; + VariableDeclarationContainer secondBestMapperOperation2 = mapperList.size() > 1 ? mapperList.get(1).getContainer2() : null; + boolean secondBestMapperEqualSignatureWithCommonParameterTypes = secondBestMapperOperation1 != null && secondBestMapperOperation2 != null ? + equalSignatureWithCommonParameterTypes(secondBestMapperOperation1, secondBestMapperOperation2) : false; + int secondBestCommontParameterTypes = secondBestMapperOperation1 != null && secondBestMapperOperation2 != null ? + secondBestMapperOperation1.commonParameterTypes(secondBestMapperOperation2).size() : 0; boolean identicalBodyWithOperation1OfTheBestMapper = identicalBodyWithAnotherAddedMethod(bestMapper); boolean identicalBodyWithOperation2OfTheBestMapper = identicalBodyWithAnotherRemovedMethod(bestMapper); if(equalSignatureWithCommonParameterTypes(bestMapperOperation1, bestMapperOperation2) && + !(secondBestMapperEqualSignatureWithCommonParameterTypes && secondBestCommontParameterTypes > bestCommonParameterTypes) && !identicalBodyWithOperation1OfTheBestMapper && !identicalBodyWithOperation2OfTheBestMapper) { return bestMapper; } for(int i=1; i operationInvocations2 = operation2.getAllOperationInvocations(); boolean anotherMapperCallsOperation2OfTheBestMapper = false; for(AbstractCall invocation : operationInvocations2) { if(invocation.matchesOperation(bestMapper.getContainer2(), operation2, this, modelDiff) && !invocation.matchesOperation(bestMapper.getContainer1(), operation2, this, modelDiff) && - !operationContainsMethodInvocationWithTheSameNameAndCommonArguments(invocation, removedOperations) && + (!operationContainsMethodInvocationWithTheSameNameAndCommonArguments(invocation, removedOperations) || commonParameterTypes > bestCommonParameterTypes) && (invocation.getExpression() == null || invocation.getExpression().equals("this"))) { boolean skip = false; for(UMLOperationBodyMapper m : operationBodyMapperList) {