Package com.puppycrawl.tools.checkstyle.api

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


        }

        // method is ok if it is private or abstract or final
        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if (modifiers.branchContains(TokenTypes.LITERAL_PRIVATE)
            || modifiers.branchContains(TokenTypes.ABSTRACT)
            || modifiers.branchContains(TokenTypes.FINAL)
            || modifiers.branchContains(TokenTypes.LITERAL_STATIC))
        {
            return;
        }
View Full Code Here


        // method is ok if it is private or abstract or final
        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if (modifiers.branchContains(TokenTypes.LITERAL_PRIVATE)
            || modifiers.branchContains(TokenTypes.ABSTRACT)
            || modifiers.branchContains(TokenTypes.FINAL)
            || modifiers.branchContains(TokenTypes.LITERAL_STATIC))
        {
            return;
        }
View Full Code Here

        // method is ok if it is private or abstract or final
        final DetailAST modifiers = aAST.findFirstToken(TokenTypes.MODIFIERS);
        if (modifiers.branchContains(TokenTypes.LITERAL_PRIVATE)
            || modifiers.branchContains(TokenTypes.ABSTRACT)
            || modifiers.branchContains(TokenTypes.FINAL)
            || modifiers.branchContains(TokenTypes.LITERAL_STATIC))
        {
            return;
        }

        // method is ok if containing class is not visible in API and
View Full Code Here

        // check if the containing class can be subclassed
        final DetailAST classDef = findContainingClass(aAST);
        final DetailAST classMods =
            classDef.findFirstToken(TokenTypes.MODIFIERS);
        if ((classDef.getType() == TokenTypes.ENUM_DEF)
            || classMods.branchContains(TokenTypes.FINAL))
        {
            return;
        }

        // check if subclassing is prevented by having only private ctors
View Full Code Here

            if (candidate.getType() == TokenTypes.CTOR_DEF) {
                hasDefaultConstructor = false;

                final DetailAST ctorMods =
                    candidate.findFirstToken(TokenTypes.MODIFIERS);
                if (!ctorMods.branchContains(TokenTypes.LITERAL_PRIVATE)) {
                    hasExplNonPrivateCtor = true;
                    break;
                }
            }
            candidate = (DetailAST) candidate.getNextSibling();
View Full Code Here

        boolean retVal = false;

        final DetailAST modifiersAST =
            aAST.findFirstToken(TokenTypes.MODIFIERS);
        final boolean isStatic = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.LITERAL_STATIC);
        final boolean isFinal = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.FINAL);

        if ((isStatic  && isFinal)
            || ScopeUtils.inInterfaceOrAnnotationBlock(aAST))
View Full Code Here

        final DetailAST modifiersAST =
            aAST.findFirstToken(TokenTypes.MODIFIERS);
        final boolean isStatic = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.LITERAL_STATIC);
        final boolean isFinal = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.FINAL);

        if ((isStatic  && isFinal)
            || ScopeUtils.inInterfaceOrAnnotationBlock(aAST))
        {
            // Handle the serialVersionUID and serialPersistentFields  constants
View Full Code Here

    protected final boolean mustCheckName(DetailAST aAST)
    {
        final DetailAST modifiersAST =
            aAST.findFirstToken(TokenTypes.MODIFIERS);
        final boolean isStatic = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.LITERAL_STATIC);
        final boolean isFinal = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.FINAL);

        return (isStatic
                && !isFinal
View Full Code Here

        final DetailAST modifiersAST =
            aAST.findFirstToken(TokenTypes.MODIFIERS);
        final boolean isStatic = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.LITERAL_STATIC);
        final boolean isFinal = (modifiersAST != null)
            && modifiersAST.branchContains(TokenTypes.FINAL);

        return (isStatic
                && !isFinal
                && !ScopeUtils.inInterfaceOrAnnotationBlock(aAST));
    }
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

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.