patch for ignoring whitespace between Javadoc and declarations

This commit is contained in:
Oliver Burn 2001-12-03 00:42:42 +00:00
parent 11be0e3198
commit 4fade39e72
3 changed files with 34 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2001-12-03 Oliver Burn <oliver@cortexebusiness.com.au>
* src/checkstyle/com/puppycrawl/tools/checkstyle/VerifierImpl.java:
Included patch to ignore blank lines between Javadoc and the
declaration. From Lars kuehne [ lars _DOT_ kuehne _AT_ ppi _DOT_ de ].
2001-11-26 Oliver Burn <oliver@cortexebusiness.com.au>
* src/checkstyle/com/puppycrawl/tools/checkstyle/java.g

View File

@ -598,8 +598,25 @@ class VerifierImpl
**/
private String[] getJavadocBefore(int aLineNo)
{
// #HACK#: should be improved to skip blank lines.
return (String[]) mComments.get(new Integer(aLineNo - 1));
int lineNo = aLineNo - 1;
// skip blank lines
while ((lineNo > 0) && lineIsBlank(lineNo)) {
lineNo--;
}
return (String[]) mComments.get(new Integer(lineNo));
}
/**
* Checks if the specified line is blank.
* @param aLineNo the line number to check
* @return if the specified line consists only of tabs and spaces.
**/
private boolean lineIsBlank(int aLineNo)
{
// possible improvement: avoid garbage creation in trim()
return "".equals(mLines[aLineNo].trim());
}
/**

View File

@ -39,4 +39,13 @@ class InputWhitespace
catch(RuntimeException e){
}
}
/**
skip blank lines between comment and code,
should be ok
**/
private int mVar4 = 1;
}