Program: 34417
Project: 34417
Buggy source:
Pair<Map<String,List<Element>>,Map<String,List<Element>>> computeCandidates(Set<String> forcedUnresolved){
  final CompilationUnitTree cut=info.getCompilationUnit();
  Element el=info.getTrees().getElement(new TreePath(cut));
  ModuleElement modle=el != null ? info.getElements().getModuleOf(el) : null;
  final TreeVisitorImpl v=new TreeVisitorImpl(info);
  setVisitor(v);
  try {
    v.scan(cut,new HashMap<String,Object>());
  }
  finally {
    setVisitor(null);
  }
  Set<String> unresolvedNames=new HashSet<String>(v.unresolved);
  unresolvedNames.addAll(forcedUnresolved);
  unresolvedNames.addAll(JavadocImports.computeUnresolvedImports(info));
  for (  String unresolved : unresolvedNames) {
    if (isCancelled())     return null;
    List<Element> classes=new ArrayList<Element>();
    Set<ElementHandle<TypeElement>> typeNames=info.getClasspathInfo().getClassIndex().getDeclaredTypes(unresolved,NameKind.SIMPLE_NAME,EnumSet.allOf(ClassIndex.SearchScope.class));
    if (typeNames == null) {
      return null;
    }
    for (    ElementHandle<TypeElement> typeName : typeNames) {
      if (isCancelled())       return null;
      TypeElement te=modle != null ? info.getElements().getTypeElement(modle,typeName.getQualifiedName()) : info.getElements().getTypeElement(typeName.getQualifiedName());
      if (te == null) {
        Logger.getLogger(ComputeImports.class.getName()).log(Level.INFO,"String_Node_Str" + typeName + "String_Node_Str");
        continue;
      }
      if (info.getElements().getPackageOf(te).getQualifiedName().length() != 0 && !Utilities.isExcluded(te.getQualifiedName())) {
        classes.add(te);
      }
    }
    Iterable<Symbols> simpleNames=info.getClasspathInfo().getClassIndex().getDeclaredSymbols(unresolved,NameKind.SIMPLE_NAME,EnumSet.allOf(ClassIndex.SearchScope.class));
    if (simpleNames == null) {
      return null;
    }
    for (    final Symbols p : simpleNames) {
      if (isCancelled())       return null;
      final TypeElement te=p.getEnclosingType().resolve(info);
      final Set<String> idents=p.getSymbols();
      if (te != null) {
        for (        Element ne : te.getEnclosedElements()) {
          if (!ne.getModifiers().contains(Modifier.STATIC))           continue;
          if (idents.contains(getSimpleName(ne,te))) {
            classes.add(ne);
          }
        }
      }
    }
    candidates.put(unresolved,new ArrayList(classes));
    notFilteredCandidates.put(unresolved,classes);
  }
  boolean wasChanged=true;
  while (wasChanged) {
    if (isCancelled())     return new Pair(Collections.emptyMap(),Collections.emptyMap());
    wasChanged=false;
    possibleMethodFQNs.clear();
    fqn2Methods.clear();
    for (    Hint hint : v.hints) {
      wasChanged|=hint.filter(info,this);
    }
  }
  for (  String sn : possibleMethodFQNs.keySet()) {
    Set<String> fqns=possibleMethodFQNs.get(sn);
    List<Element> cands=candidates.get(sn);
    List<Element> rawCands=notFilteredCandidates.get(sn);
    if (cands != null) {
      for (Iterator<Element> itE=cands.iterator(); itE.hasNext(); ) {
        Element x=itE.next();
        if (x.getKind() != ElementKind.METHOD) {
          continue;
        }
        String fq=info.getElementUtilities().getElementName(x,true).toString();
        if (!fqns.contains(fq)) {
          itE.remove();
        }
      }
    }
    if (rawCands != null) {
      for (Iterator<Element> itE=rawCands.iterator(); itE.hasNext(); ) {
        Element x=itE.next();
        if (x.getKind() != ElementKind.METHOD) {
          continue;
        }
        String fq=info.getElementUtilities().getElementName(x,true).toString();
        if (!fqns.contains(fq)) {
          itE.remove();
        }
      }
    }
  }
  return new Pair<Map<String,List<Element>>,Map<String,List<Element>>>(candidates,notFilteredCandidates);
}

Fixed version (ground truth):
Pair<Map<String,List<Element>>,Map<String,List<Element>>> computeCandidates(Set<String> forcedUnresolved){
  final CompilationUnitTree cut=info.getCompilationUnit();
  ClasspathInfo cpInfo=allInfo.getClasspathInfo();
  final TreeVisitorImpl v=new TreeVisitorImpl(info);
  setVisitor(v);
  try {
    v.scan(cut,new HashMap<String,Object>());
  }
  finally {
    setVisitor(null);
  }
  Set<String> unresolvedNames=new HashSet<String>(v.unresolved);
  unresolvedNames.addAll(forcedUnresolved);
  unresolvedNames.addAll(JavadocImports.computeUnresolvedImports(info));
  for (  String unresolved : unresolvedNames) {
    if (isCancelled())     return null;
    List<Element> classes=new ArrayList<Element>();
    Set<ElementHandle<TypeElement>> typeNames=cpInfo.getClassIndex().getDeclaredTypes(unresolved,NameKind.SIMPLE_NAME,EnumSet.allOf(ClassIndex.SearchScope.class));
    if (typeNames == null) {
      return null;
    }
    for (    ElementHandle<TypeElement> typeName : typeNames) {
      if (isCancelled())       return null;
      TypeElement te=typeName.resolve(allInfo);
      if (te == null) {
        Logger.getLogger(ComputeImports.class.getName()).log(Level.INFO,"String_Node_Str" + typeName + "String_Node_Str");
        continue;
      }
      if (info.getElements().getPackageOf(te).getQualifiedName().length() != 0 && !Utilities.isExcluded(te.getQualifiedName())) {
        classes.add(te);
      }
    }
    Iterable<Symbols> simpleNames=cpInfo.getClassIndex().getDeclaredSymbols(unresolved,NameKind.SIMPLE_NAME,EnumSet.allOf(ClassIndex.SearchScope.class));
    if (simpleNames == null) {
      return null;
    }
    for (    final Symbols p : simpleNames) {
      if (isCancelled())       return null;
      final TypeElement te=p.getEnclosingType().resolve(allInfo);
      final Set<String> idents=p.getSymbols();
      if (te != null) {
        for (        Element ne : te.getEnclosedElements()) {
          if (!ne.getModifiers().contains(Modifier.STATIC))           continue;
          if (idents.contains(getSimpleName(ne,te))) {
            classes.add(ne);
          }
        }
      }
    }
    candidates.put(unresolved,new ArrayList(classes));
    notFilteredCandidates.put(unresolved,classes);
  }
  boolean wasChanged=true;
  while (wasChanged) {
    if (isCancelled())     return new Pair(Collections.emptyMap(),Collections.emptyMap());
    wasChanged=false;
    possibleMethodFQNs.clear();
    fqn2Methods.clear();
    for (    Hint hint : v.hints) {
      wasChanged|=hint.filter(allInfo,this);
    }
  }
  for (  String sn : possibleMethodFQNs.keySet()) {
    Set<String> fqns=possibleMethodFQNs.get(sn);
    List<Element> cands=candidates.get(sn);
    List<Element> rawCands=notFilteredCandidates.get(sn);
    if (cands != null) {
      for (Iterator<Element> itE=cands.iterator(); itE.hasNext(); ) {
        Element x=itE.next();
        if (x.getKind() != ElementKind.METHOD) {
          continue;
        }
        String fq=info.getElementUtilities().getElementName(x,true).toString();
        if (!fqns.contains(fq)) {
          itE.remove();
        }
      }
    }
    if (rawCands != null) {
      for (Iterator<Element> itE=rawCands.iterator(); itE.hasNext(); ) {
        Element x=itE.next();
        if (x.getKind() != ElementKind.METHOD) {
          continue;
        }
        String fq=info.getElementUtilities().getElementName(x,true).toString();
        if (!fqns.contains(fq)) {
          itE.remove();
        }
      }
    }
  }
  return new Pair<Map<String,List<Element>>,Map<String,List<Element>>>(candidates,notFilteredCandidates);
}