Fixed a series of Checkstyle errors.

This commit is contained in:
Oliver Burn 2002-11-03 22:13:24 +00:00
parent ad0a4e637a
commit 065c1d3bc5
6 changed files with 9 additions and 20 deletions

View File

@ -116,8 +116,8 @@ class StringArrayReader extends Reader
return '\n';
}
if (mArrayIdx < mUnderlyingArray.length
&& mStringIdx < mUnderlyingArray[mArrayIdx].length() )
if ((mArrayIdx < mUnderlyingArray.length)
&& (mStringIdx < mUnderlyingArray[mArrayIdx].length()))
{
// this is the common case,
// avoid char[] creation in super.read for performance

View File

@ -16,14 +16,11 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.checks;
import org.apache.commons.beanutils.ConversionException;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
/**
* Abstract class for checks with options.

View File

@ -16,10 +16,8 @@
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
@ -45,22 +43,22 @@ public class EmptyBlockCheck extends AbstractOptionCheck
TokenTypes.STATIC_INIT,
// TODO: need to handle....
//TokenTypes.LITERAL_SWITCH,
//TODO: does this handle TokenTypes.LITERAL_SYNCHRONIZED?
//TODO: does this handle TokenTypes.LITERAL_SYNCHRONIZED?
};
}
/** @see com.puppycrawl.tools.checkstyle.api.Check */
public void visitToken(DetailAST aAST)
{
final DetailAST slistAST = aAST.findFirstToken(TokenTypes.SLIST);
if (slistAST != null) {
if (mOption == BlockOption.STMT) {
if (slistAST.getChildCount() <= 1) {
if (slistAST.getChildCount() <= 1) {
log(slistAST.getLineNo(),
slistAST.getColumnNo(),
"block.noStmt",
aAST.getText());
}
}
}
else if (mOption == BlockOption.TEXT) {
if (!hasText(slistAST)) {
@ -76,7 +74,7 @@ public class EmptyBlockCheck extends AbstractOptionCheck
private boolean hasText(final DetailAST slistAST)
{
boolean retVal = false;
final DetailAST rcurlyAST = slistAST.findFirstToken(TokenTypes.RCURLY);
if (rcurlyAST != null) {
final int slistLineNo = slistAST.getLineNo();
@ -103,8 +101,7 @@ public class EmptyBlockCheck extends AbstractOptionCheck
}
else {
// check if all lines are also only whitespace
for (int i = slistLineNo; i < (rcurlyLineNo - 1); i++)
{
for (int i = slistLineNo; i < (rcurlyLineNo - 1); i++) {
if (lines[i].trim().length() > 0) {
retVal = true;
break;
@ -112,7 +109,7 @@ public class EmptyBlockCheck extends AbstractOptionCheck
}
}
}
}
}
return retVal;
}
}

View File

@ -8,7 +8,6 @@
*/
package com.puppycrawl.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Utils;

View File

@ -19,11 +19,9 @@
package com.puppycrawl.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import com.puppycrawl.tools.checkstyle.api.Utils;
import org.apache.commons.beanutils.ConversionException;
/**
* Checks the padding of parenthesis.

View File

@ -18,10 +18,8 @@
////////////////////////////////////////////////////////////////////////////////
package com.puppycrawl.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
import org.apache.commons.beanutils.ConversionException;
/**
* Checks the placement of right curly braces.