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


Java Symbol.getKind方法代码示例

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


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

示例1: attributeParamIdentifier

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
private Symbol attributeParamIdentifier(TreePath path, DCParam ptag) {
    Symbol javadocSymbol = getElement(path);
    if (javadocSymbol == null)
        return null;
    ElementKind kind = javadocSymbol.getKind();
    List<? extends Symbol> params = List.nil();
    if (kind == ElementKind.METHOD || kind == ElementKind.CONSTRUCTOR) {
        MethodSymbol ee = (MethodSymbol) javadocSymbol;
        params = ptag.isTypeParameter()
                ? ee.getTypeParameters()
                : ee.getParameters();
    } else if (kind.isClass() || kind.isInterface()) {
        ClassSymbol te = (ClassSymbol) javadocSymbol;
        params = te.getTypeParameters();
    }

    for (Symbol param : params) {
        if (param.getSimpleName() == ptag.getName().getName()) {
            return param;
        }
    }
    return null;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:24,代码来源:JavacTrees.java

示例2: getDescriptorElement

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
/**
 * Find the element of the method descriptor associated to the functional interface.
 * 
 * @param origin functional interface element
 * @return associated method descriptor element or <code>null</code> if the <code>origin</code> is not a functional interface.
 * @since 2.14
 */
public ExecutableElement getDescriptorElement(TypeElement origin) {
    com.sun.tools.javac.code.Types types = com.sun.tools.javac.code.Types.instance(info.impl.getJavacTask().getContext());
    if (types.isFunctionalInterface((TypeSymbol)origin)) {
        Symbol sym = types.findDescriptorSymbol((TypeSymbol)origin);
        if (sym != null && sym.getKind() == ElementKind.METHOD) {
            return (ExecutableElement)sym;
        }
    }
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:ElementUtilities.java

示例3: matchAssignment

import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override
public Description matchAssignment(AssignmentTree tree, VisitorState state) {
  if (!matchWithinClass) {
    return Description.NO_MATCH;
  }
  Type lhsType = ASTHelpers.getType(tree.getVariable());
  if (lhsType != null && lhsType.isPrimitive()) {
    return doUnboxingCheck(state, tree.getExpression());
  }
  Symbol assigned = ASTHelpers.getSymbol(tree.getVariable());
  if (assigned == null || assigned.getKind() != ElementKind.FIELD) {
    // not a field of nullable type
    return Description.NO_MATCH;
  }

  if (Nullness.hasNullableAnnotation(assigned)) {
    // field already annotated
    return Description.NO_MATCH;
  }
  ExpressionTree expression = tree.getExpression();
  if (mayBeNullExpr(state, expression)) {
    String message = "assigning @Nullable expression to @NonNull field";
    return createErrorDescriptionForNullAssignment(
        MessageTypes.ASSIGN_FIELD_NULLABLE, tree, message, expression, state.getPath());
  }
  return Description.NO_MATCH;
}
 
开发者ID:uber,项目名称:NullAway,代码行数:28,代码来源:NullAway.java


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