... and make sure they can be compiled

This commit is contained in:
Lars Kühne 2002-09-15 16:55:59 +00:00
parent 15b4a0f888
commit 1d528505f9
7 changed files with 179 additions and 89 deletions

View File

@ -1,17 +1,37 @@
/*
* Created by IntelliJ IDEA.
* User: oliver.burn
* Date: 13/09/2002
* Time: 22:23:58
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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.JavaTokenTypes;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
/**
* Check that finds import statement that use the * notation.
* <p>
* Rationale: Importing all classes from a package leads to tight coupling between
* packages and might lead to problems when a new version of a library introduces
* name clashes.
*
* @author Oliver Burn
* @version $Id: AvoidStarImport.java,v 1.2 2002-09-15 16:55:59 lkuehne Exp $
*/
package visitor.checks;
import visitor.checks.ImportCheck;
import visitor.JavaTokenTypes;
import visitor.DetailAST;
public class AvoidStarImport extends ImportCheck
{
public int[] getDefaultTokens()
@ -19,7 +39,7 @@ public class AvoidStarImport extends ImportCheck
return new int[] {JavaTokenTypes.IMPORT};
}
public void visitToken(DetailAST aAST)
public void visitToken(com.puppycrawl.tools.checkstyle.api.DetailAST aAST)
{
final String name = getImportText(aAST);
if ((name != null) && name.endsWith(".*")) {

View File

@ -1,19 +1,30 @@
/*
* Created by IntelliJ IDEA.
* User: lk
* Date: Sep 15, 2002
* Time: 8:32:39 AM
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package visitor.checks;
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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 java.util.Set;
import java.util.HashSet;
import visitor.api.Check;
import visitor.DetailAST;
import visitor.JavaTokenTypes;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import com.puppycrawl.tools.checkstyle.JavaTokenTypes;
public class EmptyBlockCheck extends Check
{

View File

@ -1,17 +1,31 @@
/*
* Created by IntelliJ IDEA.
* User: oliver.burn
* Date: 13/09/2002
* Time: 20:26:30
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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.JavaTokenTypes;
/**
* Abstract
*/
package visitor.checks;
import visitor.api.Check;
import visitor.DetailAST;
import visitor.JavaTokenTypes;
public abstract class ImportCheck
extends Check
{

View File

@ -1,23 +1,33 @@
/*
* Created by IntelliJ IDEA.
* User: oliver.burn
* Date: 14/09/2002
* Time: 09:51:28
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package visitor.checks;
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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 antlr.collections.AST;
import java.util.Map;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import visitor.api.Check;
import visitor.JavaTokenTypes;
import visitor.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.JavaTokenTypes;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
public class ModifierCheck extends Check
{

View File

@ -1,18 +1,33 @@
/*
* Created by IntelliJ IDEA.
* User: lk
* Date: Sep 14, 2002
* Time: 3:13:55 PM
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package visitor.checks;
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// 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 antlr.collections.AST;
import visitor.api.Check;
import visitor.JavaTokenTypes;
import visitor.DetailAST;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.JavaTokenTypes;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
/**
* Checks for overly complicated return
*/
public class SimplifyBooleanReturnCheck extends Check
{
public int[] getDefaultTokens()

View File

@ -1,16 +1,27 @@
/*
* Created by IntelliJ IDEA.
* User: oliver.burn
* Date: 13/09/2002
* Time: 23:04:45
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package visitor.checks;
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
import visitor.checks.ImportCheck;
import visitor.JavaTokenTypes;
import visitor.DetailAST;
package com.puppycrawl.tools.checkstyle.checks;
import com.puppycrawl.tools.checkstyle.checks.ImportCheck;
import com.puppycrawl.tools.checkstyle.JavaTokenTypes;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
import java.util.HashSet;
import java.util.Set;

View File

@ -1,18 +1,27 @@
/*
* Created by IntelliJ IDEA.
* User: oliver.burn
* Date: 14/09/2002
* Time: 11:55:01
* To change template for new class use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package visitor.checks;
////////////////////////////////////////////////////////////////////////////////
// checkstyle: Checks Java source code for adherence to a set of rules.
// Copyright (C) 2001-2002 Oliver Burn
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
////////////////////////////////////////////////////////////////////////////////
import visitor.api.Check;
import visitor.JavaTokenTypes;
import visitor.DetailAST;
package com.puppycrawl.tools.checkstyle.checks;
import java.util.Map;
import com.puppycrawl.tools.checkstyle.api.Check;
import com.puppycrawl.tools.checkstyle.JavaTokenTypes;
import com.puppycrawl.tools.checkstyle.api.DetailAST;
public class WhitespaceAroundCheck extends Check
{