Java 类com.sun.source.tree.PackageTree 实例源码

项目:error-prone    文件:AnnotationMatcher.java   
@Override
protected Iterable<? extends AnnotationTree> getChildNodes(T tree, VisitorState state) {
  if (tree instanceof ClassTree) {
    return ((ClassTree) tree).getModifiers().getAnnotations();
  } else if (tree instanceof VariableTree) {
    return ((VariableTree) tree).getModifiers().getAnnotations();
  } else if (tree instanceof MethodTree) {
    return ((MethodTree) tree).getModifiers().getAnnotations();
  } else if (tree instanceof CompilationUnitTree) {
    return ((CompilationUnitTree) tree).getPackageAnnotations();
  } else if (tree instanceof PackageTree) {
    return ((PackageTree) tree).getAnnotations();
  } else {
    throw new IllegalArgumentException(
        "Cannot access annotations from tree of type " + tree.getClass());
  }
}
项目:error-prone    文件:ASTHelpers.java   
/**
 * Gets the symbol declared by a tree. Returns null if {@code tree} does not declare a symbol or
 * is null.
 */
public static Symbol getDeclaredSymbol(Tree tree) {
  if (tree instanceof AnnotationTree) {
    return getSymbol(((AnnotationTree) tree).getAnnotationType());
  }
  if (tree instanceof PackageTree) {
    return getSymbol((PackageTree) tree);
  }
  if (tree instanceof ParameterizedTypeTree) {
    return getSymbol(((ParameterizedTypeTree) tree).getType());
  }
  if (tree instanceof TypeParameterTree) {
    Type type = ((JCTypeParameter) tree).type;
    return type == null ? null : type.tsym;
  }
  if (tree instanceof ClassTree) {
    return getSymbol((ClassTree) tree);
  }
  if (tree instanceof MethodTree) {
    return getSymbol((MethodTree) tree);
  }
  if (tree instanceof VariableTree) {
    return getSymbol((VariableTree) tree);
  }
  return null;
}
项目:incubator-netbeans    文件:TreeDuplicator.java   
@Override
public Tree visitPackage(PackageTree tree, Void p) {
    PackageTree n = make.Package(tree.getAnnotations(), tree.getPackageName());
    model.setElement(n, model.getElement(tree));
    comments.copyComments(tree, n);
    model.setPos(n, model.getPos(tree));
    return n;
}
项目:incubator-netbeans    文件:TreeNode.java   
@Override
public Void visitPackage(PackageTree tree, List<Node> d) {
    List<Node> below = new ArrayList<Node>();

    addCorrespondingType(below);
    addCorrespondingComments(below);
    super.visitPackage(tree, below);

    d.add(new TreeNode(info, getCurrentPath(), below));
    return null;
}
项目:incubator-netbeans    文件:ExpectedTypeResolver.java   
@Override
public List<? extends TypeMirror> visitPackage(PackageTree pt, Object p) {
    return null;
}
项目:openjdk-jdk10    文件:DocLint.java   
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitPackage(PackageTree tree, Void ignore) {
    visitDecl(tree, null);
    return super.visitPackage(tree, ignore);
}
项目:openjdk-jdk10    文件:TreeDependencyScanner.java   
@Override
public Void visitPackage(PackageTree node, Set<String> p) {
    return null;
}
项目:openjdk9    文件:DocLint.java   
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitPackage(PackageTree tree, Void ignore) {
    visitDecl(tree, null);
    return super.visitPackage(tree, ignore);
}
项目:openjdk9    文件:TreeDependencyScanner.java   
@Override @DefinedBy(Api.COMPILER_TREE)
public Void visitPackage(PackageTree node, Set<String> p) {
    return null;
}
项目:oblivion-netbeans-plugin    文件:ApexTreeVisitorAdapter.java   
@Override
public R visitPackage(PackageTree pt, P p) {
    return null;
}
项目:oblivion-netbeans-plugin    文件:TreeFinder.java   
@Override
public List<T> visitPackage(PackageTree pt, T p) {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:oblivion-netbeans-plugin    文件:TriggerCompilationUnitTreeImpl.java   
@Override
public PackageTree getPackage() {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:oblivion-netbeans-plugin    文件:CompilationUnitTreeImpl.java   
@Override
public PackageTree getPackage() {
    throw new UnsupportedOperationException("Not supported yet.");
}
项目:error-prone    文件:ASTHelpers.java   
/** Gets the symbol for a package. */
public static PackageSymbol getSymbol(PackageTree tree) {
  return ((JCPackageDecl) tree).packge;
}