Program: 87563
Project: 87563
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 (!isSuggestionsStripVisible())   return;
  if (!mSettings.getCurrent().mCurrentLanguageHasSpaces)   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();
  if (!isResumableWord(typedWord,currentSettings))   return;
  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.DICTIONARY_RESUMED,SuggestedWordInfo.NOT_AN_INDEX,SuggestedWordInfo.NOT_A_CONFIDENCE));
      }
    }
  }
  mWordComposer.setComposingWord(typedWord,mKeyboardSwitcher.getKeyboard());
  mWordComposer.setCursorPositionWithinWord(typedWord.codePointCount(0,numberOfCharsInWordBeforeCursor));
  mConnection.setComposingRegion(mLastSelectionStart - numberOfCharsInWordBeforeCursor,mLastSelectionEnd + range.getNumberOfCharsInWordAfterCursor());
  if (suggestions.isEmpty()) {
    mInputUpdater.getSuggestedWords(Suggest.SESSION_TYPING,new OnGetSuggestedWordsCallback(){
      @Override public void onGetSuggestedWords(      final SuggestedWords suggestedWordsIncludingTypedWord){
        final SuggestedWords suggestedWords;
        if (suggestedWordsIncludingTypedWord.size() > 1) {
          suggestedWords=suggestedWordsIncludingTypedWord.getSuggestedWordsExcludingTypedWord();
        }
 else {
          suggestedWords=suggestedWordsIncludingTypedWord;
        }
        unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(suggestedWords,typedWord);
      }
    }
);
  }
 else {
    final SuggestedWords suggestedWords=new SuggestedWords(suggestions,true,false,false,false,false);
    unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(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 (!isSuggestionsStripVisible())   return;
  if (!mSettings.getCurrent().mCurrentLanguageHasSpaces)   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;
  if (range.length() <= 0)   return;
  final int numberOfCharsInWordBeforeCursor=range.getNumberOfCharsInWordBeforeCursor();
  if (numberOfCharsInWordBeforeCursor > mLastSelectionStart)   return;
  final ArrayList<SuggestedWordInfo> suggestions=CollectionUtils.newArrayList();
  final String typedWord=range.mWord.toString();
  if (!isResumableWord(typedWord,currentSettings))   return;
  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.DICTIONARY_RESUMED,SuggestedWordInfo.NOT_AN_INDEX,SuggestedWordInfo.NOT_A_CONFIDENCE));
      }
    }
  }
  mWordComposer.setComposingWord(typedWord,mKeyboardSwitcher.getKeyboard());
  mWordComposer.setCursorPositionWithinWord(typedWord.codePointCount(0,numberOfCharsInWordBeforeCursor));
  mConnection.setComposingRegion(mLastSelectionStart - numberOfCharsInWordBeforeCursor,mLastSelectionEnd + range.getNumberOfCharsInWordAfterCursor());
  if (suggestions.isEmpty()) {
    mInputUpdater.getSuggestedWords(Suggest.SESSION_TYPING,new OnGetSuggestedWordsCallback(){
      @Override public void onGetSuggestedWords(      final SuggestedWords suggestedWordsIncludingTypedWord){
        final SuggestedWords suggestedWords;
        if (suggestedWordsIncludingTypedWord.size() > 1) {
          suggestedWords=suggestedWordsIncludingTypedWord.getSuggestedWordsExcludingTypedWord();
        }
 else {
          suggestedWords=suggestedWordsIncludingTypedWord;
        }
        unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(suggestedWords,typedWord);
      }
    }
);
  }
 else {
    final SuggestedWords suggestedWords=new SuggestedWords(suggestions,true,false,false,false,false);
    unsetIsAutoCorrectionIndicatorOnAndCallShowSuggestionStrip(suggestedWords,typedWord);
  }
}