Package com.puppycrawl.tools.checkstyle.api

Examples of com.puppycrawl.tools.checkstyle.api.Scope


     * @return whether we should check a given node.
     */
    private boolean shouldCheck(final DetailAST aAST)
    {
        final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
        final Scope declaredScope = ScopeUtils.getScopeFromMods(mods);
        final Scope scope =
            ScopeUtils.inInterfaceOrAnnotationBlock(aAST)
                ? Scope.PUBLIC : declaredScope;
        final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

        return scope.isIn(mScope)
            && ((surroundingScope == null) || surroundingScope.isIn(mScope))
            && ((mExcludeScope == null)
                || !scope.isIn(mExcludeScope)
                || ((surroundingScope != null)
                && !surroundingScope.isIn(mExcludeScope)));
    }
View Full Code Here


    {
        if (ScopeUtils.inCodeBlock(aAST)) {
            return false;
        }

        final Scope scope;
        if (aAST.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
            scope = Scope.PUBLIC;
        }
        else {
            final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
            final Scope declaredScope = ScopeUtils.getScopeFromMods(mods);
            scope =
                ScopeUtils.inInterfaceOrAnnotationBlock(aAST)
                    ? Scope.PUBLIC : declaredScope;
        }

        final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

        return scope.isIn(mScope) && surroundingScope.isIn(mScope)
            && ((mExcludeScope == null)
                || !scope.isIn(mExcludeScope)
                || !surroundingScope.isIn(mExcludeScope));
    }
View Full Code Here

    {
        if (ScopeUtils.inCodeBlock(aAST)) {
            return false;
        }

        final Scope declaredScope;
        if (aAST.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
            declaredScope = Scope.PUBLIC;
        }
        else {
            declaredScope = ScopeUtils.getScopeFromMods(
                aAST.findFirstToken(TokenTypes.MODIFIERS));
        }

        final Scope scope =
            ScopeUtils.inInterfaceOrAnnotationBlock(aAST)
            ? Scope.PUBLIC : declaredScope;
        final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

        return scope.isIn(mScope)
            && ((surroundingScope == null) || surroundingScope.isIn(mScope))
            && ((mExcludeScope == null)
                || !scope.isIn(mExcludeScope)
                || ((surroundingScope != null)
                && !surroundingScope.isIn(mExcludeScope)));
    }
View Full Code Here

    }

    @Override
    protected final void processAST(DetailAST aAST)
    {
        final Scope theScope = calculateScope(aAST);
        if (shouldCheck(aAST, theScope)) {
            final FileContents contents = getFileContents();
            final TextBlock cmt = contents.getJavadocBefore(aAST.getLineNo());

            if (cmt == null) {
View Full Code Here

     * @param aScope the scope of the node.
     * @return whether we should check a given node.
     */
    private boolean shouldCheck(final DetailAST aAST, final Scope aScope)
    {
        final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

        return aScope.isIn(mScope)
                && surroundingScope.isIn(mScope)
                && ((mExcludeScope == null) || !aScope.isIn(mExcludeScope)
                    || !surroundingScope.isIn(mExcludeScope));
    }
View Full Code Here

     * @return the scope of the method/constructor
     */
    private Scope calculateScope(final DetailAST aAST)
    {
        final DetailAST mods = aAST.findFirstToken(TokenTypes.MODIFIERS);
        final Scope declaredScope = ScopeUtils.getScopeFromMods(mods);
        return ScopeUtils.inInterfaceOrAnnotationBlock(aAST) ? Scope.PUBLIC
                : declaredScope;
    }
View Full Code Here

                    state.mDeclarationAccess = Scope.PUBLIC;
                    state.mScopeState = STATE_INSTANCE_VARIABLE_DEF;
                }
            }

            final Scope access = ScopeUtils.getScopeFromMods(aAST);
            if (state.mDeclarationAccess.compareTo(access) > 0) {
                log(aAST, "declaration.order.access");
            }
            else {
                state.mDeclarationAccess = access;
View Full Code Here

                    state.mDeclarationAccess = Scope.PUBLIC;
                    state.mScopeState = STATE_INSTANCE_VARIABLE_DEF;
                }
            }

            final Scope access = ScopeUtils.getScopeFromMods(aAST);
            if (state.mDeclarationAccess.compareTo(access) > 0) {
                log(aAST, "declaration.order.access");
            }
            else {
                state.mDeclarationAccess = access;
View Full Code Here

     *
     * @param aAST the tree node for the method or constructor.
     */
    protected final void processAST(DetailAST aAST)
    {
        final Scope theScope = calculateScope(aAST);
        if (shouldCheck(aAST, theScope)) {
            final FileContents contents = getFileContents();
            final TextBlock cmt = contents.getJavadocBefore(aAST.getLineNo());

            if (cmt == null) {
View Full Code Here

     * @param aScope the scope of the node.
     * @return whether we should check a given node.
     */
    private boolean shouldCheck(final DetailAST aAST, final Scope aScope)
    {
        final Scope surroundingScope = ScopeUtils.getSurroundingScope(aAST);

        return aScope.isIn(mScope)
                && surroundingScope.isIn(mScope)
                && ((mExcludeScope == null) || !aScope.isIn(mExcludeScope)
                    || !surroundingScope.isIn(mExcludeScope));
    }
View Full Code Here

TOP

Related Classes of com.puppycrawl.tools.checkstyle.api.Scope

Copyright © 2018 www.massapicom. 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.