Package com.puppycrawl.tools.checkstyle.api

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


    {
        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


                if (isPublic(currentNode)) {
                    mPublicTypeFound = true;
                }

                else {
                    final String typeName = currentNode.
                            findFirstToken(TokenTypes.IDENT).getText();
                    mLineNumberTypeMap.put(currentNode.getLineNo(), typeName);
                }
            }
            currentNode = currentNode.getNextSibling();
View Full Code Here

     */
    private boolean isPublic(DetailAST aTypeDef)
    {
        final DetailAST modifiers =
                aTypeDef.findFirstToken(TokenTypes.MODIFIERS);
        return modifiers.findFirstToken(TokenTypes.LITERAL_PUBLIC) != null;
    }
}
View Full Code Here

        boolean followsEmptyForIterator = false;
        final DetailAST parent = aAST.getParent();
        //Only traditional for statements are examined, not for-each statements
        if ((parent != null)
            && (parent.getType() == TokenTypes.LITERAL_FOR)
            && (parent.findFirstToken(TokenTypes.FOR_EACH_CLAUSE) == null))
        {
            final DetailAST forIterator =
                parent.findFirstToken(TokenTypes.FOR_ITERATOR);
            followsEmptyForIterator = (forIterator.getChildCount() == 0)
                && (aAST == forIterator.getNextSibling());
View Full Code Here

        boolean preceedsEmptyForInintializer = false;
        final DetailAST parent = aAST.getParent();
        //Only traditional for statements are examined, not for-each statements
        if ((parent != null)
            && (parent.getType() == TokenTypes.LITERAL_FOR)
            && (parent.findFirstToken(TokenTypes.FOR_EACH_CLAUSE) == null))
        {
            final DetailAST forIterator =
                    parent.findFirstToken(TokenTypes.FOR_INIT);
            preceedsEmptyForInintializer = (forIterator.getChildCount() == 0)
                    && (aAST == forIterator.getPreviousSibling());
View Full Code Here

                mWrongType = aAST;
            }
        }
        else {
            final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
            if (modifiers.findFirstToken(TokenTypes.LITERAL_PUBLIC) != null
                    && aAST.getParent() == null)
            {
                mHasPublic = true;
            }
        }
View Full Code Here

             child = 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

        final List<String> typeParamNames = Lists.newArrayList();
        if (typeParameters != null) {
            final DetailAST typeParam =
                typeParameters.findFirstToken(TokenTypes.TYPE_PARAMETER);
            typeParamNames.add(
                typeParam.findFirstToken(TokenTypes.IDENT).getText());

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

            DetailAST sibling = typeParam.getNextSibling();
            while (sibling != null) {
                if (sibling.getType() == TokenTypes.TYPE_PARAMETER) {
                    typeParamNames.add(
                        sibling.findFirstToken(TokenTypes.IDENT).getText());
                }
                sibling = 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

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.