本文整理汇总了Java中com.sun.tools.javac.code.Type.ClassType方法的典型用法代码示例。如果您正苦于以下问题:Java Type.ClassType方法的具体用法?Java Type.ClassType怎么用?Java Type.ClassType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.code.Type
的用法示例。
在下文中一共展示了Type.ClassType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitClassType
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
@Override
public Type visitClassType( Type.ClassType t, Void s )
{
boolean erased = false;
Type erasure = _types.erasure( t );
Type base = visitType( erasure, s );
if( base != erasure )
{
erased = true;
}
ArrayList<Type> params = new ArrayList<>();
for( Type arg : t.allparams() )
{
Type param = visit( arg );
params.add( param );
if( param != arg )
{
erased = true;
}
}
if( erased )
{
return new Type.ClassType( t.getEnclosingType(), List.from( params ), base.tsym );
}
return t;
}
示例2: eraseGenericStructuralVarargs
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
private void eraseGenericStructuralVarargs( JCTree.JCMethodInvocation tree )
{
if( tree.varargsElement instanceof Type.ClassType && TypeUtil.isStructuralInterface( _tp, tree.varargsElement.tsym ) )
{
tree.varargsElement = _tp.getSymtab().objectType;
}
}
示例3: matches
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
@Override
public boolean matches(MethodInvocationTree tree, VisitorState state) {
boolean matchFound = false;
try {
final MemberSelectTree memberTree = (MemberSelectTree) tree.getMethodSelect();
if (!memberTree.getIdentifier().contentEquals(SUBSCRIBE)) {
return false;
}
for (MethodMatchers.MethodNameMatcher nameMatcher : SUBSCRIBE_MATCHERS) {
if (!nameMatcher.matches(tree, state)) {
continue;
} else {
matchFound = true;
break;
}
}
if (!matchFound) {
return false;
}
ClassTree enclosingClass =
ASTHelpers.findEnclosingNode(state.getPath(), ClassTree.class);
Type.ClassType enclosingClassType = ASTHelpers.getType(enclosingClass);
Type routerType = state.getTypeFromString("com.uber.rib.core.Router");
Type presenterType = state.getTypeFromString("com.uber.rib.core.Presenter");
Type interactorType = state.getTypeFromString("com.uber.rib.core.Interactor");
Type workerType = state.getTypeFromString("com.uber.rib.core.Worker");
if (!ASTHelpers.isSubtype(enclosingClassType, routerType, state)
&& !ASTHelpers.isSubtype(enclosingClassType, presenterType, state)
&& !ASTHelpers.isSubtype(enclosingClassType, interactorType, state)
&& !ASTHelpers.isSubtype(enclosingClassType, workerType, state)) {
return false;
}
return !TO_CALL_MATCHER.matches(memberTree.getExpression(), state);
} catch (ClassCastException e) {
return false;
}
}
示例4: visitClassType
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
@Override
public Type visitClassType(Type.ClassType t, StringBuilder s) {
setDeclaredType(t, s);
return null;
}
示例5: getTypeByName
import com.sun.tools.javac.code.Type; //导入方法依赖的package包/类
Type getTypeByName(String typeName, List<Type> tparams) {
return new Type.ClassType(
Type.noType,
tparams,
new Symbol.ClassSymbol(0, names.fromString(typeName), null));
}