当前位置: 首页>>代码示例>>Java>>正文


Java TokenTypes.RESOURCE属性代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.RESOURCE属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.RESOURCE属性的具体用法?Java TokenTypes.RESOURCE怎么用?Java TokenTypes.RESOURCE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.puppycrawl.tools.checkstyle.api.TokenTypes的用法示例。


在下文中一共展示了TokenTypes.RESOURCE属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:16,代码来源:RedundantModifierCheckTest.java

示例2: getAcceptableTokens

@Override
public int[] getAcceptableTokens() {
    return new int[] {
        TokenTypes.METHOD_DEF,
        TokenTypes.VARIABLE_DEF,
        TokenTypes.ANNOTATION_FIELD_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.CLASS_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.RESOURCE,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:13,代码来源:RedundantModifierCheck.java

示例3: 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);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:29,代码来源:RedundantModifierCheck.java

示例4: checkTryResources

/**
 * Checks indentation of resources parameters in try resources.
 *
 * @param resourcesSpecAst   Resource specification ast
 */
private void checkTryResources(final DetailAST resourcesSpecAst) {
    final DetailAST resourcesAst = resourcesSpecAst.findFirstToken(TokenTypes.RESOURCES);
    final int indentation = getIndent().getFirstIndentLevel()
        + getIndentCheck().getLineWrappingIndentation();
    final IndentLevel expectedResourceIndent = new IndentLevel(indentation);

    final String subType = "resource";

    DetailAST resourceAst = resourcesAst.getFirstChild();
    while (resourceAst != null) {
        if (resourceAst.getType() == TokenTypes.RESOURCE) {
            final DetailAST nextSibling;
            if (resourceAst.getNextSibling() == null) {
                nextSibling = getTryResRparen();
            }
            else {
                nextSibling = resourceAst.getNextSibling();
            }
            if (isOnStartOfLine(resourceAst)) {
                checkChildIndentation(resourceAst, subType, expectedResourceIndent);
                checkWrappingIndentation(
                    resourceAst,
                    nextSibling,
                    getIndentCheck().getLineWrappingIndentation(),
                    expectedResourceIndent.getFirstIndentLevel(),
                    true);
            }
            else {
                checkWrappingIndentation(resourceAst, nextSibling);
            }
        }
        resourceAst = resourceAst.getNextSibling();
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:39,代码来源:TryHandler.java

示例5: getAcceptableTokens

@Override
public int[] getAcceptableTokens() {
    return new int[] {
        TokenTypes.VARIABLE_DEF,
        TokenTypes.PARAMETER_DEF,
        TokenTypes.RESOURCE,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:8,代码来源:LocalFinalVariableNameCheck.java

示例6: mustCheckName

@Override
protected final boolean mustCheckName(DetailAST ast) {
    final DetailAST modifiersAST =
        ast.findFirstToken(TokenTypes.MODIFIERS);
    final boolean isFinal = ast.getType() == TokenTypes.RESOURCE
        || modifiersAST.findFirstToken(TokenTypes.FINAL) != null;
    return isFinal && ScopeUtils.isLocalVariableDef(ast);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:8,代码来源:LocalFinalVariableNameCheck.java

示例7: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final LocalFinalVariableNameCheck localFinalVariableNameCheckObj =
        new LocalFinalVariableNameCheck();
    final int[] actual = localFinalVariableNameCheckObj.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.VARIABLE_DEF,
        TokenTypes.PARAMETER_DEF,
        TokenTypes.RESOURCE,
    };
    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:12,代码来源:LocalFinalVariableNameCheckTest.java


注:本文中的com.puppycrawl.tools.checkstyle.api.TokenTypes.RESOURCE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。