if (enclosingLoop != null) {
break;
}
}
if (enclosingLoop != null) {
SynchronizedTree enclosingSynchronized = ASTHelpers.findEnclosingNode(
state.getPath().getParentPath(), SynchronizedTree.class);
if (enclosingSynchronized != null) {
String blockStatements = enclosingSynchronized.getBlock().toString();
int openBracketIndex = blockStatements.indexOf('{');
int closeBracketIndex = blockStatements.lastIndexOf('}');
blockStatements = blockStatements.substring(openBracketIndex + 1, closeBracketIndex).trim();
return describeMatch(tree, SuggestedFix.builder()
.replace(enclosingSynchronized, blockStatements)
.prefixWith(enclosingLoop, "synchronized " + enclosingSynchronized.getExpression() + " {\n")
.postfixWith(enclosingLoop, "\n}")
.build());
}
}