Issue #1566: InnerTypeLast turned on
This commit is contained in:
parent
242028813d
commit
d3408eb4e4
|
|
@ -299,9 +299,10 @@
|
|||
<module name="CommentsIndentation"/>
|
||||
<module name="HiddenField">
|
||||
<property name="ignoreConstructorParameter" value="true"/>
|
||||
<property name="ignoreSetter" value="true"/>
|
||||
<property name="ignoreSetter" value="true"/>
|
||||
<property name="setterCanReturnItsClass" value="true"/>
|
||||
</module>
|
||||
<module name="InnerTypeLast"/>
|
||||
|
||||
<module name="ModifiedControlVariable"/>
|
||||
|
||||
|
|
@ -314,7 +315,6 @@
|
|||
<module name="FinalParameters"/>
|
||||
<module name="IllegalToken"/>
|
||||
<module name="IllegalType"/>
|
||||
<module name="InnerTypeLast"/>
|
||||
<module name="JavadocParagraph"/>
|
||||
<module name="JavadocTagContinuationIndentation"/>
|
||||
<module name="JavaNCSS"/>
|
||||
|
|
|
|||
|
|
@ -237,13 +237,6 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
|
|||
verify(checkConfig, pathToEmptyFile, expected);
|
||||
}
|
||||
|
||||
public static class BadJavaDocCheck extends Check {
|
||||
@Override
|
||||
public int[] getDefaultTokens() {
|
||||
return new int[]{TokenTypes.SINGLE_LINE_COMMENT};
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessNonJavaFiles() throws Exception {
|
||||
final TreeWalker treeWalker = new TreeWalker();
|
||||
|
|
@ -300,4 +293,11 @@ public class TreeWalkerTest extends BaseCheckTestSupport {
|
|||
|
||||
treeWalker.processFiltered(file, lines);
|
||||
}
|
||||
|
||||
public static class BadJavaDocCheck extends Check {
|
||||
@Override
|
||||
public int[] getDefaultTokens() {
|
||||
return new int[]{TokenTypes.SINGLE_LINE_COMMENT};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,39 +33,6 @@ import com.puppycrawl.tools.checkstyle.DefaultContext;
|
|||
|
||||
public class AutomaticBeanTest {
|
||||
|
||||
public class TestBean extends AutomaticBean {
|
||||
|
||||
private String privateField;
|
||||
|
||||
private String wrong;
|
||||
|
||||
private int val;
|
||||
|
||||
public void setWrong(String wrong) {
|
||||
this.wrong = wrong;
|
||||
}
|
||||
|
||||
public void setVal(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
public void setExceptionalMethod(String value) {
|
||||
throw new IllegalStateException("for UT");
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* just for code coverage
|
||||
* @param childConf a child of this component's Configuration
|
||||
*/
|
||||
@Override
|
||||
protected void setupChild(Configuration childConf) throws CheckstyleException {
|
||||
super.setupChild(childConf);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigure_NoSuchAttribute() {
|
||||
final TestBean testBean = new TestBean();
|
||||
|
|
@ -130,4 +97,36 @@ public class AutomaticBeanTest {
|
|||
}
|
||||
}
|
||||
|
||||
public class TestBean extends AutomaticBean {
|
||||
|
||||
private String privateField;
|
||||
|
||||
private String wrong;
|
||||
|
||||
private int val;
|
||||
|
||||
public void setWrong(String wrong) {
|
||||
this.wrong = wrong;
|
||||
}
|
||||
|
||||
public void setVal(int val) {
|
||||
this.val = val;
|
||||
}
|
||||
|
||||
public void setExceptionalMethod(String value) {
|
||||
throw new IllegalStateException("for UT");
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
}
|
||||
|
||||
/**
|
||||
* just for code coverage
|
||||
* @param childConf a child of this component's Configuration
|
||||
*/
|
||||
@Override
|
||||
protected void setupChild(Configuration childConf) throws CheckstyleException {
|
||||
super.setupChild(childConf);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,33 +45,6 @@ public class FileSetCheckLifecycleTest
|
|||
return dc;
|
||||
}
|
||||
|
||||
public static class TestFileSetCheck extends AbstractFileSetCheck {
|
||||
private static boolean destroyed;
|
||||
private static boolean fileContentAvailable;
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
destroyed = true;
|
||||
}
|
||||
|
||||
public static boolean isDestroyed() {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
public static boolean isFileContentAvailable() {
|
||||
return fileContentAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processFiltered(File file, List<String> lines) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishProcessing() {
|
||||
fileContentAvailable = FileContentsHolder.getContents() != null;
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTranslation() throws Exception {
|
||||
final Configuration checkConfig =
|
||||
|
|
@ -111,4 +84,31 @@ public class FileSetCheckLifecycleTest
|
|||
assertTrue("FileContent should be available during finishProcessing() call",
|
||||
TestFileSetCheck.isFileContentAvailable());
|
||||
}
|
||||
|
||||
public static class TestFileSetCheck extends AbstractFileSetCheck {
|
||||
private static boolean destroyed;
|
||||
private static boolean fileContentAvailable;
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
destroyed = true;
|
||||
}
|
||||
|
||||
public static boolean isDestroyed() {
|
||||
return destroyed;
|
||||
}
|
||||
|
||||
public static boolean isFileContentAvailable() {
|
||||
return fileContentAvailable;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processFiltered(File file, List<String> lines) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finishProcessing() {
|
||||
fileContentAvailable = FileContentsHolder.getContents() != null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,19 +33,6 @@ import com.puppycrawl.tools.checkstyle.TreeWalker;
|
|||
import com.puppycrawl.tools.checkstyle.api.DetailNode;
|
||||
|
||||
public class AbstractJavadocCheckTest extends BaseCheckTestSupport {
|
||||
public static class TempCheck extends AbstractJavadocCheck {
|
||||
|
||||
@Override
|
||||
public int[] getDefaultJavadocTokens() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJavadocToken(DetailNode ast) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNumberFormatException() throws Exception {
|
||||
|
|
@ -92,4 +79,17 @@ public class AbstractJavadocCheckTest extends BaseCheckTestSupport {
|
|||
};
|
||||
verify(checker, getPath("javadoc/InputCorrectJavaDocParagraphCheck.java"), expected);
|
||||
}
|
||||
|
||||
public static class TempCheck extends AbstractJavadocCheck {
|
||||
|
||||
@Override
|
||||
public int[] getDefaultJavadocTokens() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitJavadocToken(DetailNode ast) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,15 @@ public class AllBlockCommentsTest extends BaseCheckTestSupport {
|
|||
|
||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
|
||||
|
||||
@Test
|
||||
public void testAllBlockComments() throws Exception {
|
||||
DefaultConfiguration checkConfig = createCheckConfig(BlockCommentListenerCheck.class);
|
||||
final String[] expected = {};
|
||||
verify(checkConfig, getPath("comments" + File.separator
|
||||
+ "InputFullOfBlockComments.java"), expected);
|
||||
Assert.assertTrue(allComments.isEmpty());
|
||||
}
|
||||
|
||||
public static class BlockCommentListenerCheck extends Check {
|
||||
@Override
|
||||
public boolean isCommentNodesRequired() {
|
||||
|
|
@ -74,15 +83,5 @@ public class AllBlockCommentsTest extends BaseCheckTestSupport {
|
|||
Assert.fail("Unexpected comment: " + commentContent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllBlockComments() throws Exception {
|
||||
DefaultConfiguration checkConfig = createCheckConfig(BlockCommentListenerCheck.class);
|
||||
final String[] expected = {};
|
||||
verify(checkConfig, getPath("comments" + File.separator
|
||||
+ "InputFullOfBlockComments.java"), expected);
|
||||
Assert.assertTrue(allComments.isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,15 @@ public class AllSinglelineCommentsTest extends BaseCheckTestSupport {
|
|||
|
||||
private static final String LINE_SEPARATOR = System.getProperty("line.separator");
|
||||
|
||||
@Test
|
||||
public void testAllBlockComments() throws Exception {
|
||||
DefaultConfiguration checkConfig = createCheckConfig(SinglelineCommentListenerCheck.class);
|
||||
final String[] expected = {};
|
||||
verify(checkConfig, getPath("comments" + File.separator
|
||||
+ "InputFullOfSinglelineComments.java"), expected);
|
||||
Assert.assertTrue(allComments.isEmpty());
|
||||
}
|
||||
|
||||
public static class SinglelineCommentListenerCheck extends Check {
|
||||
@Override
|
||||
public boolean isCommentNodesRequired() {
|
||||
|
|
@ -69,15 +78,5 @@ public class AllSinglelineCommentsTest extends BaseCheckTestSupport {
|
|||
Assert.fail("Unexpected comment: " + commentContent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAllBlockComments() throws Exception {
|
||||
DefaultConfiguration checkConfig = createCheckConfig(SinglelineCommentListenerCheck.class);
|
||||
final String[] expected = {};
|
||||
verify(checkConfig, getPath("comments" + File.separator
|
||||
+ "InputFullOfSinglelineComments.java"), expected);
|
||||
Assert.assertTrue(allComments.isEmpty());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue