当前位置: 首页>>代码示例>>Java>>正文


Java TokenTypes.DOT属性代码示例

本文整理汇总了Java中com.puppycrawl.tools.checkstyle.api.TokenTypes.DOT属性的典型用法代码示例。如果您正苦于以下问题:Java TokenTypes.DOT属性的具体用法?Java TokenTypes.DOT怎么用?Java TokenTypes.DOT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.puppycrawl.tools.checkstyle.api.TokenTypes的用法示例。


在下文中一共展示了TokenTypes.DOT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveType

/**
 * resolves and expression of type TokenTypes.TYPE
 *
 * @param expression the <code>SymTabAST</code> of the expression
 * @param location the <code>Scope</code> where the expression occurs
 * @param context the <code>Scope</code> in which the expression occurs
 *                (where the search for a defintion begins)
 * @param referencePhase whether or not this is the reference phase of
 *                       table construction
 * @return the resulting scope of the expression (the type to which it evaluates)
 * @see #resolveDottedName(SymTabAST, Scope, IClass, boolean)
 * @see #resolveClassIdent(SymTabAST, Scope, IClass, boolean)
 */
public IClass resolveType(
    SymTabAST expr,
    Scope location,
    IClass context,
    boolean referencePhase) {
    IClass result = null;
    SymTabAST nameNode = (SymTabAST) expr.getFirstChild();

    // TODO: Checkstyle change.
    // Do not create references from typecast.
    // Original transmogrify code is equivalent to
    // final boolean createReference = referencePhase;
    // which creates non-existant references for variables.
    final boolean createReference = false;
    if (nameNode.getType() == TokenTypes.DOT) {
        result =
            resolveDottedName(nameNode, location, context, createReference);
    }
    else {
        result =
            resolveClassIdent(nameNode, location, context, createReference);
    }

    return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:38,代码来源:Resolver.java

示例2: createPackage

/**
 * gets the package represented by the tree.  The method
 * analyzes the tree, constructs an appropriate package name
 * and fetches it from the internal package list. If the package does not
 * exist it is created.
 *
 * @param tree <code>SymTabAST</code> to consider
 *
 * @return <code>PackageDef</code> the resulting package definition
 * @see #getPackage(Scope, SymTabAST)
 */
private PackageDef createPackage( SymTabAST tree ) {
  PackageDef result = null;

  if (tree.getType() == TokenTypes.DOT) {
    // find the package result of left child
    SymTabAST leftChild = (SymTabAST)tree.getFirstChild();
    SymTabAST rightChild = (SymTabAST)leftChild.getNextSibling();

    PackageDef context = createPackage(leftChild);
    result = getPackage( context, rightChild );
  }
  else {
    result = getPackage(symbolTable.getBaseScope(), tree);
  }

  return result;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:TableMaker.java

示例3: setExceptionsThrown

/**
*
* setExceptionsThrown adds a reference to the methods Exceptions
* to the method definition
* @return <code>void</code>
* @see net.sourceforge.transmogrify.symtab.SymbolTable
* @see net.sourceforge.transmogrify.symtab.PackageDef
* @see net.sourceforge.transmogrify.symtab.MethodDef
*/
private void setExceptionsThrown() {
  IClass exception = null;
  SymTabAST throwsNode
    = _node.findFirstToken(TokenTypes.LITERAL_THROWS);

  if ( throwsNode != null ) {
    SymTabAST exceptionNode = (SymTabAST)(throwsNode.getFirstChild());
    while (exceptionNode != null ) {
      if (exceptionNode.getType() == TokenTypes.DOT) {
        PackageDef pkg = symbolTable.getPackage(ASTUtil.constructPackage(exceptionNode));
        if ( pkg != null ) {
          exception = pkg.getClassDefinition(ASTUtil.constructClass(exceptionNode));
        }
      }
      else {
        exception = _def.getClassDefinition(exceptionNode.getText());
      }
      _def.addException(exception);
      exceptionNode = (SymTabAST)(exceptionNode.getNextSibling());
    }
  }

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:32,代码来源:TableMaker.java

示例4: getAcceptableTokens

@Override
public int[] getAcceptableTokens() {
    return new int[] {
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.VARIABLE_DEF,
        TokenTypes.PARAMETER_DEF,
        TokenTypes.ANNOTATION_DEF,
        TokenTypes.TYPECAST,
        TokenTypes.LITERAL_THROWS,
        TokenTypes.IMPLEMENTS_CLAUSE,
        TokenTypes.TYPE_ARGUMENT,
        TokenTypes.LITERAL_NEW,
        TokenTypes.DOT,
        TokenTypes.ANNOTATION_FIELD_DEF,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:20,代码来源:AnnotationLocationCheck.java

示例5: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final AnnotationLocationCheck constantNameCheckObj = new AnnotationLocationCheck();
    final int[] actual = constantNameCheckObj.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.VARIABLE_DEF,
        TokenTypes.PARAMETER_DEF,
        TokenTypes.ANNOTATION_DEF,
        TokenTypes.TYPECAST,
        TokenTypes.LITERAL_THROWS,
        TokenTypes.IMPLEMENTS_CLAUSE,
        TokenTypes.TYPE_ARGUMENT,
        TokenTypes.LITERAL_NEW,
        TokenTypes.DOT,
        TokenTypes.ANNOTATION_FIELD_DEF,
        };
    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:23,代码来源:AnnotationLocationCheckTest.java

示例6: testGetAcceptableTokens

@Test
public void testGetAcceptableTokens() {
    final AnnotationOnSameLineCheck constantNameCheckObj = new AnnotationOnSameLineCheck();
    final int[] actual = constantNameCheckObj.getAcceptableTokens();
    final int[] expected = {
        TokenTypes.CLASS_DEF,
        TokenTypes.INTERFACE_DEF,
        TokenTypes.ENUM_DEF,
        TokenTypes.METHOD_DEF,
        TokenTypes.CTOR_DEF,
        TokenTypes.VARIABLE_DEF,
        TokenTypes.PARAMETER_DEF,
        TokenTypes.ANNOTATION_DEF,
        TokenTypes.TYPECAST,
        TokenTypes.LITERAL_THROWS,
        TokenTypes.IMPLEMENTS_CLAUSE,
        TokenTypes.TYPE_ARGUMENT,
        TokenTypes.LITERAL_NEW,
        TokenTypes.DOT,
        TokenTypes.ANNOTATION_FIELD_DEF,
    };
    assertArrayEquals("Default acceptable tokens are invalid", expected, actual);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:23,代码来源:AnnotationOnSameLineCheckTest.java

示例7: isChainedMethodCallWrapped

/**
 * If this is the first chained method call which was moved to the next line.
 * @return true if chained class are wrapped
 */
private boolean isChainedMethodCallWrapped() {
    boolean result = false;
    final DetailAST main = getMainAst();
    final DetailAST dot = main.getFirstChild();
    final DetailAST target = dot.getFirstChild();

    final DetailAST dot1 = target.getFirstChild();
    final DetailAST target1 = dot1.getFirstChild();

    if (dot1.getType() == TokenTypes.DOT
        && target1.getType() == TokenTypes.METHOD_CALL) {
        result = true;
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:MethodCallHandler.java

示例8: makeAcceptableTokens

/**
 * Returns array of acceptable tokens.
 * @return acceptableTokens.
 */
private static int[] makeAcceptableTokens() {
    return new int[] {TokenTypes.ANNOTATION,
        TokenTypes.ANNOTATION_FIELD_DEF,
        TokenTypes.CTOR_CALL,
        TokenTypes.CTOR_DEF,
        TokenTypes.DOT,
        TokenTypes.ENUM_CONSTANT_DEF,
        TokenTypes.EXPR,
        TokenTypes.LITERAL_CATCH,
        TokenTypes.LITERAL_DO,
        TokenTypes.LITERAL_FOR,
        TokenTypes.LITERAL_IF,
        TokenTypes.LITERAL_NEW,
        TokenTypes.LITERAL_SWITCH,
        TokenTypes.LITERAL_SYNCHRONIZED,
        TokenTypes.LITERAL_WHILE,
        TokenTypes.METHOD_CALL,
        TokenTypes.METHOD_DEF,
        TokenTypes.QUESTION,
        TokenTypes.RESOURCE_SPECIFICATION,
        TokenTypes.SUPER_CTOR_CALL,
        TokenTypes.LAMBDA,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:28,代码来源:ParenPadCheck.java

示例9: getThrows

/**
 * Computes the exception nodes for a method.
 *
 * @param ast the method node.
 * @return the list of exception nodes for ast.
 */
private List<ExceptionInfo> getThrows(DetailAST ast) {
    final List<ExceptionInfo> returnValue = new ArrayList<ExceptionInfo>();
    final DetailAST throwsAST = ast
            .findFirstToken(TokenTypes.LITERAL_THROWS);
    if (throwsAST != null) {
        DetailAST child = throwsAST.getFirstChild();
        while (child != null) {
            if (child.getType() == TokenTypes.IDENT
                    || child.getType() == TokenTypes.DOT) {
                final FullIdent ident = FullIdent.createFullIdent(child);
                final ExceptionInfo exceptionInfo = new ExceptionInfo(
                        createClassInfo(new Token(ident), getCurrentClassName()));
                returnValue.add(exceptionInfo);
            }
            child = child.getNextSibling();
        }
    }
    return returnValue;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:25,代码来源:JavadocMethodCheck.java

示例10: getAcceptableTokens

@Override
public int[] getAcceptableTokens() {
    return new int[] {
        TokenTypes.ARRAY_INIT,
        TokenTypes.AT,
        TokenTypes.INC,
        TokenTypes.DEC,
        TokenTypes.UNARY_MINUS,
        TokenTypes.UNARY_PLUS,
        TokenTypes.BNOT,
        TokenTypes.LNOT,
        TokenTypes.DOT,
        TokenTypes.TYPECAST,
        TokenTypes.ARRAY_DECLARATOR,
        TokenTypes.INDEX_OP,
        TokenTypes.LITERAL_SYNCHRONIZED,
        TokenTypes.METHOD_REF,
    };
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:19,代码来源:NoWhitespaceAfterCheck.java

示例11: isNotRelevantSituation

/**
 * Is ast not a target of Check.
 * @param ast ast
 * @param currentType type of ast
 * @return true is ok to skip validation
 */
private boolean isNotRelevantSituation(DetailAST ast, int currentType) {
    final int parentType = ast.getParent().getType();
    final boolean starImport = currentType == TokenTypes.STAR
            && parentType == TokenTypes.DOT;
    final boolean slistInsideCaseGroup = currentType == TokenTypes.SLIST
            && parentType == TokenTypes.CASE_GROUP;

    final boolean starImportOrSlistInsideCaseGroup = starImport || slistInsideCaseGroup;
    final boolean colonOfCaseOrDefaultOrForEach =
            isColonOfCaseOrDefault(currentType, parentType)
                    || isColonOfForEach(currentType, parentType);
    final boolean emptyBlockOrType =
            isEmptyBlock(ast, parentType)
                || allowEmptyTypes && isEmptyType(ast);

    return starImportOrSlistInsideCaseGroup
            || colonOfCaseOrDefaultOrForEach
            || emptyBlockOrType
            || isArrayInitialization(currentType, parentType);
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:26,代码来源:WhitespaceAroundCheck.java

示例12: makeNodes

private void makeNodes(SymTabAST node)
{
    if (node.getType() == TokenTypes.DOT) {
        SymTabAST left = (SymTabAST) node.getFirstChild();
        SymTabAST right = (SymTabAST) left.getNextSibling();

        makeNodes(left);
        makeNodes(right);
    }
    else {
        _nodes.add(node);
    }
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:13,代码来源:DotIterator.java

示例13: isClassType

private boolean isClassType(DetailAST ast) {
	DetailAST firstChild = ast.getFirstChild();
	// In the declaration of a type, we get the type name from the childs of
	// the type. If there are no childs or the child not of the right types
	// the type declaration does not contain a classname
	if (firstChild != null
			&& (firstChild.getType() == TokenTypes.IDENT || firstChild.getType() == TokenTypes.DOT)) {
		return true;
	}
	return false;
}
 
开发者ID:NovaTecConsulting,项目名称:stereotype-check,代码行数:11,代码来源:StereotypeCheck.java

示例14: getAcceptableParent

/**
 * Returns parent of given ast if parent has one of the following types:
 * ANNOTATION_DEF, PACKAGE_DEF, CLASS_DEF, ENUM_DEF, ENUM_CONSTANT_DEF, CTOR_DEF,
 * METHOD_DEF, PARAMETER_DEF, VARIABLE_DEF, ANNOTATION_FIELD_DEF, TYPE, LITERAL_NEW,
 * LITERAL_THROWS, TYPE_ARGUMENT, IMPLEMENTS_CLAUSE, DOT.
 * @param child an ast
 * @return returns ast - parent of given
 */
private static DetailAST getAcceptableParent(DetailAST child) {
    final DetailAST result;
    final DetailAST parent = child.getParent();
    switch (parent.getType()) {
        case TokenTypes.ANNOTATION_DEF:
        case TokenTypes.PACKAGE_DEF:
        case TokenTypes.CLASS_DEF:
        case TokenTypes.INTERFACE_DEF:
        case TokenTypes.ENUM_DEF:
        case TokenTypes.ENUM_CONSTANT_DEF:
        case TokenTypes.CTOR_DEF:
        case TokenTypes.METHOD_DEF:
        case TokenTypes.PARAMETER_DEF:
        case TokenTypes.VARIABLE_DEF:
        case TokenTypes.ANNOTATION_FIELD_DEF:
        case TokenTypes.TYPE:
        case TokenTypes.LITERAL_NEW:
        case TokenTypes.LITERAL_THROWS:
        case TokenTypes.TYPE_ARGUMENT:
        case TokenTypes.IMPLEMENTS_CLAUSE:
        case TokenTypes.DOT:
            result = parent;
            break;
        default:
            // it's possible case, but shouldn't be processed here
            result = null;
    }
    return result;
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:37,代码来源:SuppressWarningsHolder.java

示例15: processMethodCall

/**
 * Add the method call to the current frame if it should be processed.
 * @param methodCall METHOD_CALL ast.
 */
private void processMethodCall(DetailAST methodCall) {
    final DetailAST dot = methodCall.getFirstChild();
    if (dot.getType() == TokenTypes.DOT) {
        final String methodName = dot.getLastChild().getText();
        if (EQUALS.equals(methodName)
                || !ignoreEqualsIgnoreCase && "equalsIgnoreCase".equals(methodName)) {
            currentFrame.addMethodCall(methodCall);
        }
    }
}
 
开发者ID:rnveach,项目名称:checkstyle-backport-jre6,代码行数:14,代码来源:EqualsAvoidNullCheck.java


注:本文中的com.puppycrawl.tools.checkstyle.api.TokenTypes.DOT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。