Package com.puppycrawl.tools.checkstyle.api

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


     */
    private void processPackageDef(DetailAST aAST)
    {
        final DetailAST packageNameAST = aAST.getLastChild()
                .getPreviousSibling();
        final FullIdent packageIdent =
                FullIdent.createFullIdent(packageNameAST);
        mPkgName = packageIdent.getText();
    }
View Full Code Here


        {
            // aAST == "new Boolean[]"
            return;
        }

        final FullIdent typeIdent = FullIdent.createFullIdent(typeNameAST);
        final String typeName = typeIdent.getText();
        final int lineNo = aAST.getLineNo();
        final int colNo = aAST.getColumnNo();
        final String fqClassName = getIllegalInstantiation(typeName);
        if (fqClassName != null) {
            log(lineNo, colNo, "instantiation.avoid", fqClassName);
View Full Code Here

                return illegal;
            }
            // import statements
            final Iterator importIter = mImports.iterator();
            while (importIter.hasNext()) {
                final FullIdent importLineText = (FullIdent) importIter.next();
                final String importArg = importLineText.getText();
                if (importArg.endsWith(".*")) {
                    final String fqClass =
                        importArg.substring(0, importArg.length() - 1)
                        + aClassName;
                    // assume that illegalInsts only contain existing classes
View Full Code Here

    public void visitToken(DetailAST aDetailAST)
    {
        DetailAST token = (DetailAST) aDetailAST.getFirstChild();
        while (token != null) {
            if (token.getType() != TokenTypes.COMMA) {
                final FullIdent ident = FullIdent.createFullIdent(token);
                if (isIllegalClassName(ident.getText())) {
                    log(token, "illegal.throw", ident.getText());
                }
            }

            token = (DetailAST) token.getNextSibling();
        }
View Full Code Here

            DetailAST child = (DetailAST) throwsAST.getFirstChild();
            while (child != null) {
                if ((child.getType() == TokenTypes.IDENT)
                    || (child.getType() == TokenTypes.DOT))
                {
                    final FullIdent fi = FullIdent.createFullIdent(child);
                    checkException(fi, knownExcs);
                }
                child = (DetailAST) child.getNextSibling();
            }
        }
View Full Code Here

            DetailAST child = throwsAST.getFirstChild();
            while (child != null) {
                if ((child.getType() == TokenTypes.IDENT)
                    || (child.getType() == TokenTypes.DOT))
                {
                    final FullIdent fi = FullIdent.createFullIdent(child);
                    checkException(fi, knownExcs);
                }
                child = child.getNextSibling();
            }
        }
View Full Code Here

    }

    @Override
    public void visitToken(DetailAST aAST)
    {
        final FullIdent imp;
        if (aAST.getType() == TokenTypes.IMPORT) {
            imp = FullIdent.createFullIdentBelow(aAST);
        }
        else {
            imp = FullIdent.createFullIdent(
                aAST.getFirstChild().getNextSibling());
        }
        if (isIllegalImport(imp.getText())) {
            log(aAST.getLineNo(),
                aAST.getColumnNo(),
                "import.illegal",
                imp.getText());
        }
    }
View Full Code Here

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

     * it's not excluded then a violation is logged.
     * @param aStartingDot the starting dot for the import statement
     */
    private void logsStarredImportViolation(DetailAST aStartingDot)
    {
        final FullIdent name = FullIdent.createFullIdent(aStartingDot);
        if (isStaredImport(name) && !mExcludes.contains(name.getText())) {
            log(aStartingDot.getLineNo(), "import.avoidStar", name.getText());
        }
    }
View Full Code Here

     * Collects the details of imports.
     * @param aAST node containing the import details
     */
    private void processImport(DetailAST aAST)
    {
        final FullIdent name = FullIdent.createFullIdentBelow(aAST);
        if ((name != null) && !name.getText().endsWith(".*")) {
            mImports.add(name);
        }
    }
View Full Code Here

TOP

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

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.