本文整理汇总了Java中com.sun.tools.javac.code.Symbol.getEnclosingElement方法的典型用法代码示例。如果您正苦于以下问题:Java Symbol.getEnclosingElement方法的具体用法?Java Symbol.getEnclosingElement怎么用?Java Symbol.getEnclosingElement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.tools.javac.code.Symbol
的用法示例。
在下文中一共展示了Symbol.getEnclosingElement方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitNewClass
import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override
@CheckForNull
public Void visitNewClass(@NonNull final NewClassTree node, @NonNull final Map<Pair<BinaryName,String>, UsagesData<String>> p) {
final Symbol sym = ((JCTree.JCNewClass)node).constructor;
if (sym != null) {
final Symbol owner = sym.getEnclosingElement();
if (owner != null && owner.getKind().isClass()) {
addUsage(
owner,
activeClass.peek(),
p,
ClassIndexImpl.UsageType.METHOD_REFERENCE);
}
}
return super.visitNewClass (node,p);
}
示例2: visitSelect
import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override public void visitSelect(JCTree.JCFieldAccess jcFieldAccess) {
Symbol symbol = jcFieldAccess.sym;
if (symbol != null
&& symbol.getEnclosingElement() != null
&& symbol.getEnclosingElement().getEnclosingElement() != null
&& symbol.getEnclosingElement().getEnclosingElement().enclClass() != null) {
Set<String> rClassSet = rClasses.get(currentPackageName);
if (rClassSet == null) {
rClassSet = new HashSet<>();
rClasses.put(currentPackageName, rClassSet);
}
rClassSet.add(symbol.getEnclosingElement().getEnclosingElement().enclClass().className());
}
}
示例3: hasErrorName
import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
private boolean hasErrorName (@NullAllowed Symbol cs) {
while (cs != null) {
if (cs.name == names.error) {
return true;
}
cs = cs.getEnclosingElement();
}
return false;
}
示例4: visitSelect
import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override
public void visitSelect(JCTree.JCFieldAccess jcFieldAccess) {
Symbol symbol = jcFieldAccess.sym;
if (symbol != null
&& symbol.getEnclosingElement() != null
&& symbol.getEnclosingElement().getEnclosingElement() != null
&& symbol.getEnclosingElement().getEnclosingElement().enclClass() != null) {
Set<String> rClassSet = rClasses.get(currentPackageName);
if (rClassSet == null) {
rClassSet = new HashSet<>();
rClasses.put(currentPackageName, rClassSet);
}
rClassSet.add(symbol.getEnclosingElement().getEnclosingElement().enclClass().className());
}
}
示例5: visitSelect
import com.sun.tools.javac.code.Symbol; //导入方法依赖的package包/类
@Override
public void visitSelect(JCTree.JCFieldAccess jcFieldAccess) {
final Symbol symbol = jcFieldAccess.sym;
if (symbol != null
&& symbol.getEnclosingElement() != null
&& symbol.getEnclosingElement().getEnclosingElement() != null
&& symbol.getEnclosingElement().getEnclosingElement().enclClass() != null) {
className = symbol.getEnclosingElement().getEnclosingElement().enclClass().className();
}
}