Program: 19339
Project: 19339
Buggy source:
private void maybeRecordReferenceOrAlias(NodeTraversal t,Node n,Node parent,NameInformation nameInfo,@Nullable NameInformation referring){
  String referringName="String_Node_Str";
  if (referring != null) {
    referringName=referring.isPrototype ? referring.prototypeClass : referring.name;
  }
  String name=nameInfo.name;
  if (maybeHiddenAlias(n)) {
    recordAlias(name,WINDOW);
  }
  if (nameInfo.isExternallyReferenceable) {
    recordReference(WINDOW,name,RefType.REGULAR);
    maybeRecordAlias(name,parent,referring,referringName);
    return;
  }
  if (NodeUtil.isVarOrSimpleAssignLhs(n,parent)) {
    if (referring != null) {
      recordReference(referringName,name,RefType.REGULAR);
    }
    return;
  }
  if (nodesToKeep.contains(n)) {
    List<NameInformation> functionScopes=getEnclosingFunctionDependencyScope(t);
    if (!functionScopes.isEmpty()) {
      for (      NameInformation functionScope : functionScopes) {
        recordReference(functionScope.name,name,RefType.REGULAR);
      }
    }
 else {
      recordReference(WINDOW,name,RefType.REGULAR);
      if (referring != null) {
        maybeRecordAlias(name,parent,referring,referringName);
      }
    }
  }
 else   if (referring != null) {
    if (!maybeRecordAlias(name,parent,referring,referringName)) {
      RefType depType=referring.onlyAffectsClassDef ? RefType.INHERITANCE : RefType.REGULAR;
      recordReference(referringName,name,depType);
    }
  }
 else {
    for (    Node ancestor : n.getAncestors()) {
      if (NodeUtil.isAssignmentOp(ancestor) || ancestor.isFunction()) {
        recordReference(WINDOW,name,RefType.REGULAR);
        break;
      }
    }
  }
}

Fixed version (ground truth):
private void maybeRecordReferenceOrAlias(NodeTraversal t,Node n,Node parent,NameInformation nameInfo,@Nullable NameInformation referring){
  String referringName="String_Node_Str";
  if (referring != null) {
    referringName=referring.isPrototype ? referring.prototypeClass : referring.name;
  }
  String name=nameInfo.name;
  if (maybeHiddenAlias(n)) {
    recordAlias(name,WINDOW);
  }
  if (nameInfo.isExternallyReferenceable) {
    recordReference(WINDOW,name,RefType.REGULAR);
    maybeRecordAlias(name,n,referring,referringName);
    return;
  }
  if (NodeUtil.isVarOrSimpleAssignLhs(n,parent)) {
    if (referring != null) {
      recordReference(referringName,name,RefType.REGULAR);
    }
    return;
  }
  if (nodesToKeep.contains(n)) {
    List<NameInformation> functionScopes=getEnclosingFunctionDependencyScope(t);
    if (!functionScopes.isEmpty()) {
      for (      NameInformation functionScope : functionScopes) {
        recordReference(functionScope.name,name,RefType.REGULAR);
      }
    }
 else {
      recordReference(WINDOW,name,RefType.REGULAR);
      if (referring != null) {
        maybeRecordAlias(name,n,referring,referringName);
      }
    }
  }
 else   if (referring != null) {
    if (!maybeRecordAlias(name,n,referring,referringName)) {
      RefType depType=referring.onlyAffectsClassDef ? RefType.INHERITANCE : RefType.REGULAR;
      recordReference(referringName,name,depType);
    }
  }
 else {
    for (    Node ancestor : n.getAncestors()) {
      if (NodeUtil.isAssignmentOp(ancestor) || ancestor.isFunction()) {
        recordReference(WINDOW,name,RefType.REGULAR);
        break;
      }
    }
  }
}