本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.IMPORT属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.IMPORT属性的具体用法?Java TokenTypes.IMPORT怎么用?Java TokenTypes.IMPORT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.IMPORT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: visitToken
@Override
public void visitToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.VARIABLE_DEF:
if (!isAnonymousClassVariable(ast)) {
visitVariableDef(ast);
}
break;
case TokenTypes.IMPORT:
visitImport(ast);
break;
default:
final String exceptionMsg = "Unexpected token type: " + ast.getText();
throw new IllegalArgumentException(exceptionMsg);
}
}
示例3: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final ClassFanOutComplexityCheck classFanOutComplexityCheckObj =
new ClassFanOutComplexityCheck();
final int[] actual = classFanOutComplexityCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.TYPE,
TokenTypes.LITERAL_NEW,
TokenTypes.LITERAL_THROWS,
TokenTypes.ANNOTATION_DEF,
};
Assert.assertNotNull("Acceptable tokens should not be null", actual);
Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual);
}
示例4: visitToken
@Override
public final void visitToken(DetailAST ast) {
if (ast.getType() == TokenTypes.PACKAGE_DEF) {
processPackage(ast);
}
else if (ast.getType() == TokenTypes.IMPORT) {
processImport(ast);
}
else if (ast.getType() == TokenTypes.CLASS_DEF
|| ast.getType() == TokenTypes.INTERFACE_DEF
|| ast.getType() == TokenTypes.ENUM_DEF) {
processClass(ast);
}
else {
if (ast.getType() == TokenTypes.METHOD_DEF) {
processTypeParams(ast);
}
processAST(ast);
}
}
示例5: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final EmptyLineSeparatorCheck emptyLineSeparatorCheckObj = new EmptyLineSeparatorCheck();
final int[] actual = emptyLineSeparatorCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.STATIC_INIT,
TokenTypes.INSTANCE_INIT,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例6: getDefaultTokens
/**
* @return the tokens that are delivered from the parser to this class.
*/
@Override
public int[] getDefaultTokens() {
return new int[] { TokenTypes.ABSTRACT, TokenTypes.PACKAGE_DEF, TokenTypes.INTERFACE_DEF, TokenTypes.CLASS_DEF,
TokenTypes.ANNOTATION, TokenTypes.IMPORT, TokenTypes.IMPLEMENTS_CLAUSE, TokenTypes.EXTENDS_CLAUSE,
TokenTypes.TYPE };
}
示例7: getRequiredTokens
@Override
public int[] getRequiredTokens() {
return new int[] {
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.TYPE,
TokenTypes.LITERAL_NEW,
TokenTypes.LITERAL_THROWS,
TokenTypes.ANNOTATION_DEF,
};
}
示例8: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final JavaNCSSCheck javaNcssCheckObj = new JavaNCSSCheck();
final int[] actual = javaNcssCheckObj.getRequiredTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.INSTANCE_INIT,
TokenTypes.STATIC_INIT,
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.VARIABLE_DEF,
TokenTypes.CTOR_CALL,
TokenTypes.SUPER_CTOR_CALL,
TokenTypes.LITERAL_IF,
TokenTypes.LITERAL_ELSE,
TokenTypes.LITERAL_WHILE,
TokenTypes.LITERAL_DO,
TokenTypes.LITERAL_FOR,
TokenTypes.LITERAL_SWITCH,
TokenTypes.LITERAL_BREAK,
TokenTypes.LITERAL_CONTINUE,
TokenTypes.LITERAL_RETURN,
TokenTypes.LITERAL_THROW,
TokenTypes.LITERAL_SYNCHRONIZED,
TokenTypes.LITERAL_CATCH,
TokenTypes.LITERAL_FINALLY,
TokenTypes.EXPR,
TokenTypes.LABELED_STAT,
TokenTypes.LITERAL_CASE,
TokenTypes.LITERAL_DEFAULT,
};
Assert.assertNotNull("Required tokens should not be null", actual);
Assert.assertArrayEquals("Invalid required tokens", expected, actual);
}
示例9: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.IMPORT,
};
}
示例10: testGetRequiredTokens
@Test
public void testGetRequiredTokens() {
final VisibilityModifierCheck checkObj = new VisibilityModifierCheck();
final int[] expected = {
TokenTypes.VARIABLE_DEF,
TokenTypes.IMPORT,
};
assertArrayEquals("Default required tokens are invalid",
expected, checkObj.getRequiredTokens());
}
示例11: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.IMPORT,
TokenTypes.LITERAL_NEW,
TokenTypes.PACKAGE_DEF,
TokenTypes.CLASS_DEF,
};
}
示例12: 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);
}
示例13: 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);
}
示例14: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.PACKAGE_DEF,
TokenTypes.IMPORT,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.STATIC_INIT,
TokenTypes.INSTANCE_INIT,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
};
}
示例15: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final IllegalImportCheck testCheckObject =
new IllegalImportCheck();
final int[] actual = testCheckObject.getAcceptableTokens();
final int[] expected = {TokenTypes.IMPORT, TokenTypes.STATIC_IMPORT};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}