Skip to content

Commit

Permalink
Issue #13061: Update grammar for exception, throws, and param tags
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbakry committed Apr 17, 2024
1 parent b1498c3 commit d052b98
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 3 deletions.
Expand Up @@ -1141,12 +1141,13 @@ javadocTag: AUTHOR_LITERAL (WS | NEWLINE)* ((WS | NEWLINE) description)?

| DEPRECATED_LITERAL (WS | NEWLINE)* ((WS | NEWLINE) description)?

| EXCEPTION_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+ CLASS_NAME
| EXCEPTION_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+ (CLASS_NAME)?
(WS | NEWLINE)* ((WS | NEWLINE) description)?

| PARAM_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+ PARAMETER_NAME
| PARAM_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+ (PARAMETER_NAME)?
(WS | NEWLINE)* ((WS | NEWLINE) description)?


| RETURN_LITERAL (WS | NEWLINE)* ((WS | NEWLINE) description)?

| SEE_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+
Expand All @@ -1162,7 +1163,7 @@ javadocTag: AUTHOR_LITERAL (WS | NEWLINE)* ((WS | NEWLINE) description)?

| SINCE_LITERAL (WS | NEWLINE)* ((WS | NEWLINE) description)?

| THROWS_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+ CLASS_NAME
| THROWS_LITERAL (WS | NEWLINE | {!isNextJavadocTag()}? LEADING_ASTERISK)+ (CLASS_NAME)?
(WS | NEWLINE)* ((WS | NEWLINE) description)?

| VERSION_LITERAL (WS | NEWLINE)* ((WS | NEWLINE) description)?
Expand Down
Expand Up @@ -98,6 +98,8 @@ public void testCheckTwo() throws Exception {
"60: " + getCheckMessage(MSG_KEY),
"75: " + getCheckMessage(MSG_KEY),
"77: " + getCheckMessage(MSG_KEY),
"88: " + getCheckMessage(MSG_KEY),
"98: " + getCheckMessage(MSG_KEY),
};
verifyWithInlineConfigParser(getPath("InputNonEmptyAtclauseDescriptionTwo.java"), expected);
}
Expand Down
Expand Up @@ -83,4 +83,24 @@ public int foo7() throws Exception
return 1;
}

/**
*
* @param
*
*/ // violation 2 lines above
// both parameter name and its description must be provided
public int foo8(int a)
{
return 1;
}

/**
* @throws
*/ // violation above
// both class name and its description must be provided
public int foo9(String a) throws Exception
{
return 1;
}

}
Expand Up @@ -26,3 +26,19 @@ class Test
}
}
// xdoc section -- end

// xdoc section -- start
class Test
{
// Violation for param and throws tags, parameter and class names must be provided.
/**
* Some summary.
*
* <code>@param</code>
* <code>@throws</code>
*/
public int method(String a, int b) throws Exception {
return 1;
}
}
// xdoc section -- end

0 comments on commit d052b98

Please sign in to comment.