Skip to content

Commit

Permalink
Fix one more failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 22, 2024
1 parent 02feb3e commit 18287ad
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,8 @@ else if(stringConcatMatch(initializer, before)) {
}
}
}
if(!fragment1.getString().equals(fragment2.getString()) && initializer != null && fragment1.getVariableDeclaration(variableName) == null && !isDefaultValue(initializer.toString())) {
if(!fragment1.getString().equals(fragment2.getString()) && initializer != null && fragment1.getVariableDeclaration(variableName) == null &&
!isDefaultValue(initializer.toString()) && !isVariableReference(initializer.toString(), fragment2.getVariables())) {
if(getFragment1().getString().contains(initializer.getString()) && getFragment2().findExpression(variableName).size() > 0 &&
!getFragment2().getString().equals(JAVA.RETURN_SPACE + variableName + JAVA.STATEMENT_TERMINATION)) {
boolean mappingFound = false;
Expand Down Expand Up @@ -875,6 +876,15 @@ private boolean anonymousWithMethodSignatureChange(AbstractExpression initialize
return false;
}

private boolean isVariableReference(String argument, List<LeafExpression> variables) {
for(LeafExpression expr : variables) {
if(expr.getString().equals(argument)) {
return true;
}
}
return false;
}

private boolean isDefaultValue(String argument) {
return argument.equals("null") || argument.equals("0") || argument.equals("1") || argument.equals("false") || argument.equals("true");
}
Expand Down

0 comments on commit 18287ad

Please sign in to comment.