Skip to content

Commit

Permalink
Don't call J.ClassDeclaration#withBody() using null
Browse files Browse the repository at this point in the history
  • Loading branch information
knutwannheden committed Jan 11, 2024
1 parent fb7dbd6 commit c625f30
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,10 @@ private void classDeclaration(StringBuilder before, J.ClassDeclaration parent, S
classDeclaration(before, (J.ClassDeclaration) statement, templated, cursor);
}
}
c = c.withBody(null).withLeadingAnnotations(null).withPrefix(Space.EMPTY);
before.insert(0, c.printTrimmed(cursor).trim() + '{');
c = c.withBody(J.Block.createEmptyBlock()).withLeadingAnnotations(null).withPrefix(Space.EMPTY);
String printed = c.printTrimmed(cursor);
int braceIndex = printed.lastIndexOf('{');
before.insert(0, braceIndex == -1 ? printed + '{' : printed.substring(0, braceIndex + 1));
}

private String variable(J.VariableDeclarations variable, Cursor cursor) {
Expand Down

0 comments on commit c625f30

Please sign in to comment.