Skip to content

Commit

Permalink
Pull checkstyle#15687: removed unnecessary tokens from JavadocMethodC…
Browse files Browse the repository at this point in the history
…heck
  • Loading branch information
rnveach authored and romani committed Oct 26, 2024
1 parent 386963a commit ab10c20
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,7 @@ public void setAllowMissingReturnTag(boolean flag) {

@Override
public final int[] getRequiredTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.RECORD_DEF,
};
return CommonUtil.EMPTY_INT_ARRAY;
}

@Override
Expand All @@ -362,25 +357,16 @@ public int[] getDefaultTokens() {
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.RECORD_DEF,
TokenTypes.COMPACT_CTOR_DEF,
};
}

@Override
public final void visitToken(DetailAST ast) {
if (ast.getType() == TokenTypes.METHOD_DEF
|| ast.getType() == TokenTypes.CTOR_DEF
|| ast.getType() == TokenTypes.ANNOTATION_FIELD_DEF
|| ast.getType() == TokenTypes.COMPACT_CTOR_DEF) {
processAST(ast);
}
processAST(ast);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,9 @@ public void testGetAcceptableTokens() {

final int[] actual = javadocMethodCheck.getAcceptableTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.RECORD_DEF,
TokenTypes.COMPACT_CTOR_DEF,
};

Expand Down Expand Up @@ -420,12 +416,7 @@ public void testJavadocMethodRecordsAndCompactCtors() throws Exception {

@Test
public void testGetRequiredTokens() {
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.RECORD_DEF,
};
final int[] expected = CommonUtil.EMPTY_INT_ARRAY;
final JavadocMethodCheck check = new JavadocMethodCheck();
final int[] actual = check.getRequiredTokens();
assertWithMessage("Required tokens differ from expected")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
accessModifiers = (default)public, protected, package, private
allowMissingParamTags = (default)false
allowMissingReturnTag = (default)false
tokens = METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF, RECORD_DEF, CLASS_DEF
tokens = METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF, COMPACT_CTOR_DEF
*/
Expand Down

0 comments on commit ab10c20

Please sign in to comment.