Package com.puppycrawl.tools.checkstyle.api

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


    }

    @Override
    public void visitToken(DetailAST aAST)
    {
        final DetailAST nameAST = aAST.getLastChild().getPreviousSibling();
        final FullIdent full = FullIdent.createFullIdent(nameAST);
        if (!getRegexp().matcher(full.getText()).find()) {
            log(full.getLineNo(),
                full.getColumnNo(),
                "name.invalidPattern",
View Full Code Here


     * Collects the details of a package.
     * @param aAST node containing the package details
     */
    private void processPackage(DetailAST aAST)
    {
        final DetailAST nameAST = aAST.getLastChild().getPreviousSibling();
        mPackageFullIdent = FullIdent.createFullIdent(nameAST);
    }
View Full Code Here

     * Process type params (if any) for given class, enum or method.
     * @param aAST class, enum or method to process.
     */
    private void processTypeParams(DetailAST aAST)
    {
        final DetailAST typeParams =
            aAST.findFirstToken(TokenTypes.TYPE_PARAMETERS);

        final Map<String, ClassInfo> paramsMap = Maps.newHashMap();
        mTypeParams.push(paramsMap);

        if (typeParams == null) {
            return;
        }

        for (DetailAST child = (DetailAST) typeParams.getFirstChild();
             child != null;
             child = (DetailAST) child.getNextSibling())
        {
            if (child.getType() == TokenTypes.TYPE_PARAMETER) {
                final DetailAST param = child;
                final String alias =
                    param.findFirstToken(TokenTypes.IDENT).getText();
                final DetailAST bounds =
                    param.findFirstToken(TokenTypes.TYPE_UPPER_BOUNDS);
                if (bounds != null) {
                    final FullIdent name =
                        FullIdent.createFullIdentBelow(bounds);
                    final ClassInfo ci =
View Full Code Here

     * Processes class definition.
     * @param aAST class definition to process.
     */
    private void processClass(DetailAST aAST)
    {
        final DetailAST ident = aAST.findFirstToken(TokenTypes.IDENT);
        mCurrentClass += ("".equals(mCurrentClass) ? "" : "$")
            + ident.getText();

        processTypeParams(aAST);
    }
View Full Code Here

     * Checks type of parameters.
     * @param aAST parameter list for check.
     */
    private void visitParameterDef(DetailAST aAST)
    {
        final DetailAST grandParentAST = aAST.getParent().getParent();

        if ((grandParentAST.getType() == TokenTypes.METHOD_DEF)
            && isCheckedMethod(grandParentAST))
        {
            checkClassName(aAST);
        }
    }
View Full Code Here

     * Checks type of given method, parameter or variable.
     * @param aAST node to check.
     */
    private void checkClassName(DetailAST aAST)
    {
        final DetailAST type = aAST.findFirstToken(TokenTypes.TYPE);
        final FullIdent ident = CheckUtils.createFullType(type);

        if (isMatchingClassName(ident.getText())) {
            log(ident.getLineNo(), ident.getColumnNo(),
                "illegal.type", ident.getText());
View Full Code Here

        return (DetailAST) factory.create(TokenTypes.EOF, "ROOT");
    }

    void setParseTree(DetailAST parseTree)
    {
        final DetailAST root = (DetailAST) getRoot();
        root.setFirstChild(parseTree);
        final Object[] path = {root};
        // no need to setup remaining info, as the call results in a
        // table structure changed event anyway - we just pass nulls
        fireTreeStructureChanged(this, path, null, null);
    }
View Full Code Here

        return Object.class;
    }

    public Object getValueAt(Object node, int column)
    {
        final DetailAST ast = (DetailAST) node;
        switch (column) {
            case 0:
                return null;
            case 1:
                return TokenTypes.getTokenName(ast.getType());
            case 2:
                return ast.getLineNo();
            case 3:
                return ast.getColumnNo();
            case 4:
                return ast.getText();
        }
        return null;
    }
View Full Code Here

     * @param aAST the AST to check.
     * @return true if aAST is a descentant of an abstract method.
     */
    private boolean inAbstractMethod(DetailAST aAST)
    {
        DetailAST parent = aAST.getParent();
        while (parent != null) {
            if (parent.getType() == TokenTypes.METHOD_DEF) {
                final DetailAST modifiers =
                    parent.findFirstToken(TokenTypes.MODIFIERS);
                return modifiers.branchContains(TokenTypes.ABSTRACT);
            }
            parent = parent.getParent();
        }
        return false;
    }
View Full Code Here

     */
    private void insertVariable(DetailAST aAST)
    {
        if (!aAST.branchContains(TokenTypes.FINAL)) {
            final Map<String, DetailAST> state = mScopeStack.peek();
            final DetailAST ast = aAST.findFirstToken(TokenTypes.IDENT);
            state.put(ast.getText(), ast);
        }
    }
View Full Code Here

TOP

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

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.