From b22a612fd010b522b956453152aacd34c653bbe9 Mon Sep 17 00:00:00 2001 From: tsantalis Date: Wed, 1 Jan 2025 17:20:34 -0500 Subject: [PATCH] Enable mapping of method pair for register() methods in files spring-test/src/main/java/org/springframework/test/context/bean/override/BeanOverrideBeanPostProcessor.java spring-test/src/main/java/org/springframework/test/context/bean/override/BeanOverrideBeanFactoryPostProcessor.java in commit https://github.com/spring-projects/spring-framework/commit/2d33aac35038ef9f6773ff60f542975a051e7e42 --- src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java | 3 +++ .../java/org/refactoringminer/test/TestAllRefactorings.java | 2 +- src/test/resources/oracle/data.json | 4 ++-- src/test/resources/oracle/expected.txt | 2 +- 4 files changed, 7 insertions(+), 4 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 745071470..352906334 100644 --- a/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java +++ b/src/main/java/gr/uom/java/xmi/diff/UMLClassBaseDiff.java @@ -2434,7 +2434,10 @@ private boolean mappedElementsMoreThanNonMappedT1AndT2(int mappings, UMLOperatio } } } + boolean operationsWithSameName = operationBodyMapper.getContainer1().getName().equals(operationBodyMapper.getContainer2().getName()) && + !operationBodyMapper.getContainer1().isConstructor() && !operationBodyMapper.getContainer2().isConstructor(); return (mappings > nonMappedElementsT1 && mappings > nonMappedElementsT2) || + (operationsWithSameName && mappings >= nonMappedElementsT1 && mappings >= nonMappedElementsT2) || (nonMappedElementsT1 == 0 && mappings > Math.floor(nonMappedElementsT2/2.0) && !operationBodyMapper.involvesTestMethods()) || (nonMappedElementsT2 == 0 && mappings > Math.floor(nonMappedElementsT1/2.0) && !operationBodyMapper.involvesTestMethods() && !(this instanceof UMLClassMoveDiff)) || (nonMappedElementsT1 == 0 && exactMappings >= Math.floor(nonMappedElementsT2/2.0) && operationBodyMapper.getContainer1().isConstructor() == operationBodyMapper.getContainer2().isConstructor()) || diff --git a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java index 53f05e265..e00bd02bd 100644 --- a/src/test/java/org/refactoringminer/test/TestAllRefactorings.java +++ b/src/test/java/org/refactoringminer/test/TestAllRefactorings.java @@ -17,6 +17,6 @@ public void testAllRefactorings() throws Exception { GitHistoryRefactoringMinerImpl detector = new GitHistoryRefactoringMinerImpl(); TestBuilder test = new TestBuilder(detector, REPOS, Refactorings.All.getValue()); RefactoringPopulator.feedRefactoringsInstances(Refactorings.All.getValue(), Systems.FSE.getValue(), test); - test.assertExpectationsWithGitHubAPI(12404, 21, 226); + test.assertExpectationsWithGitHubAPI(12403, 21, 226); } } diff --git a/src/test/resources/oracle/data.json b/src/test/resources/oracle/data.json index c0068d60f..414badfd5 100644 --- a/src/test/resources/oracle/data.json +++ b/src/test/resources/oracle/data.json @@ -77023,8 +77023,8 @@ "type": "Move Method", "description": "Move Method private createProtocol(protocolConfig ProtocolConfiguration) : org.jgroups.conf.ProtocolConfiguration from class org.jboss.as.clustering.jgroups.JChannelFactory to private createProtocol(stack ProtocolStackConfiguration, protocol ProtocolConfiguration) : org.jgroups.conf.ProtocolConfiguration from class org.infinispan.server.jgroups.JChannelFactory", "comment": "

it is move class/package, but there is a change in the signature

", - "validation": "TP", - "detectionTools": "RefactoringMiner, RefDiff", + "validation": "FP", + "detectionTools": "RefDiff", "validators": "Matin, Nikos" }, { "type": "Move Method", diff --git a/src/test/resources/oracle/expected.txt b/src/test/resources/oracle/expected.txt index a73fc7a9b..a3be5ac7c 100644 --- a/src/test/resources/oracle/expected.txt +++ b/src/test/resources/oracle/expected.txt @@ -380,7 +380,7 @@ eb500cca282e39d01a9882e1d0a83186da6d1a26, 3, 0, 0 8707194f003444a9fb8e00bffa2893ef0c2492c6, 4, 0, 0 f36b736cf1206dd1af794d6fb4cee967a3553b1f, 1, 0, 0 d403a0b2322a74dde824094d67b7997c1c371883, 4, 0, 1 -8f446b6ddf540e1b1fefca34dd10f45ba7256095, 340, 3, 19 +8f446b6ddf540e1b1fefca34dd10f45ba7256095, 339, 3, 19 0bb4cca1105fc6eb86e7c4b75bfff3dbbd55f0c8, 4, 0, 0 c142b8ca3e9f9467931987ee16805cf53e6bc5d2, 5, 0, 0 d7f781da42e54824c17875a6036d3448672637f5, 10, 0, 0