本文整理汇总了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);
}
示例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();
}
示例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;
}
示例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;
}
};
}
}
示例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();
}
示例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);
}