Skip to content

Commit

Permalink
Enable the detection of nested Extract Variable in commit
Browse files Browse the repository at this point in the history
ttps://github.com/spring-projects/spring-boot/commit/8d64e9971450bc54f4447930eec741bc2bd48e31
buildSrc/src/main/java/org/springframework/boot/build/constraints/ExtractVersionConstraints.java
  • Loading branch information
tsantalis committed Jan 21, 2025
1 parent 3617ca3 commit 96c64ee
Showing 1 changed file with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1218,6 +1218,9 @@ else if(stringConcatMatch(initializer, after)) {
}

private boolean identical() {
if(refactorings.size() > 1) {
return true;
}
if(getReplacements().size() == 1 && fragment1.getVariableDeclarations().size() == fragment2.getVariableDeclarations().size()) {
return true;
}
Expand Down Expand Up @@ -1415,6 +1418,18 @@ private boolean diamondClassInstanceCreationMatch(AbstractExpression initializer
}
}
}
if(initializer.getString().contains("Map.of(") && replacedExpression.contains("Collections.singletonMap(")) {
String tmp = initializer.getString().replace("Map.of(", "Collections.singletonMap(");
if(tmp.equals(replacedExpression)) {
return true;
}
}
else if(initializer.getString().contains("Collections.singletonMap(") && replacedExpression.contains("Map.of(")) {
String tmp = initializer.getString().replace("Collections.singletonMap(", "Map.of(");
if(tmp.equals(replacedExpression)) {
return true;
}
}
return false;
}

Expand Down

0 comments on commit 96c64ee

Please sign in to comment.