Package com.puppycrawl.tools.checkstyle.api

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


        }

        // explicit constant
        final DetailAST modifiersAST =
                varDefAST.findFirstToken(TokenTypes.MODIFIERS);
        if (modifiersAST.branchContains(TokenTypes.FINAL)) {
            return varDefAST;
        }

        return null;
    }
View Full Code Here


            return;
        }

        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if ((modifiers != null)
            && modifiers.branchContains(TokenTypes.FINAL))
        {
            // do not check final variables
            return;
        }
View Full Code Here

    /** {@inheritDoc} */
    public void visitToken(DetailAST aAST)
    {
        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if ((modifiers != null)
            && modifiers.branchContains(TokenTypes.ABSTRACT))
        {
            // should apply the check to abtract class
            return;
        }

View Full Code Here

            return;
        }

        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if ((modifiers != null)
            && modifiers.branchContains(TokenTypes.FINAL))
        {
            // do not check final variables
            return;
        }
View Full Code Here

    @Override
    public void visitToken(DetailAST aAST)
    {
        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if ((modifiers != null)
            && modifiers.branchContains(TokenTypes.ABSTRACT))
        {
            // should apply the check to abstract class
            return;
        }
View Full Code Here

    public void visitToken(DetailAST aAST)
    {
        final int parentType = aAST.getParent().getType();
        final DetailAST modifiers = aAST.getFirstChild();

        if ((mIgnoreFinal && modifiers.branchContains(TokenTypes.FINAL))
                || parentType == TokenTypes.OBJBLOCK)
        {
            ;// no code
        }
        else {
View Full Code Here

        //but not attempted as it seems out of the scope of this
        //check.
        final DetailAST typeMods = aAST.findFirstToken(TokenTypes.MODIFIERS);
        final boolean isStaticInnerType =
                (typeMods != null)
                        && typeMods.branchContains(TokenTypes.LITERAL_STATIC);
        final FieldFrame frame =
                new FieldFrame(mCurrentFrame, isStaticInnerType);

        //add fields to container
        final DetailAST objBlock = aAST.findFirstToken(TokenTypes.OBJBLOCK);
View Full Code Here

                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);
                    }
                    else {
                        frame.addInstanceField(name);
                    }
View Full Code Here

            case TokenTypes.STATIC_INIT:
                return true;
            case TokenTypes.METHOD_DEF:
                final DetailAST mods =
                    parent.findFirstToken(TokenTypes.MODIFIERS);
                return mods.branchContains(TokenTypes.LITERAL_STATIC);
            default:
                parent = parent.getParent();
            }
        }
        return false;
View Full Code Here

        if (methodAST.getType() != TokenTypes.METHOD_DEF) {
            return false;
        }
        //void?
        final DetailAST typeAST = methodAST.findFirstToken(TokenTypes.TYPE);
        if (!typeAST.branchContains(TokenTypes.LITERAL_VOID)) {
            return false;
        }

        //property setter name?
        final String methodName =
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.