Program: 87369
Project: 87369
Buggy source:
private void getSuggestedWordsForNonBatchInput(final WordComposer wordComposer,final PrevWordsInfo prevWordsInfo,final ProximityInfo proximityInfo,final SettingsValuesForSuggestion settingsValuesForSuggestion,final int inputStyle,final boolean isCorrectionEnabled,final int sequenceNumber,final OnGetSuggestedWordsCallback callback){
  final String typedWord=wordComposer.getTypedWord();
  final int trailingSingleQuotesCount=StringUtils.getTrailingSingleQuotesCount(typedWord);
  final String consideredWord=trailingSingleQuotesCount > 0 ? typedWord.substring(0,typedWord.length() - trailingSingleQuotesCount) : typedWord;
  final SuggestionResults suggestionResults=mDictionaryFacilitator.getSuggestionResults(wordComposer,prevWordsInfo,proximityInfo,settingsValuesForSuggestion,SESSION_ID_TYPING);
  final ArrayList<SuggestedWordInfo> suggestionsContainer=getTransformedSuggestedWordInfoList(wordComposer,suggestionResults,trailingSingleQuotesCount);
  final boolean didRemoveTypedWord=SuggestedWordInfo.removeDups(wordComposer.getTypedWord(),suggestionsContainer);
  final String whitelistedWord=getWhitelistedWordOrNull(suggestionsContainer);
  final boolean resultsArePredictions=!wordComposer.isComposingWord();
  final boolean allowsToBeAutoCorrected=(null != whitelistedWord) || (consideredWord.length() > 1 && !didRemoveTypedWord);
  final boolean hasAutoCorrection;
  if (!isCorrectionEnabled || !allowsToBeAutoCorrected || resultsArePredictions|| suggestionResults.isEmpty()|| wordComposer.hasDigits()|| wordComposer.isMostlyCaps()|| wordComposer.isResumed()|| !mDictionaryFacilitator.hasInitializedMainDictionary()|| suggestionResults.first().isKindOf(SuggestedWordInfo.KIND_SHORTCUT)) {
    hasAutoCorrection=false;
  }
 else {
    hasAutoCorrection=AutoCorrectionUtils.suggestionExceedsAutoCorrectionThreshold(suggestionResults.first(),consideredWord,mAutoCorrectionThreshold);
  }
  if (!TextUtils.isEmpty(typedWord)) {
    suggestionsContainer.add(0,new SuggestedWordInfo(typedWord,SuggestedWordInfo.MAX_SCORE,SuggestedWordInfo.KIND_TYPED,Dictionary.DICTIONARY_USER_TYPED,SuggestedWordInfo.NOT_AN_INDEX,SuggestedWordInfo.NOT_A_CONFIDENCE));
  }
  final ArrayList<SuggestedWordInfo> suggestionsList;
  if (DBG && !suggestionsContainer.isEmpty()) {
    suggestionsList=getSuggestionsInfoListWithDebugInfo(typedWord,suggestionsContainer);
  }
 else {
    suggestionsList=suggestionsContainer;
  }
  callback.onGetSuggestedWords(new SuggestedWords(suggestionsList,suggestionResults.mRawSuggestions,!resultsArePredictions && !allowsToBeAutoCorrected,hasAutoCorrection,false,resultsArePredictions,inputStyle,sequenceNumber));
}

Fixed version (ground truth):
private void getSuggestedWordsForNonBatchInput(final WordComposer wordComposer,final PrevWordsInfo prevWordsInfo,final ProximityInfo proximityInfo,final SettingsValuesForSuggestion settingsValuesForSuggestion,final int inputStyleIfNotPrediction,final boolean isCorrectionEnabled,final int sequenceNumber,final OnGetSuggestedWordsCallback callback){
  final String typedWord=wordComposer.getTypedWord();
  final int trailingSingleQuotesCount=StringUtils.getTrailingSingleQuotesCount(typedWord);
  final String consideredWord=trailingSingleQuotesCount > 0 ? typedWord.substring(0,typedWord.length() - trailingSingleQuotesCount) : typedWord;
  final SuggestionResults suggestionResults=mDictionaryFacilitator.getSuggestionResults(wordComposer,prevWordsInfo,proximityInfo,settingsValuesForSuggestion,SESSION_ID_TYPING);
  final ArrayList<SuggestedWordInfo> suggestionsContainer=getTransformedSuggestedWordInfoList(wordComposer,suggestionResults,trailingSingleQuotesCount);
  final boolean didRemoveTypedWord=SuggestedWordInfo.removeDups(wordComposer.getTypedWord(),suggestionsContainer);
  final String whitelistedWord=getWhitelistedWordOrNull(suggestionsContainer);
  final boolean resultsArePredictions=!wordComposer.isComposingWord();
  final boolean allowsToBeAutoCorrected=(null != whitelistedWord) || (consideredWord.length() > 1 && !didRemoveTypedWord);
  final boolean hasAutoCorrection;
  if (!isCorrectionEnabled || !allowsToBeAutoCorrected || resultsArePredictions|| suggestionResults.isEmpty()|| wordComposer.hasDigits()|| wordComposer.isMostlyCaps()|| wordComposer.isResumed()|| !mDictionaryFacilitator.hasInitializedMainDictionary()|| suggestionResults.first().isKindOf(SuggestedWordInfo.KIND_SHORTCUT)) {
    hasAutoCorrection=false;
  }
 else {
    hasAutoCorrection=AutoCorrectionUtils.suggestionExceedsAutoCorrectionThreshold(suggestionResults.first(),consideredWord,mAutoCorrectionThreshold);
  }
  if (!TextUtils.isEmpty(typedWord)) {
    suggestionsContainer.add(0,new SuggestedWordInfo(typedWord,SuggestedWordInfo.MAX_SCORE,SuggestedWordInfo.KIND_TYPED,Dictionary.DICTIONARY_USER_TYPED,SuggestedWordInfo.NOT_AN_INDEX,SuggestedWordInfo.NOT_A_CONFIDENCE));
  }
  final ArrayList<SuggestedWordInfo> suggestionsList;
  if (DBG && !suggestionsContainer.isEmpty()) {
    suggestionsList=getSuggestionsInfoListWithDebugInfo(typedWord,suggestionsContainer);
  }
 else {
    suggestionsList=suggestionsContainer;
  }
  final int inputStyle=resultsArePredictions ? SuggestedWords.INPUT_STYLE_PREDICTION : inputStyleIfNotPrediction;
  callback.onGetSuggestedWords(new SuggestedWords(suggestionsList,suggestionResults.mRawSuggestions,!resultsArePredictions && !allowsToBeAutoCorrected,hasAutoCorrection,false,inputStyle,sequenceNumber));
}