當前位置: 首頁>>代碼示例>>Java>>正文


Java TreeMaker.Wildcard方法代碼示例

本文整理匯總了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));
}
 
開發者ID:sivakumar-kailasam,項目名稱:refactor-faster,代碼行數:8,代碼來源:Inliner.java

示例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));
}
 
開發者ID:google,項目名稱:error-prone,代碼行數:6,代碼來源:Inliner.java

示例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;
}
 
開發者ID:redundent,項目名稱:lombok,代碼行數:51,代碼來源:JavacHandlerUtil.java


注:本文中的com.sun.tools.javac.tree.TreeMaker.Wildcard方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。