Package com.puppycrawl.tools.checkstyle.api

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


    {
        boolean retVal = false;
        if (aAST.getType() == TokenTypes.METHOD_DEF) {
            final DetailAST typeAST = aAST.findFirstToken(TokenTypes.TYPE);
            if ((typeAST != null)
                && (typeAST.findFirstToken(TokenTypes.LITERAL_VOID) == null))
            {
                retVal = true;
            }
        }
        return retVal;
View Full Code Here

        List typeParamNames = new ArrayList();
        if (typeParameters != null) {
            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

            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

        }

        // 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

     */
    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

        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

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.