Incorporate patch from ronald _DOT d _DOT hastings _AT boeing _DOT com to

correctly handle C++ style comments being between Javadoc comments and
declarations.
This commit is contained in:
Oliver Burn 2002-08-02 00:02:26 +00:00
parent 7f8726ee78
commit a9884dffce
3 changed files with 59 additions and 1 deletions

View File

@ -26,6 +26,7 @@
<td valign="top" align="left" nowrap="true" bgcolor="#EEEEEE">
<p>Checkstyle 2</p>
<ul>
<li><a href="#release2_4">Release 2.4</a></li>
<li><a href="#release2_3">Release 2.3</a></li>
<li><a href="#release2_2">Release 2.2</a></li>
<li><a href="#release2_1">Release 2.1</a></li>
@ -36,6 +37,30 @@
<!--Content-->
<td width="100%" valign="top" align="left">
<a name="release2_4"></a>
<h2>Release 2.4</h2>
<p class="body">
New features:
<ul>
<li class="body"> .</li>
</ul>
</p>
<p class="body">
Resolved bugs:
<ul>
<li class="body">Incorporate a patch from Ronald Hastings (Boeing) to correctly handle C++ style comments being between Javadoc comments and declarations.</li>
</ul>
</p>
<p class="body">
API changes (only relevant for IDE plugin authors):
<ul>
<li class="body">ANY CHANGES....</li>
</ul>
</p>
<a name="release2_3"></a>
<h2>Release 2.3</h2>
<p class="body">

View File

@ -49,6 +49,16 @@ class Verifier
/** compiled regexp to match Javadoc tags that take an argument **/
private static final RE MATCH_JAVADOC_ARG = createRE(MATCH_JAVADOC_ARG_PAT);
/**
* the pattern to match a single line comment containing only the comment
* itself -- no code.
**/
private static final String MATCH_SINGLELINE_COMMENT_PAT
= "^\\s*//.*$";
/** compiled regexp to match a single-line comment line **/
private static final RE MATCH_SINGLELINE_COMMENT =
createRE(MATCH_SINGLELINE_COMMENT_PAT);
/**
* the pattern to match the first line of a multi-line Javadoc
* tag that takes an argument. Javadoc with no arguments isn't
@ -1157,7 +1167,7 @@ class Verifier
int lineNo = aLineNo - 1;
// skip blank lines
while ((lineNo > 0) && lineIsBlank(lineNo)) {
while ((lineNo > 0) && (lineIsBlank(lineNo) || lineIsComment(lineNo))) {
lineNo--;
}
@ -1175,6 +1185,17 @@ class Verifier
return "".equals(mLines[aLineNo].trim());
}
/**
* Checks if the specified line is a single-line comment without code.
* @param aLineNo the line number to check
* @return if the specified line consists of only a single line comment
* without code.
**/
private boolean lineIsComment(int aLineNo)
{
return MATCH_SINGLELINE_COMMENT.match(mLines[aLineNo]);
}
/**
* Returns the tags in a javadoc comment. Only finds throws, exception,
* param, return and see tags.

View File

@ -160,4 +160,16 @@ class InputTags
/** getting code coverage up **/
static final int serialVersionUID = 666;
//**********************************************************************/
// Method Name: method16
/**
* handle the case of an elaborate header surrounding javadoc comments
*
* @param aOne valid parameter content
*/
//**********************************************************************/
void method16(int aOne)
{
}
}