Examples of findFirstToken()


Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        }

        // let's check return type
        final DetailAST typeAST = aAST.findFirstToken(TokenTypes.TYPE);
        final boolean isArray =
            (typeAST.findFirstToken(TokenTypes.ARRAY_DECLARATOR) != null);
        final String type = CheckUtils.createFullType(typeAST).getText();
        if (isArray
            || (!"Test".equals(type)
            && !"junit.framework.Test".equals(type)))
        {
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

     */
    private void checkReturnValue(DetailAST aAST, String aName)
    {
        final DetailAST returnValueAST = aAST.findFirstToken(TokenTypes.TYPE);

        if (returnValueAST.findFirstToken(TokenTypes.LITERAL_VOID) == null) {
            log(aAST, "junit.method.return.type", aName, "void");
        }
    }

    /**
 
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        if (objBlock != null) {
            DetailAST child = (DetailAST) objBlock.getFirstChild();
            while (child != null) {
                if (child.getType() == TokenTypes.VARIABLE_DEF) {
                    final String name =
                        child.findFirstToken(TokenTypes.IDENT).getText();
                    final DetailAST mods =
                        child.findFirstToken(TokenTypes.MODIFIERS);
                    if (mods.branchContains(TokenTypes.LITERAL_STATIC)) {
                        frame.addStaticField(name);
                    }
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

             child = (DetailAST) child.getNextSibling())
        {
            if (child.getType() == TokenTypes.TYPE_PARAMETER) {
                final DetailAST param = child;
                final String alias =
                    param.findFirstToken(TokenTypes.IDENT).getText();
                final DetailAST bounds =
                    param.findFirstToken(TokenTypes.TYPE_UPPER_BOUNDS);
                if (bounds != null) {
                    final FullIdent name =
                        FullIdent.createFullIdentBelow(bounds);
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

    private boolean checkTry(final DetailAST aAST, boolean aUseBreak,
                             boolean aUseContinue)
    {
        final DetailAST finalStmt = aAST.getLastChild();
        if (finalStmt.getType() == TokenTypes.LITERAL_FINALLY) {
            return isTerminated(finalStmt.findFirstToken(TokenTypes.SLIST),
                                aUseBreak, aUseContinue);
        }

        boolean isTerminated = isTerminated((DetailAST) aAST.getFirstChild(),
                                            aUseBreak, aUseContinue);
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        final List typeParamNames = new ArrayList();
        if (typeParameters != null) {
            final DetailAST typeParam =
                typeParameters.findFirstToken(TokenTypes.TYPE_PARAMETER);
            typeParamNames.add(
                typeParam.findFirstToken(TokenTypes.IDENT).getText());

            DetailAST sibling = (DetailAST) typeParam.getNextSibling();
            while (sibling != null) {
                if (sibling.getType() == TokenTypes.TYPE_PARAMETER) {
                    typeParamNames.add(
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

            DetailAST sibling = (DetailAST) typeParam.getNextSibling();
            while (sibling != null) {
                if (sibling.getType() == TokenTypes.TYPE_PARAMETER) {
                    typeParamNames.add(
                        sibling.findFirstToken(TokenTypes.IDENT).getText());
                }
                sibling = (DetailAST) sibling.getNextSibling();
            }
        }
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

    {
        if (mChecking && (aAST.getParent().getType() == TokenTypes.OBJBLOCK)) {
            final DetailAST modifiersAST =
                aAST.findFirstToken(TokenTypes.MODIFIERS);

            if (!(modifiersAST.findFirstToken(TokenTypes.FINAL) != null)) {
                log(aAST.getLineNo(),  aAST.getColumnNo(), "mutable.exception",
                        aAST.findFirstToken(TokenTypes.IDENT).getText());
            }
        }
    }
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

            if (tag.getArg1().startsWith("<") && tag.getArg1().endsWith(">")) {
                // Loop looking for matching type param
                final Iterator typeParamsIt = typeParams.iterator();
                while (typeParamsIt.hasNext()) {
                    final DetailAST typeParam = (DetailAST) typeParamsIt.next();
                    if (typeParam.findFirstToken(TokenTypes.IDENT).getText()
                            .equals(
                                    tag.getArg1().substring(1,
                                            tag.getArg1().length() - 1)))
                    {
                        found = true;
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

            final Iterator typeParamsIt = typeParams.iterator();
            while (typeParamsIt.hasNext()) {
                final DetailAST typeParam = (DetailAST) typeParamsIt.next();
                log(typeParam, "javadoc.expectedTag", "@param", "<"
                        + typeParam.findFirstToken(TokenTypes.IDENT).getText()
                        + ">");
            }
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.