Examples of FullIdent


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

    }

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

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

    }

    @Override
    public void visitToken(DetailAST aAST)
    {
        final FullIdent name = FullIdent.createFullIdentBelow(aAST);
        if ((name != null) && name.getText().endsWith(".*")) {
            boolean exempt = false;
            for (int i = 0; (i < mExcludes.length) && !exempt; i++) {
                if (name.getText().equals(mExcludes[i])) {
                    exempt = true;
                }
            }
            if (!exempt) {
                log(aAST.getLineNo(), "import.avoidStar", name.getText());
            }
        }
    }
View Full Code Here

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

     * 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

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

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

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

    }

    @Override
    public void visitToken(DetailAST aAST)
    {
        final FullIdent ident;
        boolean isStatic;
        if (aAST.getType() == TokenTypes.IMPORT) {
            ident = FullIdent.createFullIdentBelow(aAST);
            isStatic = false;
        }
        else {
            ident = FullIdent.createFullIdent(
                (DetailAST) aAST.getFirstChild().getNextSibling());
            isStatic = true;
        }

        if (ident != null) {
            final String name = ident.getText();
            final int groupIdx = getGroupNumber(name);
            final int line = ident.getLineNo();

            if (groupIdx > mLastGroup) {
                if (!mBeforeFirstImport && mSeparated) {
                    // This check should be made more robust to handle
                    // comments and imports that span more than one line.
View Full Code Here

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

    @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.FullIdent

        if (aAST.getType() == TokenTypes.PACKAGE_DEF) {
            mPkgName = FullIdent.createFullIdent(
                    aAST.getLastChild().getPreviousSibling()).getText();
        }
        else if (aAST.getType() == TokenTypes.IMPORT) {
            final FullIdent imp = FullIdent.createFullIdentBelow(aAST);
            if (fromPackage(imp.getText(), "java.lang")) {
                log(aAST.getLineNo(), aAST.getColumnNo(), "import.lang",
                    imp.getText());
            }
            else if (fromPackage(imp.getText(), mPkgName)) {
                log(aAST.getLineNo(), aAST.getColumnNo(), "import.same",
                    imp.getText());
            }
            // Check for a duplicate import
            for (FullIdent full : mImports) {
                if (imp.getText().equals(full.getText())) {
                    log(aAST.getLineNo(), aAST.getColumnNo(),
                            "import.duplicate", full.getLineNo(),
                            imp.getText());
                }
            }

            mImports.add(imp);
        }
        else {
            // Check for a duplicate static import
            final FullIdent imp =
                FullIdent.createFullIdent(
                    aAST.getLastChild().getPreviousSibling());
            for (FullIdent full : mStaticImports) {
                if (imp.getText().equals(full.getText())) {
                    log(aAST.getLineNo(), aAST.getColumnNo(),
                        "import.duplicate", full.getLineNo(), imp.getText());
                }
            }

            mStaticImports.add(imp);
        }
View Full Code Here

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

     * Stores package of current class we check.
     * @param aPkg package definition.
     */
    private void visitPackageDef(DetailAST aPkg)
    {
        final FullIdent ident = FullIdent.createFullIdent(aPkg.getLastChild()
                .getPreviousSibling());
        mPackageName = ident.getText();
    }
View Full Code Here

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

    @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 {
                mInPkg = full.getText();
                mCurrentLeaf = mRoot.locateFinest(mInPkg);
                if (mCurrentLeaf == null) {
                    log(nameAST, "import.control.unknown.pkg");
                }
            }
        }
        else if (mCurrentLeaf != null) {
            final FullIdent imp;
            if (aAST.getType() == TokenTypes.IMPORT) {
                imp = FullIdent.createFullIdentBelow(aAST);
            }
            else {
                // know it is a static import
                imp = FullIdent.createFullIdent((DetailAST) aAST
                        .getFirstChild().getNextSibling());
            }
            final AccessResult access = mCurrentLeaf.checkAccess(imp.getText(),
                    mInPkg);
            if (!AccessResult.ALLOWED.equals(access)) {
                log(aAST, "import.control.disallowed", imp.getText());
            }
        }
    }
View Full Code Here

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

        final DetailAST arrayType = (DetailAST) arrayDecl.getFirstChild();

        if ((arrayType.getType() == TokenTypes.IDENT)
            || (arrayType.getType() == TokenTypes.DOT))
        {
            final FullIdent type = FullIdent.createFullIdent(arrayType);
            return ("String".equals(type.getText())
                    || "java.lang.String".equals(type.getText()));
        }

        return false;
    }
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.