本文整理匯總了Java中com.sun.tools.javac.tree.TreeMaker.Wildcard方法的典型用法代碼示例。如果您正苦於以下問題:Java TreeMaker.Wildcard方法的具體用法?Java TreeMaker.Wildcard怎麽用?Java TreeMaker.Wildcard使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sun.tools.javac.tree.TreeMaker
的用法示例。
在下文中一共展示了TreeMaker.Wildcard方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: visitWildcardType
import com.sun.tools.javac.tree.TreeMaker; //導入方法依賴的package包/類
@Override
public JCExpression visitWildcardType(WildcardType type, Inliner inliner) {
TreeMaker maker = inliner.maker();
return maker.Wildcard(
maker.TypeBoundKind(type.kind),
visit(type.baseType(), inliner));
}
示例2: visitWildcardType
import com.sun.tools.javac.tree.TreeMaker; //導入方法依賴的package包/類
@Override
public JCExpression visitWildcardType(WildcardType type, Inliner inliner) {
TreeMaker maker = inliner.maker();
return maker.Wildcard(maker.TypeBoundKind(type.kind), visit(type.type, inliner));
}
示例3: cloneType0
import com.sun.tools.javac.tree.TreeMaker; //導入方法依賴的package包/類
private static JCExpression cloneType0(TreeMaker maker, JCTree in) {
if (in == null) return null;
if (in instanceof JCPrimitiveTypeTree) return (JCExpression) in;
if (in instanceof JCIdent) {
return maker.Ident(((JCIdent) in).name);
}
if (in instanceof JCFieldAccess) {
JCFieldAccess fa = (JCFieldAccess) in;
return maker.Select(cloneType0(maker, fa.selected), fa.name);
}
if (in instanceof JCArrayTypeTree) {
JCArrayTypeTree att = (JCArrayTypeTree) in;
return maker.TypeArray(cloneType0(maker, att.elemtype));
}
if (in instanceof JCTypeApply) {
JCTypeApply ta = (JCTypeApply) in;
ListBuffer<JCExpression> lb = ListBuffer.lb();
for (JCExpression typeArg : ta.arguments) {
lb.append(cloneType0(maker, typeArg));
}
return maker.TypeApply(cloneType0(maker, ta.clazz), lb.toList());
}
if (in instanceof JCWildcard) {
JCWildcard w = (JCWildcard) in;
JCExpression newInner = cloneType0(maker, w.inner);
TypeBoundKind newKind;
switch (w.getKind()) {
case SUPER_WILDCARD:
newKind = maker.TypeBoundKind(BoundKind.SUPER);
break;
case EXTENDS_WILDCARD:
newKind = maker.TypeBoundKind(BoundKind.EXTENDS);
break;
default:
case UNBOUNDED_WILDCARD:
newKind = maker.TypeBoundKind(BoundKind.UNBOUND);
break;
}
return maker.Wildcard(newKind, newInner);
}
// This is somewhat unsafe, but it's better than outright throwing an exception here. Returning null will just cause an exception down the pipeline.
return (JCExpression) in;
}