Examples of DetailAST


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

    }

    @Override
    protected IndentLevel getLevelImpl()
    {
        final DetailAST parentAST = getMainAst().getParent();
        IndentLevel indent = getParent().getLevel();
        if (parentAST.getType() == TokenTypes.LITERAL_NEW) {
            indent.addAcceptedIndent(super.getLevelImpl());
        }
        else if (parentAST.getType() == TokenTypes.ENUM_CONSTANT_DEF) {
            indent = super.getLevelImpl();
        }
        return indent;
    }
View Full Code Here

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

    }

    @Override
    public void visitToken(final DetailAST aAST)
    {
        final DetailAST startingDot =
            (DetailAST) aAST.getFirstChild().getNextSibling();
        final FullIdent name = FullIdent.createFullIdent(startingDot);

        if ((null != name) && !isExempt(name.getText())) {
            log(startingDot.getLineNo(), "import.avoidStatic", name.getText());
        }
    }
View Full Code Here

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

    {
        // if we have a class or interface as a parent, don't do anything,
        // as this is checked by class def; so
        // only do this if we have a new for a parent (anonymous inner
        // class)
        final DetailAST parentAST = getMainAst().getParent();
        if (parentAST.getType() != TokenTypes.LITERAL_NEW) {
            return;
        }

        super.checkIndentation();
    }
View Full Code Here

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

    @Override
    public void visitToken(DetailAST aAST)
    {
        if (aAST.getType() == TokenTypes.COLON) {
            final DetailAST parent = aAST.getParent();
            if ((parent.getType() == TokenTypes.LITERAL_DEFAULT)
                || (parent.getType() == TokenTypes.LITERAL_CASE))
            {
                //we do not want to check colon for cases and defaults
                return;
            }
        }
View Full Code Here

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

        if ((before < 0) || Character.isWhitespace(line.charAt(before))) {

            // empty FOR initializer?
            if (aAST.getType() == TokenTypes.SEMI) {
                final DetailAST sibling = aAST.getPreviousSibling();
                if ((sibling != null)
                        && (sibling.getType() == TokenTypes.FOR_INIT)
                        && (sibling.getChildCount() == 0))
                {
                    return;
                }
            }
View Full Code Here

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

    @Override
    public void visitToken(final DetailAST aAST)
    {
        if (aAST.getType() == TokenTypes.PACKAGE_DEF) {
            final DetailAST nameAST = aAST.getLastChild().getPreviousSibling();
            final FullIdent full = FullIdent.createFullIdent(nameAST);
            if (mRoot == null) {
                log(nameAST, "import.control.missing.file");
            }
            else {
View Full Code Here

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

        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;
        }
View Full Code Here

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

    }

    @Override
    public void visitToken(DetailAST aAST)
    {
        final DetailAST synchronizedAST =
            getLowestParent(aAST, TokenTypes.LITERAL_SYNCHRONIZED);
        if (synchronizedAST == null) {
            return;
        }

        final DetailAST ifAST =
            getLowestParent(synchronizedAST, TokenTypes.LITERAL_IF);
        if (ifAST == null) {
            return;
        }
View Full Code Here

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

    /**
     * Check the indent of the top level token.
     */
    protected void checkToplevelToken()
    {
        final DetailAST toplevel = getToplevelAST();

        if ((toplevel == null)
            || getLevel().accept(expandedTabsColumnNo(toplevel)))
        {
            return;
View Full Code Here

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

     * @param aTokenType the token type to search for
     * @return the first token of type aTokenTye or null if no such token exists
     */
    private DetailAST getLowestParent(DetailAST aAST, int aTokenType)
    {
        DetailAST synchronizedParent = aAST;
        while ((synchronizedParent != null)
               && (synchronizedParent.getType() != aTokenType))
        {
            synchronizedParent = synchronizedParent.getParent();
        }
        return synchronizedParent;
    }
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.