This commit is contained in:
parent
58b4d15a3a
commit
9dbd6a73ef
|
|
@ -77,11 +77,6 @@ public class ArrayInitHandler extends BlockParentHandler {
|
|||
return getMainAst().findFirstToken(TokenTypes.RCURLY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldStartWithRCurly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canChildrenBeNested() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -170,15 +170,6 @@ public class BlockParentHandler extends AbstractExpressionHandler {
|
|||
return new IndentLevel(getIndent(), getBraceAdjustment());
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if the right curly brace must be at the start of the line.
|
||||
*
|
||||
* @return true
|
||||
*/
|
||||
protected boolean shouldStartWithRCurly() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determines if child elements within the expression may be nested.
|
||||
*
|
||||
|
|
@ -192,15 +183,11 @@ public class BlockParentHandler extends AbstractExpressionHandler {
|
|||
* Check the indentation of the right curly brace.
|
||||
*/
|
||||
protected void checkRCurly() {
|
||||
// the rcurly can either be at the correct indentation, or
|
||||
// on the same line as the lcurly
|
||||
final DetailAST lcurly = getLCurly();
|
||||
final DetailAST rcurly = getRCurly();
|
||||
final int rcurlyPos = expandedTabsColumnNo(rcurly);
|
||||
|
||||
if (!curlyIndent().isAcceptable(rcurlyPos)
|
||||
&& (shouldStartWithRCurly() || isOnStartOfLine(rcurly))
|
||||
&& !areOnSameLine(rcurly, lcurly)) {
|
||||
&& isOnStartOfLine(rcurly)) {
|
||||
logError(rcurly, "rcurly", rcurlyPos, curlyIndent());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1039,7 +1039,6 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
|
|||
|
||||
"225: " + getCheckMessage(MSG_ERROR, "if", 10, 12),
|
||||
"229: " + getCheckMessage(MSG_CHILD_ERROR, "if", 18, 20),
|
||||
"233: " + getCheckMessage(MSG_ERROR, "if rcurly", 40, 8),
|
||||
"240: " + getCheckMessage(MSG_ERROR, "if rparen", 10, 8),
|
||||
"245: " + getCheckMessage(MSG_ERROR, "if rparen", 6, 8),
|
||||
"251: " + getCheckMessage(MSG_ERROR, "if lparen", 6, 8),
|
||||
|
|
@ -1112,9 +1111,7 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
|
|||
checkConfig.addAttribute("tabWidth", "4");
|
||||
checkConfig.addAttribute("throwsIndent", "4");
|
||||
final String fileName = getPath("InputInvalidAnonymousClassIndent.java");
|
||||
final String[] expected = {
|
||||
"28: " + getCheckMessage(MSG_ERROR_MULTI, "method def rcurly", 17, "12, 16"),
|
||||
};
|
||||
final String[] expected = CommonUtils.EMPTY_STRING_ARRAY;
|
||||
verifyWarns(checkConfig, fileName, expected);
|
||||
}
|
||||
|
||||
|
|
@ -1153,7 +1150,6 @@ public class IndentationCheckTest extends BaseCheckTestSupport {
|
|||
"70: " + getCheckMessage(MSG_CHILD_ERROR, "for", 10, 12),
|
||||
"71: " + getCheckMessage(MSG_CHILD_ERROR, "for", 14, 16),
|
||||
"72: " + getCheckMessage(MSG_CHILD_ERROR, "for", 10, 12),
|
||||
"77: " + getCheckMessage(MSG_ERROR, "for rcurly", 39, 8),
|
||||
"81: " + getCheckMessage(MSG_ERROR, "for rparen", 12, 8),
|
||||
};
|
||||
verifyWarns(checkConfig, fileName, expected);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ public class InputInvalidAnonymousClassIndent { //indent:0 exp:0
|
|||
return new Thread(); //indent:20 exp:20
|
||||
} else { //indent:16 exp:16
|
||||
return new Thread(); //indent:20 exp:20
|
||||
}}}); //indent:16 ioffset:1 exp:12,16 warn
|
||||
}}}); //indent:16 exp:16
|
||||
return; //indent:8 exp:8
|
||||
} //indent:4 exp:4
|
||||
} //indent:0 exp:0
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class InputInvalidForIndent { //indent:0 exp:0
|
|||
} //indent:8 exp:8
|
||||
|
||||
for (int i=0; i<10; i++) { //indent:8 exp:8
|
||||
System.getProperty("foo"); } //indent:12 ioffset:27 exp:8 warn
|
||||
System.getProperty("foo"); } //indent:12 exp:12
|
||||
|
||||
for (int i=0; //indent:8 exp:8
|
||||
i<10; i++ //indent:12 exp:>=12
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ System.getProperty("blah"); //indent:0 exp:12 warn
|
|||
} //indent:16 exp:16
|
||||
|
||||
if (test) { //indent:8 exp:8
|
||||
System.getProperty("blah"); } //indent:12 ioffset:28 exp:8 warn
|
||||
System.getProperty("blah"); } //indent:12 exp:12
|
||||
} //indent:4 exp:4
|
||||
|
||||
public void parenIfTest() { //indent:4 exp:4
|
||||
|
|
|
|||
Loading…
Reference in New Issue