本文整理汇总了Java中com.sun.source.tree.UnionTypeTree类的典型用法代码示例。如果您正苦于以下问题:Java UnionTypeTree类的具体用法?Java UnionTypeTree怎么用?Java UnionTypeTree使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UnionTypeTree类属于com.sun.source.tree包,在下文中一共展示了UnionTypeTree类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: removeAlternativeFromMultiCatch
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
private void removeAlternativeFromMultiCatch(TransformationContext ctx) throws Exception {
TreePath unionPath = ctx.getPath().getParentPath();
UnionTypeTree union = (UnionTypeTree)unionPath.getLeaf();
TreeMaker mk = ctx.getWorkingCopy().getTreeMaker();
GeneratorUtilities gen = GeneratorUtilities.get(ctx.getWorkingCopy());
union = gen.importComments(union, ctx.getWorkingCopy().getCompilationUnit());
List<? extends Tree> alts = new ArrayList<>(union.getTypeAlternatives());
alts.remove(ctx.getPath().getLeaf());
if (alts.size() > 1) {
// still remains a multi-catch
Tree newUnion = mk.UnionType(alts);
ctx.getWorkingCopy().rewrite(union, newUnion);
} else {
// replace union type with just ordinary type
ctx.getWorkingCopy().rewrite(union, alts.get(0));
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:ExtraCatch.java
示例2: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Tree visitUnionType(UnionTypeTree tree, Void p) {
UnionTypeTree n = make.UnionType(tree.getTypeAlternatives());
// model.setType(n, model.getType(tree));
comments.copyComments(tree, n);
model.setPos(n, model.getPos(tree));
return n;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TreeDuplicator.java
示例3: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Void visitUnionType(UnionTypeTree node, EnumSet<UseTypes> p) {
for (Tree tree : node.getTypeAlternatives()) {
handlePossibleIdentifier(new TreePath(getCurrentPath(), tree), EnumSet.of(UseTypes.CLASS_USE));
}
return super.visitUnionType(node, p);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SemanticHighlighterBase.java
示例4: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Object visitUnionType(UnionTypeTree node, Object p) {
for (Tree t : node.getTypeAlternatives()) {
addDependency(info.getTrees().getTypeMirror(new TreePath(getCurrentPath(), t)));
}
return super.visitUnionType(node, p);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DependencyCollector.java
示例5: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Void visitUnionType(UnionTypeTree tree, List<Node> d) {
List<Node> below = new ArrayList<Node>();
addCorrespondingType(below);
addCorrespondingComments(below);
super.visitUnionType(tree, below);
d.add(new TreeNode(info, getCurrentPath(), below));
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:TreeNode.java
示例6: addDisjointType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
private void addDisjointType(List<Tree> to, Tree type) {
if (type == null) return;
if (type.getKind() == Kind.UNION_TYPE) {
to.addAll(((UnionTypeTree) type).getTypeAlternatives());
} else {
to.add(type);
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:JoinCatches.java
示例7: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Mirror visitUnionType(UnionTypeTree node, EvaluationContext p) {
// union type expression in a multicatch var declaration
// unsupported, since catch is unsupported
Assert.error(node, "unsupported");
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:EvaluatorVisitor.java
示例8: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
/**
* Formats a union type declaration in a catch clause.
*/
private void visitUnionType(VariableTree declaration) {
UnionTypeTree type = (UnionTypeTree) declaration.getType();
builder.open(ZERO);
sync(declaration);
visitAndBreakModifiers(
declaration.getModifiers(), Direction.HORIZONTAL, Optional.<BreakTag>absent());
List<? extends Tree> union = type.getTypeAlternatives();
boolean first = true;
for (int i = 0; i < union.size() - 1; i++) {
if (!first) {
builder.breakOp(" ");
token("|");
builder.space();
} else {
first = false;
}
scan(union.get(i), null);
}
builder.breakOp(" ");
token("|");
builder.space();
Tree last = union.get(union.size() - 1);
declareOne(
DeclarationKind.NONE,
Direction.HORIZONTAL,
Optional.<ModifiersTree>absent(),
last,
VarArgsOrNot.NO, // VarArgsOrNot.valueOf(declaration.isVarargs()),
ImmutableList.<AnnotationTree>of(), // declaration.varargsAnnotations(),
declaration.getName(),
"",
// declaration.extraDimensions(),
"=",
Optional.fromNullable(declaration.getInitializer()),
Optional.<String>absent(),
Optional.<ExpressionTree>absent(),
Optional.<TypeWithDims>absent());
builder.close();
}
开发者ID:tranleduy2000,项目名称:javaide,代码行数:43,代码来源:JavaInputAstVisitor.java
示例9: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Void visitUnionType(UnionTypeTree tree, VisitorState visitorState) {
VisitorState state = visitorState.withPath(getCurrentPath());
for (UnionTypeTreeMatcher matcher : unionTypeMatchers) {
if (!isSuppressed(matcher, state)) {
try {
reportMatch(matcher.matchUnionType(tree, state), tree, state);
} catch (Throwable t) {
handleError(matcher, t);
}
}
}
return super.visitUnionType(tree, state);
}
开发者ID:google,项目名称:error-prone,代码行数:15,代码来源:ErrorProneScanner.java
示例10: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public AnnotatedTypeMirror visitUnionType(UnionTypeTree node,
AnnotatedTypeFactory f) {
AnnotatedTypeMirror type = f.type(node);
if (type.getKind() == TypeKind.TYPEVAR)
return forTypeVariable(type, f);
return type;
}
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:11,代码来源:TypeFromTree.java
示例11: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
public Boolean visitUnionType(UnionTypeTree node, ConstructorData p) {
super.visitUnionType(node, p);
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:Flow.java
示例12: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public List<? extends TypeMirror> visitUnionType(UnionTypeTree node, Object p) {
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ExpectedTypeResolver.java
示例13: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public R visitUnionType(UnionTypeTree utt, P p) {
return null;
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:5,代码来源:ApexTreeVisitorAdapter.java
示例14: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public List<T> visitUnionType(UnionTypeTree node, T p) {
return checkForCriteria(node);
}
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:5,代码来源:TreeFinder.java
示例15: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public UUnionType visitUnionType(UnionTypeTree tree, Void v) {
return UUnionType.create(templateTypeExpressions(tree.getTypeAlternatives()));
}
开发者ID:google,项目名称:error-prone,代码行数:5,代码来源:UTemplater.java
示例16: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Choice<Unifier> visitUnionType(UnionTypeTree node, Unifier unifier) {
return unifyList(unifier, getTypeAlternatives(), node.getTypeAlternatives());
}
开发者ID:google,项目名称:error-prone,代码行数:5,代码来源:UUnionType.java
示例17: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public Node visitUnionType(UnionTypeTree tree, Void p) {
assert false : "UnionTypeTree is unexpected in AST to CFG translation";
return null;
}
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:6,代码来源:CFGBuilder.java
示例18: visitUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
@Override
public PurityResult visitUnionType(UnionTypeTree node, PurityResult p) {
assert false : "this type of tree is unexpected here";
return null;
}
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:6,代码来源:PurityChecker.java
示例19: matchUnionType
import com.sun.source.tree.UnionTypeTree; //导入依赖的package包/类
Description matchUnionType(UnionTypeTree tree, VisitorState state);
开发者ID:google,项目名称:error-prone,代码行数:2,代码来源:BugChecker.java
注:本文中的com.sun.source.tree.UnionTypeTree类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论