Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1363,7 +1363,39 @@ private Boolean scanRecord(ClassTree node, Void p) {
int oldLastIndent = lastIndent;
int lastMaxPreservedBlankLines = maxPreservedBlankLines;
maxPreservedBlankLines = cs.getMaximumBlankLinesInDeclarations();
classLeftBracePlacement();

CodeStyle.BracePlacement bracePlacement = cs.getClassDeclBracePlacement();
boolean spaceBeforeLeftBrace = cs.spaceBeforeClassDeclLeftBrace();
switch (bracePlacement) {
case SAME_LINE:
spaces(spaceBeforeLeftBrace ? 1 : 0, tokens.offset() < startOffset);
accept(LBRACE);
if (tokens.token().id() == RBRACE) {
accept(RBRACE);
indent = oldIndent;
lastIndent = oldLastIndent;
return true;
}
indent = lastIndent + indentSize;
break;
case NEW_LINE:
newline();
accept(LBRACE);
indent = lastIndent + indentSize;
break;
case NEW_LINE_HALF_INDENTED:
int oldLast = lastIndent;
indent = lastIndent + (indentSize >> 1);
newline();
accept(LBRACE);
indent = oldLast + indentSize;
break;
case NEW_LINE_INDENTED:
indent = lastIndent + indentSize;
newline();
accept(LBRACE);
break;
}

continuationIndent = old;
try {
Expand Down Expand Up @@ -1414,38 +1446,6 @@ private Boolean scanRecord(ClassTree node, Void p) {
return true;
}

private void classLeftBracePlacement() {
CodeStyle.BracePlacement bracePlacement = cs.getClassDeclBracePlacement();
boolean spaceBeforeLeftBrace = cs.spaceBeforeClassDeclLeftBrace();
int old = indent = lastIndent;
int halfIndent = lastIndent;
switch (bracePlacement) {
case SAME_LINE:
spaces(spaceBeforeLeftBrace ? 1 : 0, tokens.offset() < startOffset);
accept(LBRACE);
indent = lastIndent + indentSize;
break;
case NEW_LINE:
newline();
accept(LBRACE);
indent = lastIndent + indentSize;
break;
case NEW_LINE_HALF_INDENTED:
int oldLast = lastIndent;
indent = lastIndent + (indentSize >> 1);
halfIndent = indent;
newline();
accept(LBRACE);
indent = oldLast + indentSize;
break;
case NEW_LINE_INDENTED:
indent = lastIndent + indentSize;
halfIndent = indent;
newline();
accept(LBRACE);
break;
}
}

@Override
public Boolean visitMethod(MethodTree node, Void p) {
Expand Down Expand Up @@ -2220,7 +2220,7 @@ public Boolean visitLambdaExpression(LambdaExpressionTree node, Void p) {
}
}
try {
wrapOperatorAndTree(cs.wrapLambdaArrow(), -1, cs.spaceAroundLambdaArrow() ? 1 : 0, cs.spaceAroundLambdaArrow() ? 1 : 0, lastIndent, node.getBody());
wrapOperatorAndTree(cs.wrapLambdaArrow(), -1, cs.spaceAroundLambdaArrow() ? 1 : 0, cs.spaceAroundLambdaArrow() ? 1 : 0, -1, node.getBody());
} finally {
continuationIndent = old;
indent = oldIndent;
Expand Down
Loading
Loading