com.sun.tools.javac.tree.JCTree.JCAnnotatedType Java Examples

The following examples show how to use com.sun.tools.javac.tree.JCTree.JCAnnotatedType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TreeFinder.java    From annotation-tools with MIT License 6 votes vote down vote up
@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);
}
 
Example #2
Source File: TypeAnnotations.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void visitAnnotatedType(JCAnnotatedType tree) {
    push(tree);
    findPosition(tree, tree, tree.annotations);
    pop();
    super.visitAnnotatedType(tree);
}
 
Example #3
Source File: TransTypes.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public void visitAnnotatedType(JCAnnotatedType tree) {
    // For now, we need to keep the annotations in the tree because of the current
    // MultiCatch implementation wrt type annotations
    List<TypeCompound> mirrors = annotate.fromAnnotations(tree.annotations);
    tree.underlyingType = translate(tree.underlyingType);
    tree.type = tree.underlyingType.type.annotatedType(mirrors);
    result = tree;
}
 
Example #4
Source File: TreePosTest.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #5
Source File: TreePosTest.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #6
Source File: TreePosTest.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #7
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void visitAnnotatedType(JCAnnotatedType tree) {
    tree.underlyingType.accept(this);
}
 
Example #8
Source File: Flow.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public void visitAnnotatedType(JCAnnotatedType tree) {
    // annotations don't get scanned
    tree.underlyingType.accept(this);
}
 
Example #9
Source File: Annotate.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void visitAnnotatedType(JCAnnotatedType tree) {
    enterTypeAnnotations(tree.annotations, env, sym, deferPos, false);
    scan(tree.underlyingType);
}
 
Example #10
Source File: TreePosTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #11
Source File: TreePosTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #12
Source File: TreePosTest.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #13
Source File: TreePosTest.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}
 
Example #14
Source File: TreePosTest.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private boolean isAnnotatedArray(JCTree tree) {
    return tree.hasTag(ANNOTATED_TYPE) &&
                    ((JCAnnotatedType)tree).underlyingType.hasTag(TYPEARRAY);
}