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


Java ClassType.getTypeArguments方法代码示例

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


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

示例1: visitClassType

import com.sun.tools.javac.code.Type.ClassType; //导入方法依赖的package包/类
@Override
public JCExpression visitClassType(ClassType type, Inliner inliner) {
  ClassSymbol classSym = (ClassSymbol) type.tsym;
  JCExpression classExpr =
      inliner
          .importPolicy()
          .classReference(
              inliner,
              classSym.outermostClass().getQualifiedName().toString(),
              classSym.getQualifiedName().toString());
  List<JCExpression> argExprs = List.nil();
  for (Type argType : type.getTypeArguments()) {
    argExprs = argExprs.append(visit(argType, inliner));
  }
  return argExprs.isEmpty() ? classExpr : inliner.maker().TypeApply(classExpr, argExprs);
}
 
开发者ID:google,项目名称:error-prone,代码行数:17,代码来源:Inliner.java

示例2: typeArgumentsString

import com.sun.tools.javac.code.Type.ClassType; //导入方法依赖的package包/类
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuilder s = new StringBuilder();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:18,代码来源:TypeMaker.java

示例3: visitClassType

import com.sun.tools.javac.code.Type.ClassType; //导入方法依赖的package包/类
@Override
public Void visitClassType(ClassType t, Void _unused) {
    visit(t.getEnclosingType());
    for (Type targ : t.getTypeArguments()) {
        visit(targ);
    }
    return null;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:9,代码来源:InferenceContext.java

示例4: visitClassType

import com.sun.tools.javac.code.Type.ClassType; //导入方法依赖的package包/类
@Override
public Type visitClassType(ClassType t, Boolean upward) {
    if (upward && !t.isCompound() && t.tsym.name.isEmpty()) {
        //lift anonymous class type to first supertype (class or interface)
        return types.directSupertypes(t).last();
    } else if (t.isCompound()) {
        List<Type> components = types.directSupertypes(t);
        List<Type> components1 = components.map(c -> c.map(this, upward));
        if (components == components1) return t;
        else return types.makeIntersectionType(components1);
    } else {
        Type outer = t.getEnclosingType();
        Type outer1 = visit(outer, upward);
        List<Type> typarams = t.getTypeArguments();
        List<Type> typarams1 = typarams.map(ta -> mapTypeArgument(ta, upward));
        if (typarams1.stream().anyMatch(ta -> ta.hasTag(BOT))) {
            //not defined
            return syms.botType;
        }
        if (outer1 == outer && typarams1 == typarams) return t;
        else return new ClassType(outer1, typarams1, t.tsym, t.getMetadata()) {
            @Override
            protected boolean needsStripping() {
                return true;
            }
        };
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:29,代码来源:VarTypePrinter.java

示例5: typeArgumentsString

import com.sun.tools.javac.code.Type.ClassType; //导入方法依赖的package包/类
/**
 * Return the actual type arguments of a parameterized type as an
 * angle-bracketed string.  Class name are qualified if "full" is true.
 * Return "" if there are no type arguments or we're hiding generics.
 */
static String typeArgumentsString(DocEnv env, ClassType cl, boolean full) {
    if (env.legacyDoclet || cl.getTypeArguments().isEmpty()) {
        return "";
    }
    StringBuffer s = new StringBuffer();
    for (Type t : cl.getTypeArguments()) {
        s.append(s.length() == 0 ? "<" : ", ");
        s.append(getTypeString(env, t, full));
    }
    s.append(">");
    return s.toString();
}
 
开发者ID:unktomi,项目名称:form-follows-function,代码行数:18,代码来源:TypeMaker.java

示例6: visitClassType

import com.sun.tools.javac.code.Type.ClassType; //导入方法依赖的package包/类
@Override
public JCExpression visitClassType(ClassType type, Inliner inliner) {
  ClassSymbol classSym = (ClassSymbol) type.tsym;
  JCExpression classExpr = inliner.importPolicy().classReference(
      inliner, classSym.outermostClass().getQualifiedName().toString(),
      classSym.getQualifiedName().toString());
  List<JCExpression> argExprs = List.nil();
  for (Type argType : type.getTypeArguments()) {
    argExprs = argExprs.append(visit(argType, inliner));
  }
  return argExprs.isEmpty()
      ? classExpr
      : inliner.maker().TypeApply(classExpr, argExprs);
}
 
开发者ID:sivakumar-kailasam,项目名称:refactor-faster,代码行数:15,代码来源:Inliner.java


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