Examples of findFirstToken()


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

    }
    DetailAST modifiers = ast.findFirstToken(TokenTypes.MODIFIERS);
    if (null != modifiers) {
      if (isAllMethods) {
        // if public then it is API
        if (isInterface || null != modifiers.findFirstToken(TokenTypes.LITERAL_PUBLIC)) {
          return true;
        }
      }
      DetailAST check = modifiers.getFirstChild();
      while (null != check) {
View Full Code Here

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

    String name = getName(ast);
    String parameters = "";
    if (TokenTypes.METHOD_DEF == ast.getType() || TokenTypes.VARIABLE_DEF == ast.getType()) {
      DetailAST modifiersAst = ast.findFirstToken(TokenTypes.MODIFIERS);
      if (null != modifiersAst) {
        if (null != modifiersAst.findFirstToken(TokenTypes.LITERAL_STATIC)) {
          returnType += "static ";
        }
        if (null != modifiersAst.findFirstToken(TokenTypes.FINAL)) {
          returnType += "final ";
        }
View Full Code Here

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

      DetailAST modifiersAst = ast.findFirstToken(TokenTypes.MODIFIERS);
      if (null != modifiersAst) {
        if (null != modifiersAst.findFirstToken(TokenTypes.LITERAL_STATIC)) {
          returnType += "static ";
        }
        if (null != modifiersAst.findFirstToken(TokenTypes.FINAL)) {
          returnType += "final ";
        }
      }
      returnType += getTypeAsString(ast.findFirstToken(TokenTypes.TYPE)) + " ";
    }
View Full Code Here

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

      DetailAST parametersAst = ast.findFirstToken(TokenTypes.PARAMETERS);
      if (null != parametersAst) {
        DetailAST check = parametersAst.getFirstChild();
        while (null != check) {
          if (TokenTypes.PARAMETER_DEF == check.getType()) {
            parameters += getTypeAsString(check.findFirstToken(TokenTypes.TYPE)) + ", ";
          }
          check = check.getNextSibling();
        }
        parameters = "(" + parameters + ")";
      }
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()

    @Override
    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()

        final DetailAST slist = getMainAst().findFirstToken(TokenTypes.SLIST);
        if (slist == null) {
            return null;
        }

        return slist.findFirstToken(TokenTypes.RCURLY);
    }

    /**
     * Check the indentation of the left curly brace.
     */
 
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()

             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);
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.