Examples of findFirstToken()


Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

    {
        boolean retVal = false;
        if (aAST.getType() == TokenTypes.METHOD_DEF) {
            final DetailAST typeAST = aAST.findFirstToken(TokenTypes.TYPE);
            if ((typeAST != null)
                && (typeAST.findFirstToken(TokenTypes.LITERAL_VOID) == null))
            {
                retVal = true;
            }
        }
        return retVal;
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        boolean followsEmptyForIterator = false;
        final DetailAST parent = aAST.getParent();
        //Only traditional for statements are examined, not for-each statements
        if ((parent != null)
            && (parent.getType() == TokenTypes.LITERAL_FOR)
            && (parent.findFirstToken(TokenTypes.FOR_EACH_CLAUSE) == null))
        {
            final DetailAST forIterator =
                parent.findFirstToken(TokenTypes.FOR_ITERATOR);
            followsEmptyForIterator = (forIterator.getChildCount() == 0)
                && (aAST == forIterator.getNextSibling());
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        boolean preceedsEmptyForInintializer = false;
        final DetailAST parent = aAST.getParent();
        //Only traditional for statements are examined, not for-each statements
        if ((parent != null)
            && (parent.getType() == TokenTypes.LITERAL_FOR)
            && (parent.findFirstToken(TokenTypes.FOR_EACH_CLAUSE) == null))
        {
            final DetailAST forIterator =
                    parent.findFirstToken(TokenTypes.FOR_INIT);
            preceedsEmptyForInintializer = (forIterator.getChildCount() == 0)
                    && (aAST == forIterator.getPreviousSibling());
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

    /** {@inheritDoc} */
    public void visitToken(DetailAST aAST)
    {
        DetailAST targetAST = aAST;
        if (targetAST.getType() == TokenTypes.TYPECAST) {
            targetAST = targetAST.findFirstToken(TokenTypes.RPAREN);
        }
        final String line = getLines()[aAST.getLineNo() - 1];
        final int after =
            targetAST.getColumnNo() + targetAST.getText().length();

View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        int currentIndex = 0;
        while (currentToken != null) {
            if (currentToken.getType() == TokenTypes.METHOD_DEF) {
                currentIndex++;
                final String methodName =
                        currentToken.findFirstToken(TokenTypes.IDENT).getText();
                if (methodIndexMap.containsKey(methodName)) {
                    final int priviousIndex = methodIndexMap.get(methodName);
                    if (currentIndex - priviousIndex > allowedDistance) {
                        final int previousLineWithOverloadMethod =
                                methodLineNumberMap.get(methodName);
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

        if (objBlock != null) {
            DetailAST child = objBlock.getFirstChild();
            while (child != null) {
                if (child.getType() == TokenTypes.VARIABLE_DEF) {
                    final String name =
                        child.findFirstToken(TokenTypes.IDENT).getText();
                    final DetailAST mods =
                        child.findFirstToken(TokenTypes.MODIFIERS);
                    if (mods.branchContains(TokenTypes.LITERAL_STATIC)) {
                        frame.addStaticField(name);
                    }
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

    {
        if (mChecking && (aAST.getParent().getType() == TokenTypes.OBJBLOCK)) {
            final DetailAST modifiersAST =
                aAST.findFirstToken(TokenTypes.MODIFIERS);

            if (!(modifiersAST.findFirstToken(TokenTypes.FINAL) != null)) {
                log(aAST.getLineNo(),  aAST.getColumnNo(), "mutable.exception",
                        aAST.findFirstToken(TokenTypes.IDENT).getText());
            }
        }
    }
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

    private boolean checkTry(final DetailAST aAST, boolean aUseBreak,
                             boolean aUseContinue)
    {
        final DetailAST finalStmt = aAST.getLastChild();
        if (finalStmt.getType() == TokenTypes.LITERAL_FINALLY) {
            return isTerminated(finalStmt.findFirstToken(TokenTypes.SLIST),
                                aUseBreak, aUseContinue);
        }

        boolean isTerminated = isTerminated(aAST.getFirstChild(),
                                            aUseBreak, aUseContinue);
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

            if (tag.getArg1().startsWith("<") && tag.getArg1().endsWith(">")) {
                // Loop looking for matching type param
                final Iterator<DetailAST> typeParamsIt = typeParams.iterator();
                while (typeParamsIt.hasNext()) {
                    final DetailAST typeParam = typeParamsIt.next();
                    if (typeParam.findFirstToken(TokenTypes.IDENT).getText()
                            .equals(
                                    tag.getArg1().substring(1,
                                            tag.getArg1().length() - 1)))
                    {
                        found = true;
View Full Code Here

Examples of com.puppycrawl.tools.checkstyle.api.DetailAST.findFirstToken()

            }

            for (DetailAST typeParam : typeParams) {
                log(typeParam, "javadoc.expectedTag",
                    JavadocTagInfo.PARAM.getText(),
                    "<" + typeParam.findFirstToken(TokenTypes.IDENT).getText()
                    + ">");
            }
        }
    }
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.