Skip to content

Commit

Permalink
Issue checkstyle#6516: recognized javadocs on method with type parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
rnveach authored and Vantuz committed Apr 3, 2019
1 parent 8cb8d86 commit d35292f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
Expand Up @@ -231,7 +231,8 @@ private static boolean isOnPlainClassMember(DetailAST blockComment, int memberTy
parent = parent.getParent();
}
return parent != null
&& parent.getType() == TokenTypes.TYPE
&& (parent.getType() == TokenTypes.TYPE
|| parent.getType() == TokenTypes.TYPE_PARAMETERS)
&& parent.getParent().getType() == memberType
// previous parent sibling is always TokenTypes.MODIFIERS
&& parent.getPreviousSibling().getChildCount() == 0;
Expand Down
Expand Up @@ -75,6 +75,7 @@ public void testIncorrect() throws Exception {
"121: " + getCheckMessage(MSG_SUMMARY_JAVADOC_MISSING),
"126: " + getCheckMessage(MSG_SUMMARY_JAVADOC_MISSING),
"132: " + getCheckMessage(MSG_SUMMARY_FIRST_SENTENCE),
"137: " + getCheckMessage(MSG_SUMMARY_JAVADOC_MISSING),
};
verify(checkConfig, getPath("InputSummaryJavadocIncorrect.java"), expected);
}
Expand Down Expand Up @@ -115,6 +116,7 @@ public void testDefaultConfiguration() throws Exception {
"121: " + getCheckMessage(MSG_SUMMARY_JAVADOC_MISSING),
"126: " + getCheckMessage(MSG_SUMMARY_JAVADOC_MISSING),
"132: " + getCheckMessage(MSG_SUMMARY_FIRST_SENTENCE),
"137: " + getCheckMessage(MSG_SUMMARY_JAVADOC_MISSING),
};

createChecker(checkConfig);
Expand Down
Expand Up @@ -49,7 +49,7 @@ public void testJavaDocsRecognition() throws Exception {
new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnClass.java",
BlockCommentPosition::isOnClass, 3),
new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnMethod.java",
BlockCommentPosition::isOnMethod, 4),
BlockCommentPosition::isOnMethod, 5),
new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnField.java",
BlockCommentPosition::isOnField, 3),
new BlockCommentPositionTestMetadata("InputBlockCommentPositionOnEnum.java",
Expand Down
Expand Up @@ -133,4 +133,7 @@ void foo10() {}
* M m m m {@inheritDoc}
*/
void foo7() {}

/** */
<T> T foo8(T t) {return null;}
}
Expand Up @@ -29,4 +29,11 @@ int method2(){
java.lang.String method3(){
return null;
}

/**
* I'm a javadoc
*/
<T> T method4(T t){
return null;
}
}

0 comments on commit d35292f

Please sign in to comment.