Program: 185602
Project: 185602
Buggy source:
/** 
 * This method is called after all types have been accepted by this requestor.  Converts each type into an   {@link ICompletionProposal}
 * @return list of all {@link ICompletionProposal}s applicable for this content assist request.
 */
List<ICompletionProposal> processAcceptedTypes(JDTResolver resolver){
  this.checkCancel();
  if (this.acceptedTypes == null)   return Collections.EMPTY_LIST;
  int length=this.acceptedTypes.size();
  if (length == 0)   return Collections.EMPTY_LIST;
  HashtableOfObject onDemandFound=new HashtableOfObject();
  String thisPackageName=module.getPackageName() == null ? "String_Node_Str" : module.getPackageName();
  List<ICompletionProposal> proposals=new LinkedList<ICompletionProposal>();
  try {
    next:     for (int i=0; i < length; i+=1) {
      if ((i % CHECK_CANCEL_FREQUENCY) == 0) {
        checkCancel();
      }
      AcceptedType acceptedType=(AcceptedType)this.acceptedTypes.elementAt(i);
      char[] packageName=acceptedType.packageName;
      char[] simpleTypeName=acceptedType.simpleTypeName;
      char[][] enclosingTypeNames=acceptedType.enclosingTypeNames;
      int modifiers=acceptedType.modifiers;
      int accessibility=acceptedType.accessibility;
      char[] typeName;
      char[] flatEnclosingTypeNames;
      if (enclosingTypeNames == null || enclosingTypeNames.length == 0) {
        flatEnclosingTypeNames=null;
        typeName=simpleTypeName;
      }
 else {
        flatEnclosingTypeNames=CharOperation.concatWith(acceptedType.enclosingTypeNames,'.');
        typeName=CharOperation.concat(flatEnclosingTypeNames,simpleTypeName,'.');
      }
      char[] fullyQualifiedName=CharOperation.concat(packageName,typeName,'.');
      if (imports == null && resolver.getScope() != null) {
        initializeImportArrays(resolver.getScope());
      }
      for (int j=0; j < imports.length; j++) {
        char[][] importName=imports[j];
        if (CharOperation.equals(typeName,importName[0])) {
          proposals.add(proposeType(packageName,simpleTypeName,modifiers,accessibility,typeName,fullyQualifiedName,!CharOperation.equals(fullyQualifiedName,importName[1])));
          continue next;
        }
      }
      if ((enclosingTypeNames == null || enclosingTypeNames.length == 0) && CharOperation.equals(thisPackageName.toCharArray(),packageName)) {
        proposals.add(proposeType(packageName,simpleTypeName,modifiers,accessibility,typeName,fullyQualifiedName,false));
        continue next;
      }
 else {
        char[] fullyQualifiedEnclosingTypeOrPackageName=null;
        if (((AcceptedType)onDemandFound.get(simpleTypeName)) == null) {
          for (int j=0; j < this.onDemandimports.length; j++) {
            char[] importFlatName=onDemandimports[j];
            if (fullyQualifiedEnclosingTypeOrPackageName == null) {
              if (enclosingTypeNames != null && enclosingTypeNames.length != 0) {
                fullyQualifiedEnclosingTypeOrPackageName=CharOperation.concat(packageName,flatEnclosingTypeNames,'.');
              }
 else {
                fullyQualifiedEnclosingTypeOrPackageName=packageName;
              }
            }
            if (CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName,importFlatName)) {
              acceptedType.qualifiedTypeName=typeName;
              acceptedType.fullyQualifiedName=fullyQualifiedName;
              onDemandFound.put(simpleTypeName,acceptedType);
              continue next;
            }
          }
          proposals.add(proposeType(fullyQualifiedEnclosingTypeOrPackageName != null ? fullyQualifiedEnclosingTypeOrPackageName : packageName,simpleTypeName,modifiers,accessibility,typeName,fullyQualifiedName,true));
        }
      }
    }
    char[][] keys=onDemandFound.keyTable;
    Object[] values=onDemandFound.valueTable;
    int max=keys.length;
    for (int i=0; i < max; i++) {
      if ((i % CHECK_CANCEL_FREQUENCY) == 0)       checkCancel();
      if (keys[i] != null) {
        AcceptedType value=(AcceptedType)values[i];
        if (value != null) {
          proposals.add(proposeType(value.packageName,value.simpleTypeName,value.modifiers,value.accessibility,value.qualifiedTypeName,value.fullyQualifiedName,value.mustBeQualified));
        }
      }
    }
  }
  finally {
    this.acceptedTypes=null;
  }
  return proposals;
}

Fixed version (ground truth):
/** 
 * Called after all types have been accepted by this requestor.  Converts each type into an   {@link ICompletionProposal}.
 * @return list of all {@link ICompletionProposal}s applicable for this content assist request
 */
List<ICompletionProposal> processAcceptedTypes(JDTResolver resolver){
  checkCancel();
  int n;
  if (acceptedTypes == null || (n=acceptedTypes.size()) == 0) {
    return Collections.EMPTY_LIST;
  }
  HashtableOfObject onDemandFound=new HashtableOfObject();
  String thisPackageName=module.getPackageName();
  if (thisPackageName == null)   thisPackageName="String_Node_Str";
  List<ICompletionProposal> proposals=new LinkedList<ICompletionProposal>();
  try {
    next:     for (int i=0; i < n; i+=1) {
      if ((i % CHECK_CANCEL_FREQUENCY) == 0) {
        checkCancel();
      }
      AcceptedType acceptedType=(AcceptedType)acceptedTypes.elementAt(i);
      char[] packageName=acceptedType.packageName;
      char[] simpleTypeName=acceptedType.simpleTypeName;
      char[][] enclosingTypeNames=acceptedType.enclosingTypeNames;
      int modifiers=acceptedType.modifiers;
      int accessibility=acceptedType.accessibility;
      char[] typeName;
      char[] flatEnclosingTypeNames;
      if (enclosingTypeNames == null || enclosingTypeNames.length == 0) {
        flatEnclosingTypeNames=null;
        typeName=simpleTypeName;
      }
 else {
        flatEnclosingTypeNames=CharOperation.concatWith(acceptedType.enclosingTypeNames,'.');
        typeName=CharOperation.concat(flatEnclosingTypeNames,simpleTypeName,'.');
      }
      char[] fullyQualifiedName=CharOperation.concat(packageName,typeName,'.');
      if (imports == null && resolver.getScope() != null) {
        initializeImportArrays(resolver.getScope());
      }
      if (imports != null) {
        for (        char[][] importName : imports) {
          if (CharOperation.equals(typeName,importName[0])) {
            proposals.add(proposeType(packageName,simpleTypeName,modifiers,accessibility,typeName,fullyQualifiedName,!CharOperation.equals(fullyQualifiedName,importName[1])));
            continue next;
          }
        }
      }
      if ((enclosingTypeNames == null || enclosingTypeNames.length == 0) && CharOperation.equals(thisPackageName.toCharArray(),packageName)) {
        proposals.add(proposeType(packageName,simpleTypeName,modifiers,accessibility,typeName,fullyQualifiedName,false));
        continue next;
      }
 else       if (((AcceptedType)onDemandFound.get(simpleTypeName)) == null && onDemandimports != null) {
        char[] fullyQualifiedEnclosingTypeOrPackageName=null;
        for (        char[] importFlatName : onDemandimports) {
          if (fullyQualifiedEnclosingTypeOrPackageName == null) {
            if (enclosingTypeNames != null && enclosingTypeNames.length != 0) {
              fullyQualifiedEnclosingTypeOrPackageName=CharOperation.concat(packageName,flatEnclosingTypeNames,'.');
            }
 else {
              fullyQualifiedEnclosingTypeOrPackageName=packageName;
            }
          }
          if (CharOperation.equals(fullyQualifiedEnclosingTypeOrPackageName,importFlatName)) {
            acceptedType.qualifiedTypeName=typeName;
            acceptedType.fullyQualifiedName=fullyQualifiedName;
            onDemandFound.put(simpleTypeName,acceptedType);
            continue next;
          }
        }
        char[] packName=fullyQualifiedEnclosingTypeOrPackageName != null ? fullyQualifiedEnclosingTypeOrPackageName : packageName;
        proposals.add(proposeType(packName,simpleTypeName,modifiers,accessibility,typeName,fullyQualifiedName,true));
      }
    }
    char[][] keys=onDemandFound.keyTable;
    Object[] vals=onDemandFound.valueTable;
    for (int i=0; i < keys.length; i+=1) {
      if ((i % CHECK_CANCEL_FREQUENCY) == 0)       checkCancel();
      if (keys[i] != null) {
        AcceptedType value=(AcceptedType)vals[i];
        if (value != null) {
          proposals.add(proposeType(value.packageName,value.simpleTypeName,value.modifiers,value.accessibility,value.qualifiedTypeName,value.fullyQualifiedName,value.mustBeQualified));
        }
      }
    }
  }
  finally {
    this.acceptedTypes=null;
  }
  return proposals;
}