本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.STATIC_IMPORT属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.STATIC_IMPORT属性的具体用法?Java TokenTypes.STATIC_IMPORT怎么用?Java TokenTypes.STATIC_IMPORT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.STATIC_IMPORT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitToken
@Override
public void visitToken(DetailAST ast) {
if (ast.getType() == TokenTypes.IDENT) {
if (collect) {
processIdent(ast);
}
}
else if (ast.getType() == TokenTypes.IMPORT) {
processImport(ast);
}
else if (ast.getType() == TokenTypes.STATIC_IMPORT) {
processStaticImport(ast);
}
else {
collect = true;
if (processJavadoc) {
collectReferencesFromJavadoc(ast);
}
}
}
示例2: visitToken
@Override
public void visitToken(DetailAST ast) {
if (ast.getType() == TokenTypes.PACKAGE_DEF) {
if (customImportOrderRules.contains(SAME_PACKAGE_RULE_GROUP)) {
samePackageDomainsRegExp = createSamePackageRegexp(
samePackageMatchingDepth, ast);
}
}
else {
final String importFullPath = getFullImportIdent(ast);
final int lineNo = ast.getLineNo();
final boolean isStatic = ast.getType() == TokenTypes.STATIC_IMPORT;
importToGroupList.add(new ImportDetails(importFullPath,
lineNo, getImportGroup(isStatic, importFullPath),
isStatic));
}
}
示例3: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final UnusedImportsCheck testCheckObject =
new UnusedImportsCheck();
final int[] actual = testCheckObject.getRequiredTokens();
final int[] expected = {
TokenTypes.IDENT,
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
// Definitions that may contain Javadoc...
TokenTypes.PACKAGE_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ENUM_CONSTANT_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
};
assertArrayEquals("Default required tokens are invalid", expected, actual);
}
示例4: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final UnusedImportsCheck testCheckObject =
new UnusedImportsCheck();
final int[] actual = testCheckObject.getAcceptableTokens();
final int[] expected = {
TokenTypes.IDENT,
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
// Definitions that may contain Javadoc...
TokenTypes.PACKAGE_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ENUM_CONSTANT_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例5: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final AvoidStarImportCheck testCheckObject =
new AvoidStarImportCheck();
final int[] actual = testCheckObject.getRequiredTokens();
final int[] expected = {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};
assertArrayEquals("Default required tokens are invalid", expected, actual);
}
示例6: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
TokenTypes.PACKAGE_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.INTERFACE_DEF,
};
}
示例7: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final AvoidStarImportCheck testCheckObject =
new AvoidStarImportCheck();
final int[] actual = testCheckObject.getAcceptableTokens();
final int[] expected = {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例8: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final ImportControlCheck testCheckObject =
new ImportControlCheck();
final int[] actual = testCheckObject.getAcceptableTokens();
final int[] expected = {
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例9: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
TokenTypes.PACKAGE_DEF,
};
}
示例10: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final RedundantImportCheck testCheckObject =
new RedundantImportCheck();
final int[] actual = testCheckObject.getAcceptableTokens();
final int[] expected = {
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
TokenTypes.PACKAGE_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例11: getRequiredTokens
@Override
public int[] getRequiredTokens() {
// original implementation checks both IMPORT and STATIC_IMPORT tokens to avoid ".*" imports
// however user can allow using "import" or "import static"
// by configuring allowClassImports and allowStaticMemberImports
// To avoid potential confusion when user specifies conflicting options on configuration
// (see example below) we are adding both tokens to Required list
// <module name="AvoidStarImport">
// <property name="tokens" value="IMPORT"/>
// <property name="allowStaticMemberImports" value="false"/>
// </module>
return new int[] {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};
}
示例12: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final AvoidStaticImportCheck checkObj = new AvoidStaticImportCheck();
final int[] expected = {TokenTypes.STATIC_IMPORT};
assertArrayEquals("Default required tokens are invalid",
expected, checkObj.getRequiredTokens());
}
示例13: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final ImportControlCheck checkObj = new ImportControlCheck();
final int[] expected = {
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
};
assertArrayEquals("Default required tokens are invalid",
expected, checkObj.getRequiredTokens());
}
示例14: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final CustomImportOrderCheck checkObj = new CustomImportOrderCheck();
final int[] expected = {
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
TokenTypes.PACKAGE_DEF,
};
assertArrayEquals("Default required tokens are invalid",
expected, checkObj.getRequiredTokens());
}
示例15: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final CustomImportOrderCheck testCheckObject =
new CustomImportOrderCheck();
final int[] actual = testCheckObject.getAcceptableTokens();
final int[] expected = {
TokenTypes.IMPORT,
TokenTypes.STATIC_IMPORT,
TokenTypes.PACKAGE_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}