Fix bugs with multiple fields, part of issue #706
This commit is contained in:
parent
93a33df5bd
commit
244eb9d0a9
|
|
@ -236,7 +236,7 @@ public class EmptyLineSeparatorCheck extends Check
|
|||
log(nextToken.getLineNo(), MSG_SHOULD_BE_SEPARATED,
|
||||
nextToken.getText());
|
||||
}
|
||||
else if ((!allowNoEmptyLineBetweenFields || !allowMultipleEmptyLines)
|
||||
else if (!allowNoEmptyLineBetweenFields
|
||||
&& nextToken.getType() != TokenTypes.RCURLY)
|
||||
{
|
||||
log(nextToken.getLineNo(), MSG_SHOULD_BE_SEPARATED,
|
||||
|
|
|
|||
|
|
@ -97,4 +97,17 @@ public class EmptyLineSeparatorCheckTest
|
|||
};
|
||||
verify(checkConfig, getPath("whitespace/InputEmptyLineSeparatorFormerException.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllowMultipleFieldInClass() throws Exception
|
||||
{
|
||||
DefaultConfiguration checkConfig = createCheckConfig(EmptyLineSeparatorCheck.class);
|
||||
checkConfig.addAttribute("allowMultipleEmptyLines", "false");
|
||||
checkConfig.addAttribute("allowNoEmptyLineBetweenFields", "true");
|
||||
final String[] expected = {
|
||||
|
||||
};
|
||||
verify(checkConfig, getPath("whitespace/InputEmptyLineSeparatorMultipleFieldsInClass.java"), expected);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package com.puppycrawl.tools.checkstyle.whitespace;
|
||||
|
||||
public class InputEmptyLineSeparatorMultipleFieldsInClass
|
||||
{
|
||||
int first;
|
||||
int second;
|
||||
}
|
||||
Loading…
Reference in New Issue