Program: 87573
Project: 87573
Buggy source:
/** 
 * Check if the cursor is touching a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordTouchedByCursor(){
  if (mAppWorkAroundsUtils.isBrokenByRecorrection())   return;
  if (mLastSelectionStart != mLastSelectionEnd)   return;
  if (mLastSelectionStart < 0)   return;
  final SettingsValues currentSettings=mSettings.getCurrent();
  if (!mConnection.isCursorTouchingWord(currentSettings))   return;
  final TextRange range=mConnection.getWordRangeAtCursor(currentSettings.mWordSeparators,0);
  if (null == range)   return;
  final int numberOfCharsInWordBeforeCursor=range.getNumberOfCharsInWordBeforeCursor();
  if (numberOfCharsInWordBeforeCursor > mLastSelectionStart)   return;
  final ArrayList<SuggestedWordInfo> suggestions=CollectionUtils.newArrayList();
  final String typedWord=range.mWord.toString();
  int i=0;
  for (  final SuggestionSpan span : range.getSuggestionSpansAtWord()) {
    for (    final String s : span.getSuggestions()) {
      ++i;
      if (!TextUtils.equals(s,typedWord)) {
        suggestions.add(new SuggestedWordInfo(s,SuggestionStripView.MAX_SUGGESTIONS - i,SuggestedWordInfo.KIND_RESUMED,Dictionary.TYPE_RESUMED));
      }
    }
  }
  mWordComposer.setComposingWord(typedWord,mKeyboardSwitcher.getKeyboard());
  mWordComposer.setCursorPositionWithinWord(numberOfCharsInWordBeforeCursor);
  mConnection.setComposingRegion(mLastSelectionStart - numberOfCharsInWordBeforeCursor,mLastSelectionEnd + range.getNumberOfCharsInWordAfterCursor());
  final SuggestedWords suggestedWords;
  if (suggestions.isEmpty()) {
    final SuggestedWords suggestedWordsIncludingTypedWord=getSuggestedWords(Suggest.SESSION_TYPING);
    if (suggestedWordsIncludingTypedWord.size() > 1) {
      suggestedWords=suggestedWordsIncludingTypedWord.getSuggestedWordsExcludingTypedWord();
    }
 else {
      suggestedWords=suggestedWordsIncludingTypedWord;
    }
  }
 else {
    suggestedWords=new SuggestedWords(suggestions,true,false,false,false,false);
  }
  mIsAutoCorrectionIndicatorOn=false;
  showSuggestionStrip(suggestedWords,typedWord);
}

Fixed version (ground truth):
/** 
 * Check if the cursor is touching a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordTouchedByCursor(){
  if (mAppWorkAroundsUtils.isBrokenByRecorrection())   return;
  if (mLastSelectionStart != mLastSelectionEnd)   return;
  if (mLastSelectionStart < 0)   return;
  final SettingsValues currentSettings=mSettings.getCurrent();
  if (!mConnection.isCursorTouchingWord(currentSettings))   return;
  final TextRange range=mConnection.getWordRangeAtCursor(currentSettings.mWordSeparators,0);
  if (null == range)   return;
  final int numberOfCharsInWordBeforeCursor=range.getNumberOfCharsInWordBeforeCursor();
  if (numberOfCharsInWordBeforeCursor > mLastSelectionStart)   return;
  final ArrayList<SuggestedWordInfo> suggestions=CollectionUtils.newArrayList();
  final String typedWord=range.mWord.toString();
  int i=0;
  for (  final SuggestionSpan span : range.getSuggestionSpansAtWord()) {
    for (    final String s : span.getSuggestions()) {
      ++i;
      if (!TextUtils.equals(s,typedWord)) {
        suggestions.add(new SuggestedWordInfo(s,SuggestionStripView.MAX_SUGGESTIONS - i,SuggestedWordInfo.KIND_RESUMED,Dictionary.TYPE_RESUMED));
      }
    }
  }
  mWordComposer.setComposingWord(typedWord,mKeyboardSwitcher.getKeyboard());
  mWordComposer.setCursorPositionWithinWord(typedWord.codePointCount(0,numberOfCharsInWordBeforeCursor));
  mConnection.setComposingRegion(mLastSelectionStart - numberOfCharsInWordBeforeCursor,mLastSelectionEnd + range.getNumberOfCharsInWordAfterCursor());
  final SuggestedWords suggestedWords;
  if (suggestions.isEmpty()) {
    final SuggestedWords suggestedWordsIncludingTypedWord=getSuggestedWords(Suggest.SESSION_TYPING);
    if (suggestedWordsIncludingTypedWord.size() > 1) {
      suggestedWords=suggestedWordsIncludingTypedWord.getSuggestedWordsExcludingTypedWord();
    }
 else {
      suggestedWords=suggestedWordsIncludingTypedWord;
    }
  }
 else {
    suggestedWords=new SuggestedWords(suggestions,true,false,false,false,false);
  }
  mIsAutoCorrectionIndicatorOn=false;
  showSuggestionStrip(suggestedWords,typedWord);
}