本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCIdent方法的典型用法代码示例。如果您正苦于以下问题:Java JCTree.JCIdent方法的具体用法?Java JCTree.JCIdent怎么用?Java JCTree.JCIdent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.tree.JCTree
的用法示例。
在下文中一共展示了JCTree.JCIdent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildExceptionClassExpression
import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
@NotNull
public static JCTree.JCExpression buildExceptionClassExpression(@NotNull String exceptionClass,
@NotNull TreeMaker factory,
@NotNull Names symbolsTable)
{
String[] parts = exceptionClass.split("\\.");
JCTree.JCIdent identifier = factory.Ident(symbolsTable.fromString(parts[0]));
JCTree.JCFieldAccess selector = null;
for (int i = 1; i < parts.length; i++) {
selector = factory.Select(selector == null ? identifier : selector, symbolsTable.fromString(parts[i]));
}
return selector == null ? identifier : selector;
}
示例2: visitIdent
import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
/**
* Erase all structural interface type literals to Object
*/
@Override
public void visitIdent( JCTree.JCIdent tree )
{
super.visitIdent( tree );
if( _tp.isGenerate() && !shouldProcessForGeneration() )
{
// Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
return;
}
if( tree.sym != null && TypeUtil.isStructuralInterface( _tp, tree.sym ) && !isReceiver( tree ) )
{
Symbol.ClassSymbol objectSym = getObjectClass();
Tree parent = _tp.getParent( tree );
JCTree.JCIdent objIdent = _tp.getTreeMaker().Ident( objectSym );
if( parent instanceof JCTree.JCVariableDecl )
{
((JCTree.JCVariableDecl)parent).type = objectSym.type;
long parameterModifier = 8589934592L; // Flag.Flag.PARAMETER.value
if( (((JCTree.JCVariableDecl)parent).mods.flags & parameterModifier) != 0 )
{
objIdent.type = objectSym.type;
((JCTree.JCVariableDecl)parent).sym.type = objectSym.type;
((JCTree.JCVariableDecl)parent).vartype = objIdent;
}
}
else if( parent instanceof JCTree.JCWildcard )
{
JCTree.JCWildcard wildcard = (JCTree.JCWildcard)parent;
wildcard.type = new Type.WildcardType( objectSym.type, wildcard.kind.kind, wildcard.type.tsym );
}
tree = objIdent;
tree.type = objectSym.type;
}
result = tree;
}
示例3: visitSelect
import com.sun.tools.javac.tree.JCTree; //导入方法依赖的package包/类
/**
* Erase all structural interface type literals to Object
*/
@Override
public void visitSelect( JCTree.JCFieldAccess tree )
{
super.visitSelect( tree );
if( _tp.isGenerate() && !shouldProcessForGeneration() )
{
// Don't process tree during GENERATE, unless the tree was generated e.g., a bridge method
return;
}
if( TypeUtil.isStructuralInterface( _tp, tree.sym ) && !isReceiver( tree ) )
{
Symbol.ClassSymbol objectSym = getObjectClass();
JCTree.JCIdent objIdent = _tp.getTreeMaker().Ident( objectSym );
Tree parent = _tp.getParent( tree );
if( parent instanceof JCTree.JCVariableDecl )
{
((JCTree.JCVariableDecl)parent).type = objectSym.type;
long parameterModifier = 8589934592L; // Flag.Flag.PARAMETER.value
if( (((JCTree.JCVariableDecl)parent).mods.flags & parameterModifier) != 0 )
{
objIdent.type = objectSym.type;
((JCTree.JCVariableDecl)parent).sym.type = objectSym.type;
((JCTree.JCVariableDecl)parent).vartype = objIdent;
}
}
else if( parent instanceof JCTree.JCWildcard )
{
JCTree.JCWildcard wildcard = (JCTree.JCWildcard)parent;
wildcard.type = new Type.WildcardType( objectSym.type, wildcard.kind.kind, wildcard.type.tsym );
}
result = objIdent;
}
else
{
result = tree;
}
}