Java 类com.sun.tools.javac.tree.JCTree.JCAnnotatedType 实例源码

项目:incubator-netbeans    文件:CasualDiff.java   
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];
}
项目:annotation-tools    文件:TreeFinder.java   
@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);
}
项目:error-prone    文件:ASTHelpers.java   
/**
 * 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);
}
项目:error-prone    文件:UAnnotatedType.java   
@Override
public JCAnnotatedType inline(Inliner inliner) throws CouldNotResolveImportException {
  return inliner
      .maker()
      .AnnotatedType(
          List.convert(JCAnnotation.class, inliner.inlineList(getAnnotations())),
          getUnderlyingType().inline(inliner));
}
项目:incubator-netbeans    文件:CasualDiff.java   
private boolean matchAnnotatedType(JCAnnotatedType t1, JCAnnotatedType t2) {
    return treesMatch(t1.underlyingType, t2.underlyingType) &&
           listsMatch(t1.annotations, t2.annotations);
}
项目:openjdk-jdk10    文件:TreePosTest.java   
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
项目:openjdk9    文件:TreePosTest.java   
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
项目:lookaside_java-1.8.0-openjdk    文件:TreePosTest.java   
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
项目:jsr308-langtools    文件:TreePosTest.java   
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
项目:infobip-open-jdk-8    文件:TreePosTest.java   
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
项目:OLD-OpenJDK8    文件:TreePosTest.java   
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
项目:checker-framework    文件:InternalUtils.java   
public final static List<? extends AnnotationMirror> annotationsFromTree(AnnotatedTypeTree node) {
    return annotationsFromTypeAnnotationTrees(((JCAnnotatedType)node).annotations);
}
项目:bazel    文件:InternalUtils.java   
public static final List<? extends AnnotationMirror> annotationsFromTree(
        AnnotatedTypeTree node) {
    return annotationsFromTypeAnnotationTrees(((JCAnnotatedType) node).annotations);
}