Skip to content

Commit

Permalink
Improvement over previous commit to handle reordered arguments
Browse files Browse the repository at this point in the history
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
spring-projects/spring-framework@2d33aac
  • Loading branch information
tsantalis committed Dec 28, 2024
1 parent e70a555 commit 45aec3d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 45aec3d

Please sign in to comment.