Examples of branchContains()


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

        else if (aAST.getType() == TokenTypes.METHOD_DEF) {
            final DetailAST modifiers =
                            aAST.findFirstToken(TokenTypes.MODIFIERS);
            // private method?
            boolean checkFinal =
                modifiers.branchContains(TokenTypes.LITERAL_PRIVATE);
            // declared in a final class?
            DetailAST parent = aAST.getParent();
            while (parent != null) {
                if (parent.getType() == TokenTypes.CLASS_DEF) {
                    final DetailAST classModifiers =
View Full Code Here

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

            while (parent != null) {
                if (parent.getType() == TokenTypes.CLASS_DEF) {
                    final DetailAST classModifiers =
                        parent.findFirstToken(TokenTypes.MODIFIERS);
                    checkFinal |=
                        classModifiers.branchContains(TokenTypes.FINAL);
                    break;
                }
                parent = parent.getParent();
            }
            if (checkFinal) {
View Full Code Here

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

        if (mMethodName.equals(methodName)) {

            final DetailAST params = aAST.findFirstToken(TokenTypes.PARAMETERS);
            final boolean hasEmptyParamList =
                !params.branchContains(TokenTypes.PARAMETER_DEF);

            if (hasEmptyParamList) {
                log(aAST.getLineNo(), mErrorKey);
            }
        }
View Full Code Here

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

        }

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

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

            return;
        }

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

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

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

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;
        }

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

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

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

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

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