diff --git a/pom.xml b/pom.xml index 0dd959140..a13f2d19c 100644 --- a/pom.xml +++ b/pom.xml @@ -625,9 +625,10 @@ true 100 100 - 84 - 92 + 82 + 90 + .*.checkstyle.AnnotationUtility6060 .*.Checker7985 .*.ConfigurationLoader8679 .*.ConfigurationLoader\$.*6584 @@ -640,6 +641,7 @@ .*.PackageObjectFactory7575 .*.PropertiesExpander5083 .*.PropertyCacheFile2219 + .*.checkstyle.ScopeUtils9094 .*.TreeWalker9291 .*.XMLLogger8697 @@ -647,7 +649,7 @@ .*.api.AbstractFileSetCheck7587 .*.api.AbstractLoader7588 .*.api.AbstractViolationReporter10090 - .*.api.AnnotationUtility6060 + .*.api.AnnotationUtility00 .*.api.AuditEvent10093 .*.api.AutomaticBean9082 .*.api.AutomaticBean\$.*7590 @@ -664,7 +666,7 @@ .*.api.LineColumn060 .*.api.LocalizedMessage5367 .*.api.LocalizedMessage\$.*4166 - .*.api.ScopeUtils9094 + .*.api.ScopeUtils00 .*.api.SeverityLevelCounter5076 .*.api.TokenTypes6280 diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/AnnotationUtility.java b/src/main/java/com/puppycrawl/tools/checkstyle/AnnotationUtility.java new file mode 100644 index 000000000..20e5ec053 --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/AnnotationUtility.java @@ -0,0 +1,213 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2015 the original author or authors. +// +// 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; + +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.FullIdent; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; +import org.apache.commons.lang3.StringUtils; + +/** + * Contains utility methods designed to work with annotations. + * + * @author Travis Schneeberger + */ +public final class AnnotationUtility +{ + /** + * private utility constructor. + * @throws UnsupportedOperationException if called + */ + private AnnotationUtility() + { + throw new UnsupportedOperationException("do not instantiate."); + } + + /** + * Checks to see if the AST is annotated with + * the passed in annotation. + * + *

+ * This method will not look for imports or package + * statements to detect the passed in annotation. + *

+ * + *

+ * To check if an AST contains a passed in annotation + * taking into account fully-qualified names + * (ex: java.lang.Override, Override) + * this method will need to be called twice. Once for each + * name given. + *

+ * + * @param ast the current node + * @param annotation the annotation name to check for + * @return true if contains the annotation + * @throws NullPointerException if the ast or + * annotation is null + */ + public static boolean containsAnnotation(final DetailAST ast, + String annotation) + { + return AnnotationUtility.getAnnotation(ast, annotation) != null; + } + + /** + * Checks to see if the AST is annotated with + * any annotation. + * + * @param ast the current node + * @return true if contains an annotation + * @throws NullPointerException if the ast is null + */ + public static boolean containsAnnotation(final DetailAST ast) + { + final DetailAST holder = AnnotationUtility.getAnnotationHolder(ast); + return holder != null && holder.branchContains(TokenTypes.ANNOTATION); + } + + /** + * Gets the AST that holds a series of annotations for the + * potentially annotated AST. Returns null + * the passed in AST is not have an Annotation Holder. + * + * @param ast the current node + * @return the Annotation Holder + * @throws NullPointerException if the ast is null + */ + public static DetailAST getAnnotationHolder(DetailAST ast) + { + if (ast == null) { + throw new IllegalArgumentException("the ast is null"); + } + + final DetailAST annotationHolder; + + if (ast.getType() == TokenTypes.ENUM_CONSTANT_DEF + || ast.getType() == TokenTypes.PACKAGE_DEF) + { + annotationHolder = ast.findFirstToken(TokenTypes.ANNOTATIONS); + } + else { + annotationHolder = ast.findFirstToken(TokenTypes.MODIFIERS); + } + + return annotationHolder; + } + + /** + * Checks to see if the AST is annotated with + * the passed in annotation and return the AST + * representing that annotation. + * + *

+ * This method will not look for imports or package + * statements to detect the passed in annotation. + *

+ * + *

+ * To check if an AST contains a passed in annotation + * taking into account fully-qualified names + * (ex: java.lang.Override, Override) + * this method will need to be called twice. Once for each + * name given. + *

+ * + * @param ast the current node + * @param annotation the annotation name to check for + * @return the AST representing that annotation + * @throws NullPointerException if the ast or + * annotation is null + */ + public static DetailAST getAnnotation(final DetailAST ast, + String annotation) + { + if (ast == null) { + throw new IllegalArgumentException("the ast is null"); + } + + if (annotation == null) { + throw new IllegalArgumentException("the annotation is null"); + } + + if (StringUtils.isBlank(annotation)) { + throw new IllegalArgumentException("the annotation" + + "is empty or spaces"); + } + + final DetailAST holder = AnnotationUtility.getAnnotationHolder(ast); + + for (DetailAST child = holder.getFirstChild(); + child != null; child = child.getNextSibling()) + { + if (child.getType() == TokenTypes.ANNOTATION) { + final DetailAST at = child.getFirstChild(); + final String name = + FullIdent.createFullIdent(at.getNextSibling()).getText(); + if (annotation.equals(name)) { + return child; + } + } + } + + return null; + } + + /** + * Checks to see what the passed in AST (representing + * an annotation) is annotating. + * + * @param ast the AST representing an annotation. + * @return the AST the annotation is annotating. + * @throws NullPointerException if the ast is null + * @throws IllegalArgumentException if the ast is not + * an {@link TokenTypes#ANNOTATION} + */ + public static DetailAST annotatingWhat(DetailAST ast) + { + if (ast == null) { + throw new IllegalArgumentException("the ast is null"); + } + + if (ast.getType() != TokenTypes.ANNOTATION) { + throw new IllegalArgumentException( + "The ast is not an annotation. AST: " + ast); + } + + return ast.getParent().getParent(); + } + + /** + * Checks to see if the passed in AST (representing + * an annotation) is annotating the passed in type. + * @param ast the AST representing an annotation + * @param tokenType the passed in type + * @return true if the annotation is annotating a type + * equal to the passed in type + * @throws NullPointerException if the ast is null + * @throws IllegalArgumentException if the ast is not + * an {@link TokenTypes#ANNOTATION} + */ + public static boolean isAnnotatingType(DetailAST ast, int tokenType) + { + final DetailAST astNode = AnnotationUtility.annotatingWhat(ast); + return astNode.getType() == tokenType; + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/ScopeUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/ScopeUtils.java new file mode 100644 index 000000000..bc665525d --- /dev/null +++ b/src/main/java/com/puppycrawl/tools/checkstyle/ScopeUtils.java @@ -0,0 +1,304 @@ +//////////////////////////////////////////////////////////////////////////////// +// checkstyle: Checks Java source code for adherence to a set of rules. +// Copyright (C) 2001-2015 the original author or authors. +// +// 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; + +import antlr.collections.AST; +import com.puppycrawl.tools.checkstyle.api.DetailAST; +import com.puppycrawl.tools.checkstyle.api.Scope; +import com.puppycrawl.tools.checkstyle.api.TokenTypes; + +/** + * Contains utility methods for working on scope. + * + * @author Oliver Burn + */ +public final class ScopeUtils +{ + /** prevent instantiation */ + private ScopeUtils() + { + } + + /** + * Returns the Scope specified by the modifier set. + * + * @param aMods root node of a modifier set + * @return a Scope value + */ + public static Scope getScopeFromMods(DetailAST aMods) + { + Scope retVal = Scope.PACKAGE; // default scope + for (AST token = aMods.getFirstChild(); + token != null; + token = token.getNextSibling()) + { + if ("public".equals(token.getText())) { + retVal = Scope.PUBLIC; + break; + } + else if ("protected".equals(token.getText())) { + retVal = Scope.PROTECTED; + break; + } + else if ("private".equals(token.getText())) { + retVal = Scope.PRIVATE; + break; + } + } + return retVal; + } + + /** + * Returns the scope of the surrounding "block". + * @param aAST the node to return the scope for + * @return the Scope of the surrounding block + */ + public static Scope getSurroundingScope(DetailAST aAST) + { + Scope retVal = null; + for (DetailAST token = aAST.getParent(); + token != null; + token = token.getParent()) + { + final int type = token.getType(); + if (type == TokenTypes.CLASS_DEF + || type == TokenTypes.INTERFACE_DEF + || type == TokenTypes.ANNOTATION_DEF + || type == TokenTypes.ENUM_DEF) + { + final DetailAST mods = + token.findFirstToken(TokenTypes.MODIFIERS); + final Scope modScope = ScopeUtils.getScopeFromMods(mods); + if (retVal == null || retVal.isIn(modScope)) { + retVal = modScope; + } + } + else if (type == TokenTypes.LITERAL_NEW) { + retVal = Scope.ANONINNER; + break; //because Scope.ANONINNER is not in any other Scope + } + } + + return retVal; + } + + /** + * Returns whether a node is directly contained within an interface block. + * + * @param aAST the node to check if directly contained within an interface + * block + * @return a boolean value + */ + public static boolean inInterfaceBlock(DetailAST aAST) + { + boolean retVal = false; + + // Loop up looking for a containing interface block + for (DetailAST token = aAST.getParent(); + token != null; + token = token.getParent()) + { + final int type = token.getType(); + if (type == TokenTypes.CLASS_DEF + || type == TokenTypes.ENUM_DEF + || type == TokenTypes.ANNOTATION_DEF) + { + break; // in a class, enum or annotation + } + else if (type == TokenTypes.LITERAL_NEW) { + break; // inner implementation + } + else if (type == TokenTypes.INTERFACE_DEF) { + retVal = true; + break; + } + } + + return retVal; + } + + /** + * Returns whether a node is directly contained within an annotation block. + * + * @param aAST the node to check if directly contained within an annotation + * block + * @return a boolean value + */ + public static boolean inAnnotationBlock(DetailAST aAST) + { + boolean retVal = false; + + // Loop up looking for a containing interface block + for (DetailAST token = aAST.getParent(); + token != null; + token = token.getParent()) + { + final int type = token.getType(); + if (type == TokenTypes.CLASS_DEF + || type == TokenTypes.ENUM_DEF + || type == TokenTypes.INTERFACE_DEF) + { + break; // in a class, enum or interface + } + else if (type == TokenTypes.LITERAL_NEW) { + break; // inner implementation + } + else if (type == TokenTypes.ANNOTATION_DEF) { + retVal = true; + break; + } + } + + return retVal; + } + + /** + * Returns whether a node is directly contained within an interface or + * annotation block. + * + * @param aAST the node to check if directly contained within an interface + * or annotation block + * @return a boolean value + */ + public static boolean inInterfaceOrAnnotationBlock(DetailAST aAST) + { + return inInterfaceBlock(aAST) || inAnnotationBlock(aAST); + } + + /** + * Returns whether a node is directly contained within an enum block. + * + * @param aAST the node to check if directly contained within an enum + * block + * @return a boolean value + */ + public static boolean inEnumBlock(DetailAST aAST) + { + boolean retVal = false; + + // Loop up looking for a containing interface block + for (DetailAST token = aAST.getParent(); + token != null; + token = token.getParent()) + { + final int type = token.getType(); + if (type == TokenTypes.INTERFACE_DEF + || type == TokenTypes.ANNOTATION_DEF + || type == TokenTypes.CLASS_DEF) + { + break; // in an interface, annotation or class + } + else if (type == TokenTypes.LITERAL_NEW) { + break; // inner implementation, enums can't be inner classes + } + else if (type == TokenTypes.ENUM_DEF) { + retVal = true; + break; + } + } + + return retVal; + } + + /** + * Returns whether the scope of a node is restricted to a code block. + * A code block is a method or constructor body, or a initialiser block. + * + * @param aAST the node to check + * @return a boolean value + */ + public static boolean inCodeBlock(DetailAST aAST) + { + boolean retVal = false; + + // Loop up looking for a containing code block + for (DetailAST token = aAST.getParent(); + token != null; + token = token.getParent()) + { + final int type = token.getType(); + if (type == TokenTypes.METHOD_DEF + || type == TokenTypes.CTOR_DEF + || type == TokenTypes.INSTANCE_INIT + || type == TokenTypes.STATIC_INIT) + { + retVal = true; + break; + } + } + + return retVal; + } + + /** + * Returns whether a node is contained in the outer most type block. + * + * @param aAST the node to check + * @return a boolean value + */ + public static boolean isOuterMostType(DetailAST aAST) + { + boolean retVal = true; + for (DetailAST parent = aAST.getParent(); + parent != null; + parent = parent.getParent()) + { + if (parent.getType() == TokenTypes.CLASS_DEF + || parent.getType() == TokenTypes.INTERFACE_DEF + || parent.getType() == TokenTypes.ANNOTATION_DEF + || parent.getType() == TokenTypes.ENUM_DEF) + { + retVal = false; + break; + } + } + + return retVal; + } + + /** + * Determines whether a node is a local variable definition. + * I.e. if it is declared in a code block, a for initializer, + * or a catch parameter. + * @param aAST the node to check. + * @return whether aAST is a local variable definition. + */ + public static boolean isLocalVariableDef(DetailAST aAST) + { + // variable declaration? + if (aAST.getType() == TokenTypes.VARIABLE_DEF) { + final DetailAST parent = aAST.getParent(); + if (parent != null) { + final int type = parent.getType(); + return type == TokenTypes.SLIST + || type == TokenTypes.FOR_INIT + || type == TokenTypes.FOR_EACH_CLAUSE; + } + } + // catch parameter? + else if (aAST.getType() == TokenTypes.PARAMETER_DEF) { + final DetailAST parent = aAST.getParent(); + if (parent != null) { + return parent.getType() == TokenTypes.LITERAL_CATCH; + } + } + return false; + } +} diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/AnnotationUtility.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/AnnotationUtility.java index 809058782..09db62976 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/AnnotationUtility.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/AnnotationUtility.java @@ -25,7 +25,12 @@ import org.apache.commons.lang3.StringUtils; * Contains utility methods designed to work with annotations. * * @author Travis Schneeberger + * + * @deprecated will be removed completely in next releases + * Replaced by exact copy but in non api package + * {@link com.puppycrawl.tools.checkstyle.AnnotationUtility} */ +@Deprecated public final class AnnotationUtility { /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTagInfo.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTagInfo.java index bf1ac0153..160041da9 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTagInfo.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/JavadocTagInfo.java @@ -20,6 +20,8 @@ package com.puppycrawl.tools.checkstyle.api; import com.google.common.collect.ImmutableMap; +import com.puppycrawl.tools.checkstyle.ScopeUtils; + import java.util.Map; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/api/ScopeUtils.java b/src/main/java/com/puppycrawl/tools/checkstyle/api/ScopeUtils.java index dd095f674..45330bbe4 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/api/ScopeUtils.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/api/ScopeUtils.java @@ -25,7 +25,13 @@ import antlr.collections.AST; * Contains utility methods for working on scope. * * @author Oliver Burn + * + * @deprecated will be removed completely in next releases + * Replaced by exact copy but in non api package + * {@link com.puppycrawl.tools.checkstyle.ScopeUtils} + * */ +@Deprecated public final class ScopeUtils { /** prevent instantiation */ diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DeclarationCollector.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DeclarationCollector.java index f627a0b28..d1af5e513 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/DeclarationCollector.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/DeclarationCollector.java @@ -24,7 +24,7 @@ import com.google.common.collect.Maps; import com.google.common.collect.Sets; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.Deque; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java index bdd976239..14b3bb3c6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingDeprecatedCheck.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.annotation; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.JavadocTagInfo; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java index eecf3a670..e74ce442c 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/MissingOverrideCheck.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.annotation; import java.util.regex.Matcher; import java.util.regex.Pattern; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.JavadocTagInfo; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java index f4039e00f..47e23cef3 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/PackageAnnotationCheck.java @@ -19,7 +19,7 @@ package com.puppycrawl.tools.checkstyle.checks.annotation; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java index 45a882ff3..654fba7ea 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/annotation/SuppressWarningsCheck.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.annotation; import java.util.regex.Matcher; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.AbstractFormatCheck; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java index a2619a504..d5c7e1e92 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/AbstractSuperCheck.java @@ -23,7 +23,7 @@ import antlr.collections.AST; import com.google.common.collect.Lists; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.Deque; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java index 78d384ff7..6bdcb6ee1 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/DeclarationOrderCheck.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.ArrayDeque; import java.util.Deque; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java index 11828c5c1..7501f2d62 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/ExplicitInitializationCheck.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.CheckUtils; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java index 8dcb71453..e52a8b7ef 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/FinalLocalVariableCheck.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.ArrayDeque; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java index 930db7ce2..cd377d1a6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/HiddenFieldCheck.java @@ -23,7 +23,7 @@ import com.google.common.base.Objects; import com.google.common.collect.Sets; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.Utils; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java index d3834a615..1573c00ca 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/IllegalThrowsCheck.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import com.google.common.collect.Sets; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent; import com.puppycrawl.tools.checkstyle.api.TokenTypes; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java index da4ccbc2f..93bca2ec3 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/MagicNumberCheck.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.CheckUtils; import java.util.Arrays; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java index de3114c70..b3cdb70fc 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/coding/RequireThisCheck.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.coding; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.DeclarationCollector; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java index 8f682bf85..e52a3acec 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/DesignForExtensionCheck.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java index 43b099d06..fa939b68d 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/FinalClassCheck.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.ArrayDeque; import java.util.Deque; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java index a58a6add9..f113b6235 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/InnerTypeLastCheck.java @@ -21,7 +21,7 @@ package com.puppycrawl.tools.checkstyle.checks.design; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java index 17757d9e1..02078822b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/design/VisibilityModifierCheck.java @@ -29,11 +29,11 @@ import java.util.regex.Pattern; import antlr.collections.AST; import com.google.common.collect.ImmutableList; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FullIdent; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.Utils; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java index 7ab0cc118..2102de4ae 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocMethodCheck.java @@ -28,7 +28,7 @@ import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.FullIdent; import com.puppycrawl.tools.checkstyle.api.JavadocTagInfo; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TextBlock; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.Utils; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java index fabbfac03..284107903 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocStyleCheck.java @@ -25,7 +25,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.JavadocTagInfo; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TextBlock; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.checks.CheckUtils; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java index 6fc6d51d5..cdecfdfa6 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocTypeCheck.java @@ -24,7 +24,7 @@ import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.JavadocTagInfo; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TextBlock; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import com.puppycrawl.tools.checkstyle.Utils; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java index 4b2435884..770c9e86f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/javadoc/JavadocVariableCheck.java @@ -24,7 +24,7 @@ import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.FileContents; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TextBlock; import com.puppycrawl.tools.checkstyle.api.TokenTypes; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java index e6ffd95fe..23a8c0a0f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/ConstantNameCheck.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java index 94c445a7f..3d3b2f9ab 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalFinalVariableNameCheck.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java index 95a18f4b8..7161bff82 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/LocalVariableNameCheck.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming; import java.util.regex.Pattern; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java index 7ce896b69..2e4306c8a 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MemberNameCheck.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java index 0b8842cb0..3a1073136 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/MethodNameCheck.java @@ -19,7 +19,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java index 99d7091b2..d93841d0b 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/naming/StaticVariableNameCheck.java @@ -20,7 +20,7 @@ package com.puppycrawl.tools.checkstyle.checks.naming; import com.puppycrawl.tools.checkstyle.api.DetailAST; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; /** diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.java index 9e55870da..f5fc8e32f 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/MethodCountCheck.java @@ -22,7 +22,7 @@ package com.puppycrawl.tools.checkstyle.checks.sizes; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.Scope; -import com.puppycrawl.tools.checkstyle.api.ScopeUtils; +import com.puppycrawl.tools.checkstyle.ScopeUtils; import com.puppycrawl.tools.checkstyle.api.TokenTypes; import java.util.ArrayDeque; diff --git a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java index 9dce7ae62..c9f2c3d04 100644 --- a/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java +++ b/src/main/java/com/puppycrawl/tools/checkstyle/checks/sizes/ParameterNumberCheck.java @@ -19,7 +19,7 @@ package com.puppycrawl.tools.checkstyle.checks.sizes; -import com.puppycrawl.tools.checkstyle.api.AnnotationUtility; +import com.puppycrawl.tools.checkstyle.AnnotationUtility; import com.puppycrawl.tools.checkstyle.api.Check; import com.puppycrawl.tools.checkstyle.api.DetailAST; import com.puppycrawl.tools.checkstyle.api.TokenTypes;