本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.TypeBoundKind类的典型用法代码示例。如果您正苦于以下问题:Java TypeBoundKind类的具体用法?Java TypeBoundKind怎么用?Java TypeBoundKind使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TypeBoundKind类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了TypeBoundKind类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visit
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
@Override
public JCTree visit(final WildcardType n, final Object arg) {
//ARG0: TypeBoundKind kind
// For < ? extends> or < ? super > or < ? >
TypeBoundKind arg0;
//ARG1: JCTree inner
// A class associated to this type, if any
JCTree arg1;
if (n.getExtends() != null) {
arg0 = new ATypeBoundKind(make.TypeBoundKind(EXTENDS), null);
arg1 = n.getExtends().accept(this, arg);
} else if (n.getSuper() != null) {
arg0 = new ATypeBoundKind(make.TypeBoundKind(SUPER), null);
arg1 = n.getSuper().accept(this, arg);
} else {
arg0 = new ATypeBoundKind(make.TypeBoundKind(UNBOUND), null);
arg1 = null;
}
return new AJCWildcard(make.Wildcard(arg0, arg1), ((n.getComment() != null) ? n.getComment().getContent() : null));
}
示例2: diffTypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
protected int diffTypeBoundKind(TypeBoundKind oldT, TypeBoundKind newT, int[] bounds) {
int localPointer = bounds[0];
if (oldT.kind != newT.kind) {
copyTo(localPointer, oldT.pos);
printer.print(newT.kind.toString());
localPointer = oldT.pos + oldT.kind.toString().length();
}
copyTo(localPointer, bounds[1]);
return bounds[1];
}
示例3: reflectiveScan
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
/** record all tree nodes found by reflection. */
public void reflectiveScan(Object o) {
if (o == null)
return;
if (o instanceof JCTree) {
JCTree tree = (JCTree) o;
//System.err.println("EXPECT: " + tree.getKind() + " " + trim(tree, 64));
expect.add(tree);
for (Field f: getFields(tree)) {
if (TypeBoundKind.class.isAssignableFrom(f.getType())) {
// not part of public API
continue;
}
try {
//System.err.println("FIELD: " + f.getName());
if (tree instanceof JCModuleDecl && f.getName().equals("mods")) {
// The modifiers will not found by TreeScanner,
// but the embedded annotations will be.
reflectiveScan(((JCModuleDecl) tree).mods.annotations);
} else {
reflectiveScan(f.get(tree));
}
} catch (IllegalAccessException e) {
error(e.toString());
}
}
} else if (o instanceof List) {
List<?> list = (List<?>) o;
for (Object item: list)
reflectiveScan(item);
} else
error("unexpected item: " + o);
}
示例4: reflectiveScan
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
/** record all tree nodes found by reflection. */
public void reflectiveScan(Object o) {
if (o == null)
return;
if (o instanceof JCTree) {
JCTree tree = (JCTree) o;
//System.err.println("EXPECT: " + tree.getKind() + " " + trim(tree, 64));
expect.add(tree);
for (Field f: getFields(tree)) {
if (TypeBoundKind.class.isAssignableFrom(f.getType())) {
// not part of public API
continue;
}
try {
//System.err.println("FIELD: " + f.getName());
reflectiveScan(f.get(tree));
} catch (IllegalAccessException e) {
error(e.toString());
}
}
} else if (o instanceof List) {
List<?> list = (List<?>) o;
for (Object item: list)
reflectiveScan(item);
} else
error("unexpected item: " + o);
}
示例5: visitTypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
public void visitTypeBoundKind(TypeBoundKind that) {
try {
print("TypeBoundKind:");
} catch (Exception e) {
}
super.visitTypeBoundKind(that);
}
示例6: visitTypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
public void visitTypeBoundKind(TypeBoundKind tree) {
try {
print(String.valueOf(tree.kind));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例7: visitTypeReference
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
@Override
public boolean visitTypeReference(TypeReference node) {
WildcardKind wildcard = node.astWildcard();
if (wildcard == WildcardKind.UNBOUND) {
return posSet(node, treeMaker.Wildcard(treeMaker.TypeBoundKind(BoundKind.UNBOUND), null));
}
JCExpression result = plainTypeReference(node);
result = addWildcards(node, result, wildcard);
result = addDimensions(node, result, node.astArrayDimensions());
return set(node, result);
}
示例8: addWildcards
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
private JCExpression addWildcards(Node node, JCExpression type, WildcardKind wildcardKind) {
TypeBoundKind typeBoundKind;
switch (wildcardKind) {
case NONE:
return type;
case EXTENDS:
typeBoundKind = treeMaker.TypeBoundKind(BoundKind.EXTENDS);
Position jcExtendsPos = getConversionPositionInfo(node, "extends");
if (jcExtendsPos == null) {
setPos(posOfStructure(node, "extends", true), posOfStructure(node, "extends", false), typeBoundKind);
} else {
setPos(jcExtendsPos.getStart(), jcExtendsPos.getEnd(), typeBoundKind);
}
return setPos(type.pos, endPosTable.get(type), treeMaker.Wildcard(typeBoundKind, type));
case SUPER:
typeBoundKind = treeMaker.TypeBoundKind(BoundKind.SUPER);
Position jcSuperPos = getConversionPositionInfo(node, "super");
if (jcSuperPos == null) {
setPos(posOfStructure(node, "super", true), posOfStructure(node, "super", false), typeBoundKind);
} else {
setPos(jcSuperPos.getStart(), jcSuperPos.getEnd(), typeBoundKind);
}
return setPos(type.pos, endPosTable.get(type), treeMaker.Wildcard(typeBoundKind, type));
default:
throw new IllegalStateException("Unexpected unbound wildcard: " + wildcardKind);
}
}
示例9: getTypeBoundKindPosition
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
private Position getTypeBoundKindPosition(JCWildcard node) {
try {
Object o = JCWILDCARD_KIND.get(node);
if (o instanceof TypeBoundKind) {
return getPosition((TypeBoundKind) o);
}
} catch (Exception e) {}
return Position.UNPLACED;
}
示例10: reflectiveScan
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
/** record all tree nodes found by reflection. */
public void reflectiveScan(Object o) {
if (o == null)
return;
if (o instanceof JCTree) {
JCTree tree = (JCTree) o;
//System.err.println("EXPECT: " + tree.getKind() + " " + trim(tree, 64));
expect.add(tree);
for (Field f: getFields(tree)) {
if (TypeBoundKind.class.isAssignableFrom(f.getType())) {
// not part of public API
continue;
}
if (JCTree.JCNewArray.class.isAssignableFrom(tree.getClass())
&& (f.getName().equals("annotations")
|| f.getName().equals("dimAnnotations"))) {
// these fields are incorrectly missing from the public API
// (CR 6983297)
continue;
}
try {
//System.err.println("FIELD: " + f.getName());
reflectiveScan(f.get(tree));
} catch (IllegalAccessException e) {
error(e.toString());
}
}
} else if (o instanceof List) {
List<?> list = (List<?>) o;
for (Object item: list)
reflectiveScan(item);
} else
error("unexpected item: " + o);
}
示例11: visitTypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
@Override
public void visitTypeBoundKind(TypeBoundKind tree) {
try {
print(String.valueOf(tree.kind));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例12: visitTypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
public void visitTypeBoundKind(TypeBoundKind tree) {
try {
print(String.valueOf(tree.kind));
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
示例13: Wildcard
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
public JCWildcard Wildcard(TypeBoundKind kind, JCTree type) {
return invoke(Wildcard, kind, type);
}
示例14: TypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
public TypeBoundKind TypeBoundKind(BoundKind kind) {
return invoke(TypeBoundKind, kind);
}
示例15: visitTypeBoundKind
import com.sun.tools.javac.tree.JCTree.TypeBoundKind; //导入依赖的package包/类
public void visitTypeBoundKind(TypeBoundKind tree) {
print(String.valueOf(tree.kind));
}