本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.INTERFACE_DEF属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.INTERFACE_DEF属性的具体用法?Java TokenTypes.INTERFACE_DEF怎么用?Java TokenTypes.INTERFACE_DEF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.puppycrawl.tools.checkstyle.api.TokenTypes
的用法示例。
在下文中一共展示了TokenTypes.INTERFACE_DEF属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
}
示例2: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final RedundantModifierCheck redundantModifierCheckObj = new RedundantModifierCheck();
final int[] actual = redundantModifierCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.METHOD_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.RESOURCE,
};
Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual);
}
示例3: getAcceptableTokens
@Override
public int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
}
示例4: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final AnnotationOnSameLineCheck constantNameCheckObj = new AnnotationOnSameLineCheck();
final int[] actual = constantNameCheckObj.getAcceptableTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.TYPECAST,
TokenTypes.LITERAL_THROWS,
TokenTypes.IMPLEMENTS_CLAUSE,
TokenTypes.TYPE_ARGUMENT,
TokenTypes.LITERAL_NEW,
TokenTypes.DOT,
TokenTypes.ANNOTATION_FIELD_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例5: testAuthor
@Test
public void testAuthor() {
final DetailAST ast = new DetailAST();
final int[] validTypes = {
TokenTypes.PACKAGE_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF,
};
for (int type: validTypes) {
ast.setType(type);
assertTrue("Invalid ast type for current tag: " + ast.getType(),
JavadocTagInfo.AUTHOR.isValidOn(ast));
}
ast.setType(TokenTypes.LAMBDA);
assertFalse("Should return false when ast type is invalid for current tag",
JavadocTagInfo.AUTHOR.isValidOn(ast));
}
示例6: leaveToken
@Override
public void leaveToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.CLASS_DEF :
case TokenTypes.INTERFACE_DEF :
case TokenTypes.ENUM_DEF :
case TokenTypes.ANNOTATION_DEF :
case TokenTypes.SLIST :
case TokenTypes.METHOD_DEF :
case TokenTypes.CTOR_DEF :
case TokenTypes.LITERAL_FOR:
current.pop();
break;
default :
// do nothing
}
}
示例7: getSurroundingScope
/**
* Returns the scope of the surrounding "block".
* @param node the node to return the scope for
* @return the Scope of the surrounding block
*/
public static Scope getSurroundingScope(DetailAST node) {
Scope returnValue = null;
for (DetailAST token = node.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 = getScopeFromMods(mods);
if (returnValue == null || returnValue.isIn(modScope)) {
returnValue = modScope;
}
}
else if (type == TokenTypes.LITERAL_NEW) {
returnValue = Scope.ANONINNER;
// because Scope.ANONINNER is not in any other Scope
break;
}
}
return returnValue;
}
示例8: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final OuterTypeFilenameCheck check = new OuterTypeFilenameCheck();
final int[] actual = check.getAcceptableTokens();
final int[] expected = {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF,
};
assertArrayEquals("Acceptable tokens array differs from expected",
expected, actual);
}
示例9: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final JavaNCSSCheck javaNcssCheckObj = new JavaNCSSCheck();
final int[] actual = javaNcssCheckObj.getAcceptableTokens();
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("Acceptable tokens should not be null", actual);
Assert.assertArrayEquals("Invalid acceptable tokens", expected, actual);
}
示例10: 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,
};
}
示例11: visitToken
@Override
public void visitToken(DetailAST ast) {
if (ast.getType() == TokenTypes.INTERFACE_DEF) {
checkInterfaceModifiers(ast);
}
else if (ast.getType() == TokenTypes.ENUM_DEF) {
checkEnumDef(ast);
}
else {
if (ast.getType() == TokenTypes.CTOR_DEF) {
if (isEnumMember(ast)) {
checkEnumConstructorModifiers(ast);
}
else {
checkClassConstructorModifiers(ast);
}
}
else if (ast.getType() == TokenTypes.METHOD_DEF) {
processMethods(ast);
}
else if (ast.getType() == TokenTypes.RESOURCE) {
processResources(ast);
}
if (isInterfaceOrAnnotationMember(ast)) {
processInterfaceOrAnnotation(ast);
}
}
}
示例12: getAcceptableTokens
@Override
public final int[] getAcceptableTokens() {
return new int[] {
TokenTypes.CLASS_DEF,
TokenTypes.INTERFACE_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF,
TokenTypes.ANNOTATION_FIELD_DEF,
TokenTypes.ENUM_CONSTANT_DEF,
TokenTypes.PARAMETER_DEF,
TokenTypes.VARIABLE_DEF,
TokenTypes.METHOD_DEF,
TokenTypes.CTOR_DEF,
};
}
示例13: testGetAcceptableTokens
@Test
public void testGetAcceptableTokens() {
final JavadocTypeCheck javadocTypeCheck = new JavadocTypeCheck();
final int[] actual = javadocTypeCheck.getAcceptableTokens();
final int[] expected = {
TokenTypes.INTERFACE_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF,
};
assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
示例14: leaveToken
@Override
public void leaveToken(DetailAST ast) {
switch (ast.getType()) {
case TokenTypes.CLASS_DEF:
case TokenTypes.INTERFACE_DEF:
case TokenTypes.ANNOTATION_DEF:
case TokenTypes.ENUM_DEF:
leaveClassDef();
break;
default:
// Do nothing
}
}
示例15: getDefaultTokens
@Override
public int[] getDefaultTokens() {
return new int[] {TokenTypes.INTERFACE_DEF,
TokenTypes.CLASS_DEF,
TokenTypes.ENUM_DEF,
TokenTypes.ANNOTATION_DEF,
};
}