Package com.puppycrawl.tools.checkstyle.api

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


        final DetailAST method = aAST.getParent().getParent();
        if (method.getType() != TokenTypes.METHOD_DEF) {
            return false;
        }
        final DetailAST mods = method.findFirstToken(TokenTypes.MODIFIERS);
        return ((mods != null) && mods.branchContains(TokenTypes.ABSTRACT));
    }

    /**
     * Set the ignore format to the specified regular expression.
     * @param aFormat a <code>String</code> value
View Full Code Here


        }

        // ignore abstract method
        final DetailAST modifiers =
            aMethod.findFirstToken(TokenTypes.MODIFIERS);
        if (modifiers.branchContains(TokenTypes.ABSTRACT)) {
            return;
        }

        // we can now be sure that there is at least one parameter
        final DetailAST parameters =
View Full Code Here

        DetailAST parent = aAST.getParent();
        while (parent != null) {
            if (parent.getType() == TokenTypes.METHOD_DEF) {
                final DetailAST modifiers =
                    parent.findFirstToken(TokenTypes.MODIFIERS);
                return modifiers.branchContains(TokenTypes.ABSTRACT);
            }
            parent = parent.getParent();
        }
        return false;
    }
View Full Code Here

    {
        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);

        if (aAST.getType() == TokenTypes.CLASS_DEF) {
            final boolean isFinal = (modifiers != null)
                    && modifiers.branchContains(TokenTypes.FINAL);
            final boolean isAbstract = (modifiers != null)
                    && modifiers.branchContains(TokenTypes.ABSTRACT);
            mClasses.push(new ClassDesc(isFinal, isAbstract));
        }
        else if (!ScopeUtils.inEnumBlock(aAST)) { //ctors in enums don't matter
View Full Code Here

        if (aAST.getType() == TokenTypes.CLASS_DEF) {
            final boolean isFinal = (modifiers != null)
                    && modifiers.branchContains(TokenTypes.FINAL);
            final boolean isAbstract = (modifiers != null)
                    && modifiers.branchContains(TokenTypes.ABSTRACT);
            mClasses.push(new ClassDesc(isFinal, isAbstract));
        }
        else if (!ScopeUtils.inEnumBlock(aAST)) { //ctors in enums don't matter
            final ClassDesc desc = mClasses.peek();
            if ((modifiers != null)
View Full Code Here

            mClasses.push(new ClassDesc(isFinal, isAbstract));
        }
        else if (!ScopeUtils.inEnumBlock(aAST)) { //ctors in enums don't matter
            final ClassDesc desc = mClasses.peek();
            if ((modifiers != null)
                && modifiers.branchContains(TokenTypes.LITERAL_PRIVATE))
            {
                desc.reportPrivateCtor();
            }
            else {
                desc.reportNonPrivateCtor();
View Full Code Here

    private boolean checkModifiers(DetailAST aMethod)
    {
        final DetailAST modifiers =
            aMethod.findFirstToken(TokenTypes.MODIFIERS);

        return modifiers.branchContains(TokenTypes.LITERAL_PUBLIC)
            && modifiers.branchContains(TokenTypes.LITERAL_STATIC);
    }

    /**
     * Checks that return type is <code>void</code>.
View Full Code Here

            {
                hasMethodOrField = true;
                final DetailAST modifiers =
                    child.findFirstToken(TokenTypes.MODIFIERS);
                final boolean isStatic =
                    modifiers.branchContains(TokenTypes.LITERAL_STATIC);
                final boolean isPrivate =
                    modifiers.branchContains(TokenTypes.LITERAL_PRIVATE);

                if (!isStatic && !isPrivate) {
                    hasNonStaticMethodOrField = true;
View Full Code Here

    {
        final DetailAST modifiers =
            aMethod.findFirstToken(TokenTypes.MODIFIERS);

        return modifiers.branchContains(TokenTypes.LITERAL_PUBLIC)
            && modifiers.branchContains(TokenTypes.LITERAL_STATIC);
    }

    /**
     * Checks that return type is <code>void</code>.
     * @param aMethod the METHOD_DEF node
View Full Code Here

                final DetailAST modifiers =
                    child.findFirstToken(TokenTypes.MODIFIERS);
                final boolean isStatic =
                    modifiers.branchContains(TokenTypes.LITERAL_STATIC);
                final boolean isPrivate =
                    modifiers.branchContains(TokenTypes.LITERAL_PRIVATE);

                if (!isStatic && !isPrivate) {
                    hasNonStaticMethodOrField = true;
                }
                if (isStatic && !isPrivate) {
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.