From 45aec3d5b1899d2f9e4bd54fe4de37dd0583528e Mon Sep 17 00:00:00 2001 From: tsantalis Date: Sat, 28 Dec 2024 14:39:26 -0500 Subject: [PATCH] Improvement over previous commit to handle reordered arguments Avoid detection of refactoring Inline Variable typeToOverride : ResolvableType in method private parseField(field Field, source Class) : void from class org.springframework.test.context.bean.override.BeanOverrideParser in commit https://github.com/spring-projects/spring-framework/commit/2d33aac35038ef9f6773ff60f542975a051e7e42 --- .../gr/uom/java/xmi/decomposition/AbstractCodeMapping.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/gr/uom/java/xmi/decomposition/AbstractCodeMapping.java b/src/main/java/gr/uom/java/xmi/decomposition/AbstractCodeMapping.java index 96503a675..da4aab3dc 100644 --- a/src/main/java/gr/uom/java/xmi/decomposition/AbstractCodeMapping.java +++ b/src/main/java/gr/uom/java/xmi/decomposition/AbstractCodeMapping.java @@ -553,7 +553,8 @@ public void temporaryVariableAssignment(AbstractCodeFragment statement, AbstractCall callBefore = r.getInvokedOperationBefore(); AbstractCall callAfter = r.getInvokedOperationAfter(); int indexOfArgument2 = callAfter.arguments().indexOf(variableName); - if(indexOfArgument2 != -1 && callBefore.arguments().size() == callAfter.arguments().size()) { + if(indexOfArgument2 != -1 && callBefore.arguments().size() == callAfter.arguments().size() && + !callAfter.arguments().contains(callBefore.arguments().get(indexOfArgument2))) { after = variableName; before = callBefore.arguments().get(indexOfArgument2); } @@ -980,7 +981,8 @@ public void inlinedVariableAssignment(AbstractCodeFragment statement, AbstractCall callBefore = r.getInvokedOperationBefore(); AbstractCall callAfter = r.getInvokedOperationAfter(); int indexOfArgument1 = callBefore.arguments().indexOf(variableName); - if(indexOfArgument1 != -1 && callBefore.arguments().size() == callAfter.arguments().size()) { + if(indexOfArgument1 != -1 && callBefore.arguments().size() == callAfter.arguments().size() && + !callBefore.arguments().contains(callAfter.arguments().get(indexOfArgument1))) { before = variableName; after = callAfter.arguments().get(indexOfArgument1); }