コード例 #1
0
  private static List<? extends TypeMirror> computeImport(
      Set<ElementKind> types, CompilationInfo info, TreePath parent, Tree error, int offset) {
    ImportTree tree = (ImportTree) parent.getLeaf();

    if (tree.getQualifiedIdentifier() == error) {
      types.add(ElementKind.ANNOTATION_TYPE);
      types.add(ElementKind.CLASS);
      types.add(ElementKind.ENUM);
      types.add(ElementKind.INTERFACE);

      return Collections.singletonList(
          info.getElements().getTypeElement("java.lang.Object").asType());
    }

    return null;
  }
コード例 #2
0
  @Override
  public Set<String> visitImport(ImportTree node, AbstractMap.Entry<ProjectImpl, PackageImpl> p) {

    ProjectImpl projectImpl = p.getKey();
    PackageImpl packageImpl = p.getValue();

    if (node != null) {
      String importIndentifier = node.getQualifiedIdentifier().toString();

      // check if this import identifier belongs to any of the packages
      String pkgStr =
          MethodUtil.belongsToPackages(importIndentifier, projectImpl.getPackagesMap().keySet());
      if (pkgStr != null) {
        PackageImpl pi = projectImpl.getPackagesMap().get(pkgStr); // retrieval of the package

        // adding input and output dependencies
        packageImpl.getOutputDependencies().add(pi);
        pi.getInputDependencies().add(packageImpl);

        HashSet<String> set = new HashSet<String>();
        set.add(importIndentifier);
        return set;
      }
    }
    return null;
  }
コード例 #3
0
  @Override
  public String visitImport(ImportTree node, String p) {
    String id = super.visitImport(node, p);

    if (id != null) {
      return id;
    }

    String i = node.getQualifiedIdentifier().toString();
    if (i.contains(p)) {
      return i;
    }

    return null;
  }