本文整理汇总了Java中com.sun.tools.javac.tree.JCTree.JCAnnotatedType类的典型用法代码示例。如果您正苦于以下问题:Java JCAnnotatedType类的具体用法?Java JCAnnotatedType怎么用?Java JCAnnotatedType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JCAnnotatedType类属于com.sun.tools.javac.tree.JCTree包,在下文中一共展示了JCAnnotatedType类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: diffAnnotatedType
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
protected int diffAnnotatedType(JCAnnotatedType oldT, JCAnnotatedType newT, int[] bounds) {
int localPointer = bounds[0];
if (!listsMatch(oldT.annotations, newT.annotations)) {
int pos = oldT.annotations.nonEmpty() ? getOldPos(oldT.annotations.head) : bounds[0];
copyTo(localPointer, pos);
localPointer = diffParameterList(
oldT.annotations,
newT.annotations,
null,
null,
pos,
Measure.ARGUMENT,
true, //TODO: should read the code style configuration
false,
false,
""
);
}
int[] underlyingBounds = getBounds(oldT.underlyingType);
copyTo(localPointer, underlyingBounds[0]);
localPointer = diffTree(oldT.underlyingType, newT.underlyingType, underlyingBounds);
copyTo(localPointer, bounds[1]);
return bounds[1];
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:CasualDiff.java
示例2: visitNewClass
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
@Override
public Pair<ASTRecord, Integer> visitNewClass(NewClassTree node, Insertion ins) {
JCNewClass na = (JCNewClass) node;
JCExpression className = na.clazz;
// System.out.printf("classname %s (%s)%n", className, className.getClass());
while (! (className.getKind() == Tree.Kind.IDENTIFIER)) { // IdentifierTree
if (className instanceof JCAnnotatedType) {
className = ((JCAnnotatedType) className).underlyingType;
} else if (className instanceof JCTypeApply) {
className = ((JCTypeApply) className).clazz;
} else if (className instanceof JCFieldAccess) {
// This occurs for fully qualified names, e.g. "new java.lang.Object()".
// I'm not quite sure why the field "selected" is taken, but "name" would
// be a type mismatch. It seems to work, see NewPackage test case.
className = ((JCFieldAccess) className).selected;
} else {
throw new Error(String.format("unrecognized JCNewClass.clazz (%s): %s%n" +
" surrounding new class tree: %s%n", className.getClass(), className, node));
}
// System.out.printf("classname %s (%s)%n", className, className.getClass());
}
return visitIdentifier((IdentifierTree) className, ins);
}
开发者ID:typetools,项目名称:annotation-tools,代码行数:25,代码来源:TreeFinder.java
示例3: getSymbol
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
/**
* Gets the symbol for a tree. Returns null if this tree does not have a symbol because it is of
* the wrong type, if {@code tree} is null, or if the symbol cannot be found due to a compilation
* error.
*/
// TODO(eaftan): refactor other code that accesses symbols to use this method
public static Symbol getSymbol(Tree tree) {
if (tree instanceof JCFieldAccess) {
return ((JCFieldAccess) tree).sym;
}
if (tree instanceof JCIdent) {
return ((JCIdent) tree).sym;
}
if (tree instanceof JCMethodInvocation) {
return ASTHelpers.getSymbol((MethodInvocationTree) tree);
}
if (tree instanceof JCNewClass) {
return ASTHelpers.getSymbol((NewClassTree) tree);
}
if (tree instanceof MemberReferenceTree) {
return ((JCMemberReference) tree).sym;
}
if (tree instanceof JCAnnotatedType) {
return getSymbol(((JCAnnotatedType) tree).underlyingType);
}
return getDeclaredSymbol(tree);
}
开发者ID:google,项目名称:error-prone,代码行数:29,代码来源:ASTHelpers.java
示例4: inline
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
@Override
public JCAnnotatedType inline(Inliner inliner) throws CouldNotResolveImportException {
return inliner
.maker()
.AnnotatedType(
List.convert(JCAnnotation.class, inliner.inlineList(getAnnotations())),
getUnderlyingType().inline(inliner));
}
开发者ID:google,项目名称:error-prone,代码行数:9,代码来源:UAnnotatedType.java
示例5: matchAnnotatedType
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
private boolean matchAnnotatedType(JCAnnotatedType t1, JCAnnotatedType t2) {
return treesMatch(t1.underlyingType, t2.underlyingType) &&
listsMatch(t1.annotations, t2.annotations);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CasualDiff.java
示例6: isAnnotatedArray
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
private boolean isAnnotatedArray(JCTree tree) {
return tree.hasTag(ANNOTATED_TYPE) &&
((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:5,代码来源:TreePosTest.java
示例7: annotationsFromTree
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
public final static List<? extends AnnotationMirror> annotationsFromTree(AnnotatedTypeTree node) {
return annotationsFromTypeAnnotationTrees(((JCAnnotatedType)node).annotations);
}
开发者ID:reprogrammer,项目名称:checker-framework,代码行数:4,代码来源:InternalUtils.java
示例8: annotationsFromTree
import com.sun.tools.javac.tree.JCTree.JCAnnotatedType; //导入依赖的package包/类
public static final List<? extends AnnotationMirror> annotationsFromTree(
AnnotatedTypeTree node) {
return annotationsFromTypeAnnotationTrees(((JCAnnotatedType) node).annotations);
}
开发者ID:bazelbuild,项目名称:bazel,代码行数:5,代码来源:InternalUtils.java
注:本文中的com.sun.tools.javac.tree.JCTree.JCAnnotatedType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论