nus-yam/ex-repair huggingface dataset:
Program: 88044
Project: 88044
Buggy source:
/** 
 * Check if the cursor is actually at the end of a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(final InputConnection ic){
  final CharSequence textBeforeCursor=ic.getTextBeforeCursor(1,0);
  if (TextUtils.isEmpty(textBeforeCursor) || mSettingsValues.isWordSeparator(textBeforeCursor.charAt(0)))   return;
  final CharSequence textAfterCursor=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(textAfterCursor) && !mSettingsValues.isWordSeparator(textAfterCursor.charAt(0)))   return;
  final CharSequence word=EditingUtils.getWordAtCursor(ic,mSettingsValues.mWordSeparators);
  if (TextUtils.isEmpty(word))   return;
  if (word.length() == 1 && !Character.isLetter(word.charAt(0)))   return;
  restartSuggestionsOnWordBeforeCursor(ic,word);
}

Fixed version (ground truth):
/** 
 * Check if the cursor is actually at the end of a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(final InputConnection ic){
  final CharSequence textBeforeCursor=ic.getTextBeforeCursor(1,0);
  if (TextUtils.isEmpty(textBeforeCursor) || mSettingsValues.isWordSeparator(textBeforeCursor.charAt(0)))   return;
  final CharSequence textAfterCursor=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(textAfterCursor) && !mSettingsValues.isWordSeparator(textAfterCursor.charAt(0)))   return;
  CharSequence word=EditingUtils.getWordAtCursor(ic,mSettingsValues.mWordSeparators);
  while (!TextUtils.isEmpty(word) && Keyboard.CODE_SINGLE_QUOTE == word.charAt(0)) {
    word=word.subSequence(1,word.length());
  }
  if (TextUtils.isEmpty(word))   return;
  final char firstChar=word.charAt(0);
  if (word.length() == 1 && !Character.isLetter(firstChar))   return;
  if (!(isAlphabet(firstChar) || mSettingsValues.isSymbolExcludedFromWordSeparators(firstChar))) {
    return;
  }
  restartSuggestionsOnWordBeforeCursor(ic,word);
}
Program: 88045
Project: 88045
Buggy source:
/** 
 * Check if the cursor is actually at the end of a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(final InputConnection ic){
  final CharSequence textBeforeCursor=ic.getTextBeforeCursor(1,0);
  if (TextUtils.isEmpty(textBeforeCursor) || mSettingsValues.isWordSeparator(textBeforeCursor.charAt(0)))   return;
  final CharSequence textAfterCursor=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(textAfterCursor) && !mSettingsValues.isWordSeparator(textAfterCursor.charAt(0)))   return;
  final CharSequence word=EditingUtils.getWordAtCursor(ic,mSettingsValues.mWordSeparators);
  if (TextUtils.isEmpty(word))   return;
  if (word.length() == 1 && !Character.isLetter(word.charAt(0)))   return;
  restartSuggestionsOnWordBeforeCursor(ic,word);
}

Fixed version (ground truth):
/** 
 * Check if the cursor is actually at the end of a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(final InputConnection ic){
  final CharSequence textBeforeCursor=ic.getTextBeforeCursor(1,0);
  if (TextUtils.isEmpty(textBeforeCursor) || mSettingsValues.isWordSeparator(textBeforeCursor.charAt(0)))   return;
  final CharSequence textAfterCursor=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(textAfterCursor) && !mSettingsValues.isWordSeparator(textAfterCursor.charAt(0)))   return;
  CharSequence word=EditingUtils.getWordAtCursor(ic,mSettingsValues.mWordSeparators);
  while (!TextUtils.isEmpty(word) && Keyboard.CODE_SINGLE_QUOTE == word.charAt(0)) {
    word=word.subSequence(1,word.length());
  }
  if (TextUtils.isEmpty(word))   return;
  final char firstChar=word.charAt(0);
  if (word.length() == 1 && !Character.isLetter(firstChar))   return;
  if (!(isAlphabet(firstChar) || mSettingsValues.isSymbolExcludedFromWordSeparators(firstChar))) {
    return;
  }
  restartSuggestionsOnWordBeforeCursor(ic,word);
}
Program: 88046
Project: 88046
Buggy source:
/** 
 * Check if the cursor is actually at the end of a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(final InputConnection ic){
  final CharSequence textBeforeCursor=ic.getTextBeforeCursor(1,0);
  if (TextUtils.isEmpty(textBeforeCursor) || mSettingsValues.isWordSeparator(textBeforeCursor.charAt(0)))   return;
  final CharSequence textAfterCursor=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(textAfterCursor) && !mSettingsValues.isWordSeparator(textAfterCursor.charAt(0)))   return;
  final CharSequence word=EditingUtils.getWordAtCursor(ic,mSettingsValues.mWordSeparators);
  if (TextUtils.isEmpty(word))   return;
  if (word.length() == 1 && !Character.isLetter(word.charAt(0)))   return;
  restartSuggestionsOnWordBeforeCursor(ic,word);
}

Fixed version (ground truth):
/** 
 * Check if the cursor is actually at the end of a word. If so, restart suggestions on this word, else do nothing.
 */
private void restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(final InputConnection ic){
  final CharSequence textBeforeCursor=ic.getTextBeforeCursor(1,0);
  if (TextUtils.isEmpty(textBeforeCursor) || mSettingsValues.isWordSeparator(textBeforeCursor.charAt(0)))   return;
  final CharSequence textAfterCursor=ic.getTextAfterCursor(1,0);
  if (!TextUtils.isEmpty(textAfterCursor) && !mSettingsValues.isWordSeparator(textAfterCursor.charAt(0)))   return;
  CharSequence word=EditingUtils.getWordAtCursor(ic,mSettingsValues.mWordSeparators);
  while (!TextUtils.isEmpty(word) && Keyboard.CODE_SINGLE_QUOTE == word.charAt(0)) {
    word=word.subSequence(1,word.length());
  }
  if (TextUtils.isEmpty(word))   return;
  final char firstChar=word.charAt(0);
  if (word.length() == 1 && !Character.isLetter(firstChar))   return;
  if (!(isAlphabet(firstChar) || mSettingsValues.isSymbolExcludedFromWordSeparators(firstChar))) {
    return;
  }
  restartSuggestionsOnWordBeforeCursor(ic,word);
}
Program: 88047
Project: 88047
Buggy source:
public static boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes){
  final InputMethodManagerCompatWrapper imm=InputMethodManagerCompatWrapper.getInstance();
  if (imm == null)   return false;
  final List<InputMethodInfoCompatWrapper> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfoCompatWrapper imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtypeCompatWrapper subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  return filteredImisCount > 1 || imm.getEnabledInputMethodSubtypeList(null,false).size() > 1;
}

Fixed version (ground truth):
public static boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes){
  final InputMethodManagerCompatWrapper imm=InputMethodManagerCompatWrapper.getInstance();
  if (imm == null)   return false;
  final List<InputMethodInfoCompatWrapper> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfoCompatWrapper imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtypeCompatWrapper subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  if (filteredImisCount > 1) {
    return true;
  }
  final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(null,true);
  int keyboardCount=0;
  for (  InputMethodSubtypeCompatWrapper subtype : subtypes) {
    if (SubtypeSwitcher.KEYBOARD_MODE.equals(subtype.getMode())) {
      ++keyboardCount;
    }
  }
  return keyboardCount > 1;
}
Program: 88048
Project: 88048
Buggy source:
public static boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes){
  final InputMethodManagerCompatWrapper imm=InputMethodManagerCompatWrapper.getInstance();
  if (imm == null)   return false;
  final List<InputMethodInfoCompatWrapper> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfoCompatWrapper imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtypeCompatWrapper subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  return filteredImisCount > 1 || imm.getEnabledInputMethodSubtypeList(null,false).size() > 1;
}

Fixed version (ground truth):
public static boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes){
  final InputMethodManagerCompatWrapper imm=InputMethodManagerCompatWrapper.getInstance();
  if (imm == null)   return false;
  final List<InputMethodInfoCompatWrapper> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfoCompatWrapper imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtypeCompatWrapper subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  if (filteredImisCount > 1) {
    return true;
  }
  final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(null,true);
  int keyboardCount=0;
  for (  InputMethodSubtypeCompatWrapper subtype : subtypes) {
    if (SubtypeSwitcher.KEYBOARD_MODE.equals(subtype.getMode())) {
      ++keyboardCount;
    }
  }
  return keyboardCount > 1;
}
Program: 88051
Project: 88051
Buggy source:
public static boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes){
  final InputMethodManagerCompatWrapper imm=InputMethodManagerCompatWrapper.getInstance();
  if (imm == null)   return false;
  final List<InputMethodInfoCompatWrapper> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfoCompatWrapper imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtypeCompatWrapper subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  return filteredImisCount > 1 || imm.getEnabledInputMethodSubtypeList(null,false).size() > 1;
}

Fixed version (ground truth):
public static boolean hasMultipleEnabledIMEsOrSubtypes(final boolean shouldIncludeAuxiliarySubtypes){
  final InputMethodManagerCompatWrapper imm=InputMethodManagerCompatWrapper.getInstance();
  if (imm == null)   return false;
  final List<InputMethodInfoCompatWrapper> enabledImis=imm.getEnabledInputMethodList();
  int filteredImisCount=0;
  for (  InputMethodInfoCompatWrapper imi : enabledImis) {
    if (filteredImisCount > 1)     return true;
    final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(imi,true);
    if (subtypes.isEmpty()) {
      ++filteredImisCount;
      continue;
    }
    int auxCount=0;
    for (    InputMethodSubtypeCompatWrapper subtype : subtypes) {
      if (subtype.isAuxiliary()) {
        ++auxCount;
      }
    }
    final int nonAuxCount=subtypes.size() - auxCount;
    if (nonAuxCount > 0 || (shouldIncludeAuxiliarySubtypes && auxCount > 1)) {
      ++filteredImisCount;
      continue;
    }
  }
  if (filteredImisCount > 1) {
    return true;
  }
  final List<InputMethodSubtypeCompatWrapper> subtypes=imm.getEnabledInputMethodSubtypeList(null,true);
  int keyboardCount=0;
  for (  InputMethodSubtypeCompatWrapper subtype : subtypes) {
    if (SubtypeSwitcher.KEYBOARD_MODE.equals(subtype.getMode())) {
      ++keyboardCount;
    }
  }
  return keyboardCount > 1;
}
Program: 88053
Project: 88053
Buggy source:
@Override public void startElement(String uri,String localName,String qName,Attributes attrs){
  if (BIGRAM_W1_TAG.equals(localName)) {
    mW1=attrs.getValue(uri,BIGRAM_W1_ATTRIBUTE);
  }
 else   if (BIGRAM_W2_TAG.equals(localName)) {
    String w2=attrs.getValue(uri,BIGRAM_W2_ATTRIBUTE);
    int freq=Integer.parseInt(attrs.getValue(uri,BIGRAM_FREQ_ATTRIBUTE));
    WeightedString bigram=new WeightedString(w2,freq / 8);
    ArrayList<WeightedString> bigramList=mBigramsMap.get(mW1);
    if (null == bigramList)     bigramList=new ArrayList<WeightedString>();
    bigramList.add(bigram);
    mBigramsMap.put(mW1,bigramList);
  }
}

Fixed version (ground truth):
@Override public void startElement(String uri,String localName,String qName,Attributes attrs){
  if (BIGRAM_W1_TAG.equals(localName)) {
    mW1=attrs.getValue(uri,BIGRAM_W1_ATTRIBUTE);
  }
 else   if (BIGRAM_W2_TAG.equals(localName)) {
    String w2=attrs.getValue(uri,BIGRAM_W2_ATTRIBUTE);
    int freq=Integer.parseInt(attrs.getValue(uri,BIGRAM_FREQ_ATTRIBUTE));
    WeightedString bigram=new WeightedString(w2,freq / XML_TO_MEMORY_RATIO);
    ArrayList<WeightedString> bigramList=mBigramsMap.get(mW1);
    if (null == bigramList)     bigramList=new ArrayList<WeightedString>();
    bigramList.add(bigram);
    mBigramsMap.put(mW1,bigramList);
  }
}
Program: 88054
Project: 88054
Buggy source:
@Override public void startElement(String uri,String localName,String qName,Attributes attrs){
  if (BIGRAM_W1_TAG.equals(localName)) {
    mW1=attrs.getValue(uri,BIGRAM_W1_ATTRIBUTE);
  }
 else   if (BIGRAM_W2_TAG.equals(localName)) {
    String w2=attrs.getValue(uri,BIGRAM_W2_ATTRIBUTE);
    int freq=Integer.parseInt(attrs.getValue(uri,BIGRAM_FREQ_ATTRIBUTE));
    WeightedString bigram=new WeightedString(w2,freq / 8);
    ArrayList<WeightedString> bigramList=mBigramsMap.get(mW1);
    if (null == bigramList)     bigramList=new ArrayList<WeightedString>();
    bigramList.add(bigram);
    mBigramsMap.put(mW1,bigramList);
  }
}

Fixed version (ground truth):
@Override public void startElement(String uri,String localName,String qName,Attributes attrs){
  if (BIGRAM_W1_TAG.equals(localName)) {
    mW1=attrs.getValue(uri,BIGRAM_W1_ATTRIBUTE);
  }
 else   if (BIGRAM_W2_TAG.equals(localName)) {
    String w2=attrs.getValue(uri,BIGRAM_W2_ATTRIBUTE);
    int freq=Integer.parseInt(attrs.getValue(uri,BIGRAM_FREQ_ATTRIBUTE));
    WeightedString bigram=new WeightedString(w2,freq / XML_TO_MEMORY_RATIO);
    ArrayList<WeightedString> bigramList=mBigramsMap.get(mW1);
    if (null == bigramList)     bigramList=new ArrayList<WeightedString>();
    bigramList.add(bigram);
    mBigramsMap.put(mW1,bigramList);
  }
}
Program: 88055
Project: 88055
Buggy source:
@Override public void startElement(String uri,String localName,String qName,Attributes attrs){
  if (BIGRAM_W1_TAG.equals(localName)) {
    mW1=attrs.getValue(uri,BIGRAM_W1_ATTRIBUTE);
  }
 else   if (BIGRAM_W2_TAG.equals(localName)) {
    String w2=attrs.getValue(uri,BIGRAM_W2_ATTRIBUTE);
    int freq=Integer.parseInt(attrs.getValue(uri,BIGRAM_FREQ_ATTRIBUTE));
    WeightedString bigram=new WeightedString(w2,freq / 8);
    ArrayList<WeightedString> bigramList=mBigramsMap.get(mW1);
    if (null == bigramList)     bigramList=new ArrayList<WeightedString>();
    bigramList.add(bigram);
    mBigramsMap.put(mW1,bigramList);
  }
}

Fixed version (ground truth):
@Override public void startElement(String uri,String localName,String qName,Attributes attrs){
  if (BIGRAM_W1_TAG.equals(localName)) {
    mW1=attrs.getValue(uri,BIGRAM_W1_ATTRIBUTE);
  }
 else   if (BIGRAM_W2_TAG.equals(localName)) {
    String w2=attrs.getValue(uri,BIGRAM_W2_ATTRIBUTE);
    int freq=Integer.parseInt(attrs.getValue(uri,BIGRAM_FREQ_ATTRIBUTE));
    WeightedString bigram=new WeightedString(w2,freq / XML_TO_MEMORY_RATIO);
    ArrayList<WeightedString> bigramList=mBigramsMap.get(mW1);
    if (null == bigramList)     bigramList=new ArrayList<WeightedString>();
    bigramList.add(bigram);
    mBigramsMap.put(mW1,bigramList);
  }
}
Program: 88057
Project: 88057
Buggy source:
private void commitCurrentAutoCorrection(final int separatorCodePoint,final InputConnection ic){
  if (mHandler.hasPendingUpdateSuggestions()) {
    mHandler.cancelUpdateSuggestions();
    updateSuggestions();
  }
  final CharSequence autoCorrection=mWordComposer.getAutoCorrectionOrNull();
  if (autoCorrection != null) {
    final String typedWord=mWordComposer.getTypedWord();
    if (TextUtils.isEmpty(typedWord)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    Utils.Stats.onAutoCorrection(typedWord,autoCorrection.toString(),separatorCodePoint);
    mExpectingUpdateSelection=true;
    commitBestWord(autoCorrection);
    addToUserUnigramAndBigramDictionaries(autoCorrection,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
    if (!typedWord.equals(autoCorrection) && null != ic) {
      InputConnectionCompatUtils.commitCorrection(ic,mLastSelectionEnd - typedWord.length(),typedWord,autoCorrection);
    }
  }
}

Fixed version (ground truth):
private void commitCurrentAutoCorrection(final int separatorCodePoint,final InputConnection ic){
  if (mHandler.hasPendingUpdateSuggestions()) {
    mHandler.cancelUpdateSuggestions();
    updateSuggestions();
  }
  final CharSequence autoCorrection=mWordComposer.getAutoCorrectionOrNull();
  if (autoCorrection != null) {
    final String typedWord=mWordComposer.getTypedWord();
    if (TextUtils.isEmpty(typedWord)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    Utils.Stats.onAutoCorrection(typedWord,autoCorrection.toString(),separatorCodePoint);
    mExpectingUpdateSelection=true;
    commitChosenWord(autoCorrection,WordComposer.COMMIT_TYPE_DECIDED_WORD);
    addToUserUnigramAndBigramDictionaries(autoCorrection,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
    if (!typedWord.equals(autoCorrection) && null != ic) {
      InputConnectionCompatUtils.commitCorrection(ic,mLastSelectionEnd - typedWord.length(),typedWord,autoCorrection);
    }
  }
}
Program: 88059
Project: 88059
Buggy source:
private void cancelAutoCorrect(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final String originallyTypedWord=mWordComposer.getTypedWord();
  final CharSequence autoCorrectedTo=mWordComposer.getAutoCorrectionOrNull();
  final int cancelLength=autoCorrectedTo.length();
  final CharSequence separator=ic.getTextBeforeCursor(1,0);
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(cancelLength + 1,0).subSequence(0,cancelLength).toString();
    if (!autoCorrectedTo.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (originallyTypedWord.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + originallyTypedWord + "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(cancelLength + 1,0);
  ic.commitText(originallyTypedWord,1);
  ic.commitText(separator,1);
  mWordComposer.deleteAutoCorrection();
  mWordComposer.onCommitWord();
  Utils.Stats.onSeparator(separator.charAt(0),WordComposer.NOT_A_COORDINATE,WordComposer.NOT_A_COORDINATE);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void cancelAutoCorrect(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final String originallyTypedWord=mWordComposer.getTypedWord();
  final CharSequence autoCorrectedTo=mWordComposer.getAutoCorrectionOrNull();
  final int cancelLength=autoCorrectedTo.length();
  final CharSequence separator=ic.getTextBeforeCursor(1,0);
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(cancelLength + 1,0).subSequence(0,cancelLength).toString();
    if (!autoCorrectedTo.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (originallyTypedWord.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + originallyTypedWord + "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(cancelLength + 1,0);
  ic.commitText(originallyTypedWord,1);
  ic.commitText(separator,1);
  mWordComposer.deleteAutoCorrection();
  mWordComposer.onCommitWord(WordComposer.COMMIT_TYPE_CANCEL_AUTO_CORRECT);
  Utils.Stats.onSeparator(separator.charAt(0),WordComposer.NOT_A_COORDINATE,WordComposer.NOT_A_COORDINATE);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88060
Project: 88060
Buggy source:
public void commitTyped(final InputConnection ic){
  if (!mWordComposer.isComposingWord())   return;
  final CharSequence typedWord=mWordComposer.getTypedWord();
  mWordComposer.onCommitWord();
  if (typedWord.length() > 0) {
    if (ic != null) {
      ic.commitText(typedWord,1);
    }
    addToUserUnigramAndBigramDictionaries(typedWord,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
  }
  updateSuggestions();
}

Fixed version (ground truth):
public void commitTyped(final InputConnection ic){
  if (!mWordComposer.isComposingWord())   return;
  final CharSequence typedWord=mWordComposer.getTypedWord();
  mWordComposer.onCommitWord(WordComposer.COMMIT_TYPE_USER_TYPED_WORD);
  if (typedWord.length() > 0) {
    if (ic != null) {
      ic.commitText(typedWord,1);
    }
    addToUserUnigramAndBigramDictionaries(typedWord,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
  }
  updateSuggestions();
}
Program: 88061
Project: 88061
Buggy source:
public void onCommitWord(){
  mCommittedWordSavedForSuggestionResuming=mCurrentWord;
  mCurrentWord=new CharacterStore();
}

Fixed version (ground truth):
public void onCommitWord(final int type){
  mCommittedWordSavedForSuggestionResuming=mCurrentWord;
  if (type != COMMIT_TYPE_DECIDED_WORD) {
    mCommittedWordSavedForSuggestionResuming.mAutoCorrection=null;
  }
  mCurrentWord=new CharacterStore();
}
Program: 88063
Project: 88063
Buggy source:
private void commitCurrentAutoCorrection(final int separatorCodePoint,final InputConnection ic){
  if (mHandler.hasPendingUpdateSuggestions()) {
    mHandler.cancelUpdateSuggestions();
    updateSuggestions();
  }
  final CharSequence autoCorrection=mWordComposer.getAutoCorrectionOrNull();
  if (autoCorrection != null) {
    final String typedWord=mWordComposer.getTypedWord();
    if (TextUtils.isEmpty(typedWord)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    Utils.Stats.onAutoCorrection(typedWord,autoCorrection.toString(),separatorCodePoint);
    mExpectingUpdateSelection=true;
    commitBestWord(autoCorrection);
    addToUserUnigramAndBigramDictionaries(autoCorrection,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
    if (!typedWord.equals(autoCorrection) && null != ic) {
      InputConnectionCompatUtils.commitCorrection(ic,mLastSelectionEnd - typedWord.length(),typedWord,autoCorrection);
    }
  }
}

Fixed version (ground truth):
private void commitCurrentAutoCorrection(final int separatorCodePoint,final InputConnection ic){
  if (mHandler.hasPendingUpdateSuggestions()) {
    mHandler.cancelUpdateSuggestions();
    updateSuggestions();
  }
  final CharSequence autoCorrection=mWordComposer.getAutoCorrectionOrNull();
  if (autoCorrection != null) {
    final String typedWord=mWordComposer.getTypedWord();
    if (TextUtils.isEmpty(typedWord)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str");
    }
    Utils.Stats.onAutoCorrection(typedWord,autoCorrection.toString(),separatorCodePoint);
    mExpectingUpdateSelection=true;
    commitChosenWord(autoCorrection,WordComposer.COMMIT_TYPE_DECIDED_WORD);
    addToUserUnigramAndBigramDictionaries(autoCorrection,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
    if (!typedWord.equals(autoCorrection) && null != ic) {
      InputConnectionCompatUtils.commitCorrection(ic,mLastSelectionEnd - typedWord.length(),typedWord,autoCorrection);
    }
  }
}
Program: 88065
Project: 88065
Buggy source:
private void cancelAutoCorrect(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final String originallyTypedWord=mWordComposer.getTypedWord();
  final CharSequence autoCorrectedTo=mWordComposer.getAutoCorrectionOrNull();
  final int cancelLength=autoCorrectedTo.length();
  final CharSequence separator=ic.getTextBeforeCursor(1,0);
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(cancelLength + 1,0).subSequence(0,cancelLength).toString();
    if (!autoCorrectedTo.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (originallyTypedWord.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + originallyTypedWord + "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(cancelLength + 1,0);
  ic.commitText(originallyTypedWord,1);
  ic.commitText(separator,1);
  mWordComposer.deleteAutoCorrection();
  mWordComposer.onCommitWord();
  Utils.Stats.onSeparator(separator.charAt(0),WordComposer.NOT_A_COORDINATE,WordComposer.NOT_A_COORDINATE);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void cancelAutoCorrect(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final String originallyTypedWord=mWordComposer.getTypedWord();
  final CharSequence autoCorrectedTo=mWordComposer.getAutoCorrectionOrNull();
  final int cancelLength=autoCorrectedTo.length();
  final CharSequence separator=ic.getTextBeforeCursor(1,0);
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(cancelLength + 1,0).subSequence(0,cancelLength).toString();
    if (!autoCorrectedTo.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (originallyTypedWord.equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + originallyTypedWord + "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(cancelLength + 1,0);
  ic.commitText(originallyTypedWord,1);
  ic.commitText(separator,1);
  mWordComposer.deleteAutoCorrection();
  mWordComposer.onCommitWord(WordComposer.COMMIT_TYPE_CANCEL_AUTO_CORRECT);
  Utils.Stats.onSeparator(separator.charAt(0),WordComposer.NOT_A_COORDINATE,WordComposer.NOT_A_COORDINATE);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88066
Project: 88066
Buggy source:
public void commitTyped(final InputConnection ic){
  if (!mWordComposer.isComposingWord())   return;
  final CharSequence typedWord=mWordComposer.getTypedWord();
  mWordComposer.onCommitWord();
  if (typedWord.length() > 0) {
    if (ic != null) {
      ic.commitText(typedWord,1);
    }
    addToUserUnigramAndBigramDictionaries(typedWord,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
  }
  updateSuggestions();
}

Fixed version (ground truth):
public void commitTyped(final InputConnection ic){
  if (!mWordComposer.isComposingWord())   return;
  final CharSequence typedWord=mWordComposer.getTypedWord();
  mWordComposer.onCommitWord(WordComposer.COMMIT_TYPE_USER_TYPED_WORD);
  if (typedWord.length() > 0) {
    if (ic != null) {
      ic.commitText(typedWord,1);
    }
    addToUserUnigramAndBigramDictionaries(typedWord,UserUnigramDictionary.FREQUENCY_FOR_TYPED);
  }
  updateSuggestions();
}
Program: 88067
Project: 88067
Buggy source:
public void onCommitWord(){
  mCommittedWordSavedForSuggestionResuming=mCurrentWord;
  mCurrentWord=new CharacterStore();
}

Fixed version (ground truth):
public void onCommitWord(final int type){
  mCommittedWordSavedForSuggestionResuming=mCurrentWord;
  if (type != COMMIT_TYPE_DECIDED_WORD) {
    mCommittedWordSavedForSuggestionResuming.mAutoCorrection=null;
  }
  mCurrentWord=new CharacterStore();
}
Program: 88070
Project: 88070
Buggy source:
@Override public void onTextInput(CharSequence text){
  mVoiceProxy.commitVoiceInput();
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  commitTyped(ic);
  maybeRemovePreviousPeriod(ic,text);
  ic.commitText(text,1);
  ic.endBatchEdit();
  mKeyboardSwitcher.updateShiftState();
  mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY);
  mSpaceState=SPACE_STATE_NONE;
  mEnteredText=text;
}

Fixed version (ground truth):
@Override public void onTextInput(CharSequence text){
  mVoiceProxy.commitVoiceInput();
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  commitTyped(ic);
  maybeRemovePreviousPeriod(ic,text);
  ic.commitText(text,1);
  ic.endBatchEdit();
  mKeyboardSwitcher.updateShiftState();
  mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY);
  mSpaceState=SPACE_STATE_NONE;
  mWordSavedForAutoCorrectCancellation=null;
  mEnteredText=text;
}
Program: 88073
Project: 88073
Buggy source:
@Override public void onTextInput(CharSequence text){
  mVoiceProxy.commitVoiceInput();
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  commitTyped(ic);
  maybeRemovePreviousPeriod(ic,text);
  ic.commitText(text,1);
  ic.endBatchEdit();
  mKeyboardSwitcher.updateShiftState();
  mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY);
  mSpaceState=SPACE_STATE_NONE;
  mEnteredText=text;
}

Fixed version (ground truth):
@Override public void onTextInput(CharSequence text){
  mVoiceProxy.commitVoiceInput();
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  commitTyped(ic);
  maybeRemovePreviousPeriod(ic,text);
  ic.commitText(text,1);
  ic.endBatchEdit();
  mKeyboardSwitcher.updateShiftState();
  mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY);
  mSpaceState=SPACE_STATE_NONE;
  mWordSavedForAutoCorrectCancellation=null;
  mEnteredText=text;
}
Program: 88076
Project: 88076
Buggy source:
@Override public void onTextInput(CharSequence text){
  mVoiceProxy.commitVoiceInput();
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  commitTyped(ic);
  maybeRemovePreviousPeriod(ic,text);
  ic.commitText(text,1);
  ic.endBatchEdit();
  mKeyboardSwitcher.updateShiftState();
  mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY);
  mSpaceState=SPACE_STATE_NONE;
  mEnteredText=text;
}

Fixed version (ground truth):
@Override public void onTextInput(CharSequence text){
  mVoiceProxy.commitVoiceInput();
  final InputConnection ic=getCurrentInputConnection();
  if (ic == null)   return;
  ic.beginBatchEdit();
  commitTyped(ic);
  maybeRemovePreviousPeriod(ic,text);
  ic.commitText(text,1);
  ic.endBatchEdit();
  mKeyboardSwitcher.updateShiftState();
  mKeyboardSwitcher.onCodeInput(Keyboard.CODE_DUMMY);
  mSpaceState=SPACE_STATE_NONE;
  mWordSavedForAutoCorrectCancellation=null;
  mEnteredText=text;
}
Program: 88078
Project: 88078
Buggy source:
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(Context context,CharSequence text){
  if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null || OBJ_FLAG_AUTO_CORRECTION == null) {
    return text;
  }
  final Spannable spannable=text instanceof Spannable ? (Spannable)text : new SpannableString(text);
  final Object[] args={context,null,new String[]{},(int)OBJ_FLAG_AUTO_CORRECTION,(Class<?>)SuggestionSpanPickedNotificationReceiver.class};
  final Object ss=CompatUtils.newInstance(CONSTRUCTOR_SuggestionSpan,args);
  if (ss == null) {
    Log.w(TAG,"String_Node_Str");
    return text;
  }
  spannable.setSpan(ss,0,text.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
  return spannable;
}

Fixed version (ground truth):
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(Context context,CharSequence text){
  if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null || OBJ_FLAG_AUTO_CORRECTION == null || OBJ_SUGGESTION_MAX_SIZE == null) {
    return text;
  }
  final Spannable spannable=text instanceof Spannable ? (Spannable)text : new SpannableString(text);
  final Object[] args={context,null,new String[]{},(int)OBJ_FLAG_AUTO_CORRECTION,(Class<?>)SuggestionSpanPickedNotificationReceiver.class};
  final Object ss=CompatUtils.newInstance(CONSTRUCTOR_SuggestionSpan,args);
  if (ss == null) {
    Log.w(TAG,"String_Node_Str");
    return text;
  }
  spannable.setSpan(ss,0,text.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
  return spannable;
}
Program: 88079
Project: 88079
Buggy source:
/** 
 * Finds all possible nearby key codes around a touch event point and returns the nearest key. The algorithm to determine the nearby keys depends on the threshold set by  {@link #setProximityThreshold(int)} and the mode set by{@link #setProximityCorrectionEnabled(boolean)}.
 * @param x The x-coordinate of a touch point
 * @param y The y-coordinate of a touch point
 * @param allCodes All nearby key codes except functional key are returned in this array
 * @return The nearest key
 */
public Key getKeyAndNearbyCodes(int x,int y,final int[] allCodes){
  final List<Key> keys=getKeyboard().mKeys;
  final int touchX=getTouchX(x);
  final int touchY=getTouchY(y);
  initializeNearbyKeys();
  Key primaryKey=null;
  for (  final int index : mKeyboard.getNearestKeys(touchX,touchY)) {
    final Key key=keys.get(index);
    final boolean isOnKey=key.isOnKey(touchX,touchY);
    final int distance=key.squaredDistanceToEdge(touchX,touchY);
    if (isOnKey || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
      final int insertedPosition=sortNearbyKeys(index,distance,isOnKey);
      if (insertedPosition == 0 && isOnKey) {
        primaryKey=key;
      }
    }
  }
  if (allCodes != null && allCodes.length > 0) {
    getNearbyKeyCodes(allCodes);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ (primaryKey == null ? "String_Node_Str" : primaryKey.mCode)+ "String_Node_Str"+ Arrays.toString(allCodes));
    }
  }
  return primaryKey;
}

Fixed version (ground truth):
/** 
 * Finds all possible nearby key codes around a touch event point and returns the nearest key. The algorithm to determine the nearby keys depends on the threshold set by  {@link #setProximityThreshold(int)} and the mode set by{@link #setProximityCorrectionEnabled(boolean)}.
 * @param x The x-coordinate of a touch point
 * @param y The y-coordinate of a touch point
 * @param allCodes All nearby key codes except functional key are returned in this array
 * @return The nearest key
 */
public Key getKeyAndNearbyCodes(int x,int y,final int[] allCodes){
  final List<Key> keys=getKeyboard().mKeys;
  final int touchX=getTouchX(x);
  final int touchY=getTouchY(y);
  initializeNearbyKeys();
  Key primaryKey=null;
  for (  final int index : mKeyboard.getNearestKeys(touchX,touchY)) {
    final Key key=keys.get(index);
    final boolean isOnKey=key.isOnKey(touchX,touchY);
    final int distance=key.squaredDistanceToEdge(touchX,touchY);
    if (isOnKey || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
      final int insertedPosition=sortNearbyKeys(index,distance,isOnKey);
      if (insertedPosition == 0 && isOnKey) {
        primaryKey=key;
      }
    }
  }
  if (allCodes != null && allCodes.length > 0) {
    getNearbyKeyCodes(allCodes);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ printableCode(primaryKey)+ "String_Node_Str"+ printableCodes(allCodes));
    }
  }
  return primaryKey;
}
Program: 88080
Project: 88080
Buggy source:
private void printTouchEvent(String title,int x,int y,long eventTime){
  final Key key=mKeyDetector.getKeyAndNearbyCodes(x,y,null);
  final String code=(key == null) ? "String_Node_Str" : keyCodePrintable(key.mCode);
  final long delta=eventTime - mPreviousEventTime;
  Log.d(TAG,String.format("String_Node_Str",title,(mKeyAlreadyProcessed ? "String_Node_Str" : "String_Node_Str"),mPointerId,x,y,delta,code));
  mPreviousEventTime=eventTime;
}

Fixed version (ground truth):
private void printTouchEvent(String title,int x,int y,long eventTime){
  final Key key=mKeyDetector.getKeyAndNearbyCodes(x,y,null);
  final String code=KeyDetector.printableCode(key);
  final long delta=eventTime - mPreviousEventTime;
  Log.d(TAG,String.format("String_Node_Str",title,(mKeyAlreadyProcessed ? "String_Node_Str" : "String_Node_Str"),mPointerId,x,y,delta,code));
  mPreviousEventTime=eventTime;
}
Program: 88081
Project: 88081
Buggy source:
private boolean callListenerOnPressAndCheckKeyboardLayoutChange(Key key,boolean withSliding){
  final boolean ignoreModifierKey=mIgnoreModifierKey && key.isModifier();
  if (DEBUG_LISTENER)   Log.d(TAG,"String_Node_Str" + keyCodePrintable(key.mCode) + "String_Node_Str"+ withSliding+ "String_Node_Str"+ ignoreModifierKey);
  if (ignoreModifierKey) {
    return false;
  }
  if (key.isEnabled()) {
    mListener.onPress(key.mCode,withSliding);
    final boolean keyboardLayoutHasBeenChanged=mKeyboardLayoutHasBeenChanged;
    mKeyboardLayoutHasBeenChanged=false;
    return keyboardLayoutHasBeenChanged;
  }
  return false;
}

Fixed version (ground truth):
private boolean callListenerOnPressAndCheckKeyboardLayoutChange(Key key,boolean withSliding){
  final boolean ignoreModifierKey=mIgnoreModifierKey && key.isModifier();
  if (DEBUG_LISTENER) {
    Log.d(TAG,"String_Node_Str" + KeyDetector.printableCode(key.mCode) + "String_Node_Str"+ withSliding+ "String_Node_Str"+ ignoreModifierKey+ "String_Node_Str"+ key.isEnabled());
  }
  if (ignoreModifierKey) {
    return false;
  }
  if (key.isEnabled()) {
    mListener.onPress(key.mCode,withSliding);
    final boolean keyboardLayoutHasBeenChanged=mKeyboardLayoutHasBeenChanged;
    mKeyboardLayoutHasBeenChanged=false;
    return keyboardLayoutHasBeenChanged;
  }
  return false;
}
Program: 88082
Project: 88082
Buggy source:
private void callListenerOnRelease(Key key,int primaryCode,boolean withSliding){
  final boolean ignoreModifierKey=mIgnoreModifierKey && key.isModifier();
  if (DEBUG_LISTENER)   Log.d(TAG,"String_Node_Str" + keyCodePrintable(primaryCode) + "String_Node_Str"+ withSliding+ "String_Node_Str"+ ignoreModifierKey);
  if (ignoreModifierKey) {
    return;
  }
  if (key.isEnabled()) {
    mListener.onRelease(primaryCode,withSliding);
  }
}

Fixed version (ground truth):
private void callListenerOnRelease(Key key,int primaryCode,boolean withSliding){
  final boolean ignoreModifierKey=mIgnoreModifierKey && key.isModifier();
  if (DEBUG_LISTENER) {
    Log.d(TAG,"String_Node_Str" + KeyDetector.printableCode(primaryCode) + "String_Node_Str"+ withSliding+ "String_Node_Str"+ ignoreModifierKey+ "String_Node_Str"+ key.isEnabled());
  }
  if (ignoreModifierKey) {
    return;
  }
  if (key.isEnabled()) {
    mListener.onRelease(primaryCode,withSliding);
  }
}
Program: 88083
Project: 88083
Buggy source:
private void callListenerOnCodeInput(Key key,int primaryCode,int[] keyCodes,int x,int y){
  final boolean ignoreModifierKey=mIgnoreModifierKey && key.isModifier();
  final boolean alterCode=key.altCodeWhileTyping() && mTimerProxy.isTyping();
  final int code=alterCode ? key.mAltCode : primaryCode;
  final CharSequence text=(code != Keyboard.CODE_DUMMY) ? null : key.mOutputText;
  if (DEBUG_LISTENER) {
    Log.d(TAG,"String_Node_Str" + keyCodePrintable(code) + "String_Node_Str"+ text+ "String_Node_Str"+ Arrays.toString(keyCodes)+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ ignoreModifierKey+ "String_Node_Str"+ alterCode);
  }
  if (ignoreModifierKey) {
    return;
  }
  if (key.isEnabled()) {
    if (code != Keyboard.CODE_DUMMY) {
      mListener.onCodeInput(code,keyCodes,x,y);
    }
 else     if (text != null) {
      mListener.onTextInput(text);
    }
    if (!key.altCodeWhileTyping() && !key.isModifier()) {
      mTimerProxy.startKeyTypedTimer(sIgnoreSpecialKeyTimeout);
    }
  }
}

Fixed version (ground truth):
private void callListenerOnCodeInput(Key key,int primaryCode,int[] keyCodes,int x,int y){
  final boolean ignoreModifierKey=mIgnoreModifierKey && key.isModifier();
  final boolean alterCode=key.altCodeWhileTyping() && mTimerProxy.isTyping();
  final int code=alterCode ? key.mAltCode : primaryCode;
  final CharSequence text=(code != Keyboard.CODE_DUMMY) ? null : key.mOutputText;
  if (DEBUG_LISTENER) {
    Log.d(TAG,"String_Node_Str" + KeyDetector.printableCode(code) + "String_Node_Str"+ text+ "String_Node_Str"+ KeyDetector.printableCodes(keyCodes)+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ ignoreModifierKey+ "String_Node_Str"+ alterCode+ "String_Node_Str"+ key.isEnabled());
  }
  if (ignoreModifierKey) {
    return;
  }
  if (key.isEnabled()) {
    if (code != Keyboard.CODE_DUMMY) {
      mListener.onCodeInput(code,keyCodes,x,y);
    }
 else     if (text != null) {
      mListener.onTextInput(text);
    }
    if (!key.altCodeWhileTyping() && !key.isModifier()) {
      mTimerProxy.startKeyTypedTimer(sIgnoreSpecialKeyTimeout);
    }
  }
}
Program: 88084
Project: 88084
Buggy source:
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(Context context,CharSequence text){
  if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null || OBJ_FLAG_AUTO_CORRECTION == null) {
    return text;
  }
  final Spannable spannable=text instanceof Spannable ? (Spannable)text : new SpannableString(text);
  final Object[] args={context,null,new String[]{},(int)OBJ_FLAG_AUTO_CORRECTION,(Class<?>)SuggestionSpanPickedNotificationReceiver.class};
  final Object ss=CompatUtils.newInstance(CONSTRUCTOR_SuggestionSpan,args);
  if (ss == null) {
    Log.w(TAG,"String_Node_Str");
    return text;
  }
  spannable.setSpan(ss,0,text.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
  return spannable;
}

Fixed version (ground truth):
public static CharSequence getTextWithAutoCorrectionIndicatorUnderline(Context context,CharSequence text){
  if (TextUtils.isEmpty(text) || CONSTRUCTOR_SuggestionSpan == null || OBJ_FLAG_AUTO_CORRECTION == null || OBJ_SUGGESTION_MAX_SIZE == null) {
    return text;
  }
  final Spannable spannable=text instanceof Spannable ? (Spannable)text : new SpannableString(text);
  final Object[] args={context,null,new String[]{},(int)OBJ_FLAG_AUTO_CORRECTION,(Class<?>)SuggestionSpanPickedNotificationReceiver.class};
  final Object ss=CompatUtils.newInstance(CONSTRUCTOR_SuggestionSpan,args);
  if (ss == null) {
    Log.w(TAG,"String_Node_Str");
    return text;
  }
  spannable.setSpan(ss,0,text.length(),Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);
  return spannable;
}
Program: 88085
Project: 88085
Buggy source:
/** 
 * Finds all possible nearby key codes around a touch event point and returns the nearest key. The algorithm to determine the nearby keys depends on the threshold set by  {@link #setProximityThreshold(int)} and the mode set by{@link #setProximityCorrectionEnabled(boolean)}.
 * @param x The x-coordinate of a touch point
 * @param y The y-coordinate of a touch point
 * @param allCodes All nearby key codes except functional key are returned in this array
 * @return The nearest key
 */
public Key getKeyAndNearbyCodes(int x,int y,final int[] allCodes){
  final List<Key> keys=getKeyboard().mKeys;
  final int touchX=getTouchX(x);
  final int touchY=getTouchY(y);
  initializeNearbyKeys();
  Key primaryKey=null;
  for (  final int index : mKeyboard.getNearestKeys(touchX,touchY)) {
    final Key key=keys.get(index);
    final boolean isOnKey=key.isOnKey(touchX,touchY);
    final int distance=key.squaredDistanceToEdge(touchX,touchY);
    if (isOnKey || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
      final int insertedPosition=sortNearbyKeys(index,distance,isOnKey);
      if (insertedPosition == 0 && isOnKey) {
        primaryKey=key;
      }
    }
  }
  if (allCodes != null && allCodes.length > 0) {
    getNearbyKeyCodes(allCodes);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ (primaryKey == null ? "String_Node_Str" : primaryKey.mCode)+ "String_Node_Str"+ Arrays.toString(allCodes));
    }
  }
  return primaryKey;
}

Fixed version (ground truth):
/** 
 * Finds all possible nearby key codes around a touch event point and returns the nearest key. The algorithm to determine the nearby keys depends on the threshold set by  {@link #setProximityThreshold(int)} and the mode set by{@link #setProximityCorrectionEnabled(boolean)}.
 * @param x The x-coordinate of a touch point
 * @param y The y-coordinate of a touch point
 * @param allCodes All nearby key codes except functional key are returned in this array
 * @return The nearest key
 */
public Key getKeyAndNearbyCodes(int x,int y,final int[] allCodes){
  final List<Key> keys=getKeyboard().mKeys;
  final int touchX=getTouchX(x);
  final int touchY=getTouchY(y);
  initializeNearbyKeys();
  Key primaryKey=null;
  for (  final int index : mKeyboard.getNearestKeys(touchX,touchY)) {
    final Key key=keys.get(index);
    final boolean isOnKey=key.isOnKey(touchX,touchY);
    final int distance=key.squaredDistanceToEdge(touchX,touchY);
    if (isOnKey || (mProximityCorrectOn && distance < mProximityThresholdSquare)) {
      final int insertedPosition=sortNearbyKeys(index,distance,isOnKey);
      if (insertedPosition == 0 && isOnKey) {
        primaryKey=key;
      }
    }
  }
  if (allCodes != null && allCodes.length > 0) {
    getNearbyKeyCodes(allCodes);
    if (DEBUG) {
      Log.d(TAG,"String_Node_Str" + x + "String_Node_Str"+ y+ "String_Node_Str"+ printableCode(primaryKey)+ "String_Node_Str"+ printableCodes(allCodes));
    }
  }
  return primaryKey;
}
Program: 88086
Project: 88086
Buggy source:
private void printTouchEvent(String title,int x,int y,long eventTime){
  final Key key=mKeyDetector.getKeyAndNearbyCodes(x,y,null);
  final String code=(key == null) ? "String_Node_Str" : keyCodePrintable(key.mCode);
  final long delta=eventTime - mPreviousEventTime;
  Log.d(TAG,String.format("String_Node_Str",title,(mKeyAlreadyProcessed ? "String_Node_Str" : "String_Node_Str"),mPointerId,x,y,delta,code));
  mPreviousEventTime=eventTime;
}

Fixed version (ground truth):
private void printTouchEvent(String title,int x,int y,long eventTime){
  final Key key=mKeyDetector.getKeyAndNearbyCodes(x,y,null);
  final String code=KeyDetector.printableCode(key);
  final long delta=eventTime - mPreviousEventTime;
  Log.d(TAG,String.format("String_Node_Str",title,(mKeyAlreadyProcessed ? "String_Node_Str" : "String_Node_Str"),mPointerId,x,y,delta,code));
  mPreviousEventTime=eventTime;
}