Util classes should be moved out of api package. Issue #1057
This commit is contained in:
parent
93e0187129
commit
e3b3bfb999
10
pom.xml
10
pom.xml
|
|
@ -625,9 +625,10 @@
|
|||
<haltOnFailure>true</haltOnFailure>
|
||||
<branchRate>100</branchRate>
|
||||
<lineRate>100</lineRate>
|
||||
<totalBranchRate>84</totalBranchRate>
|
||||
<totalLineRate>92</totalLineRate>
|
||||
<totalBranchRate>82</totalBranchRate>
|
||||
<totalLineRate>90</totalLineRate>
|
||||
<regexes>
|
||||
<regex><pattern>.*.checkstyle.AnnotationUtility</pattern><branchRate>60</branchRate><lineRate>60</lineRate></regex>
|
||||
<regex><pattern>.*.Checker</pattern><branchRate>79</branchRate><lineRate>85</lineRate></regex>
|
||||
<regex><pattern>.*.ConfigurationLoader</pattern><branchRate>86</branchRate><lineRate>79</lineRate></regex>
|
||||
<regex><pattern>.*.ConfigurationLoader\$.*</pattern><branchRate>65</branchRate><lineRate>84</lineRate></regex>
|
||||
|
|
@ -640,6 +641,7 @@
|
|||
<regex><pattern>.*.PackageObjectFactory</pattern><branchRate>75</branchRate><lineRate>75</lineRate></regex>
|
||||
<regex><pattern>.*.PropertiesExpander</pattern><branchRate>50</branchRate><lineRate>83</lineRate></regex>
|
||||
<regex><pattern>.*.PropertyCacheFile</pattern><branchRate>22</branchRate><lineRate>19</lineRate></regex>
|
||||
<regex><pattern>.*.checkstyle.ScopeUtils</pattern><branchRate>90</branchRate><lineRate>94</lineRate></regex>
|
||||
<regex><pattern>.*.TreeWalker</pattern><branchRate>92</branchRate><lineRate>91</lineRate></regex>
|
||||
<regex><pattern>.*.XMLLogger</pattern><branchRate>86</branchRate><lineRate>97</lineRate></regex>
|
||||
|
||||
|
|
@ -647,7 +649,7 @@
|
|||
<regex><pattern>.*.api.AbstractFileSetCheck</pattern><branchRate>75</branchRate><lineRate>87</lineRate></regex>
|
||||
<regex><pattern>.*.api.AbstractLoader</pattern><branchRate>75</branchRate><lineRate>88</lineRate></regex>
|
||||
<regex><pattern>.*.api.AbstractViolationReporter</pattern><branchRate>100</branchRate><lineRate>90</lineRate></regex>
|
||||
<regex><pattern>.*.api.AnnotationUtility</pattern><branchRate>60</branchRate><lineRate>60</lineRate></regex>
|
||||
<regex><pattern>.*.api.AnnotationUtility</pattern><branchRate>0</branchRate><lineRate>0</lineRate></regex>
|
||||
<regex><pattern>.*.api.AuditEvent</pattern><branchRate>100</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.api.AutomaticBean</pattern><branchRate>90</branchRate><lineRate>82</lineRate></regex>
|
||||
<regex><pattern>.*.api.AutomaticBean\$.*</pattern><branchRate>75</branchRate><lineRate>90</lineRate></regex>
|
||||
|
|
@ -664,7 +666,7 @@
|
|||
<regex><pattern>.*.api.LineColumn</pattern><branchRate>0</branchRate><lineRate>60</lineRate></regex>
|
||||
<regex><pattern>.*.api.LocalizedMessage</pattern><branchRate>53</branchRate><lineRate>67</lineRate></regex>
|
||||
<regex><pattern>.*.api.LocalizedMessage\$.*</pattern><branchRate>41</branchRate><lineRate>66</lineRate></regex>
|
||||
<regex><pattern>.*.api.ScopeUtils</pattern><branchRate>90</branchRate><lineRate>94</lineRate></regex>
|
||||
<regex><pattern>.*.api.ScopeUtils</pattern><branchRate>0</branchRate><lineRate>0</lineRate></regex>
|
||||
<regex><pattern>.*.api.SeverityLevelCounter</pattern><branchRate>50</branchRate><lineRate>76</lineRate></regex>
|
||||
<regex><pattern>.*.api.TokenTypes</pattern><branchRate>62</branchRate><lineRate>80</lineRate></regex>
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* <p>
|
||||
* This method will not look for imports or package
|
||||
* statements to detect the passed in annotation.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
*
|
||||
* @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 <code>null</code>
|
||||
* 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.
|
||||
*
|
||||
* <p>
|
||||
* This method will not look for imports or package
|
||||
* statements to detect the passed in annotation.
|
||||
* </p>
|
||||
*
|
||||
* <p>
|
||||
* 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.
|
||||
* </p>
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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 <code>Scope</code> 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 <code>boolean</code> 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 <code>boolean</code> 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 <code>boolean</code> 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 <code>boolean</code> 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 <code>boolean</code> 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 <code>boolean</code> 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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
|
||||
{
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue