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


     */
    private void raiseCounter(DetailAST aMethod)
    {
        final MethodCounter actualCounter = mCounters.peek();
        final DetailAST temp = aMethod.findFirstToken(TokenTypes.MODIFIERS);
        final Scope scope = ScopeUtils.getScopeFromMods(temp);
        actualCounter.increment(scope);
    }
View Full Code Here

    if (scope.state > curState) {
      log(aAST, type + " in wrong order.");
      // Wrong type implies at least a temporary state switch.
      return true;
    } else if (scope.state == curState) {
      final Scope curVisibility = ScopeUtils.getScopeFromMods(aAST);
      if (scope.visibility.compareTo(curVisibility) > 0) {
        log(aAST, curVisibility.getName() + " " + type
            + " should not occur after " + scope.visibility.getName() + " "
            + type);
        return false;
      } else if (scope.visibility != curVisibility) {
        scope.visibility = curVisibility;
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

     * @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.isIn(mScope)
            && ((mExcludeScope == null) || !scope.isIn(mExcludeScope)
                || !surroundingScope.isIn(mExcludeScope));
    }
View Full Code Here

     * @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

                    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

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.