nus-yam/ex-repair huggingface dataset:
Program: 88004
Project: 88004
Buggy source:
public void updateBigramPredictions(){
  if (mSuggest == null || !isSuggestionsRequested())   return;
  if (!mSettingsValues.mBigramPredictionEnabled) {
    setPunctuationSuggestions();
    return;
  }
  final SuggestedWords.Builder builder;
  if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
    final CharSequence prevWord=EditingUtils.getThisWord(getCurrentInputConnection(),mSettingsValues.mWordSeparators);
    if (!TextUtils.isEmpty(prevWord)) {
      builder=mSuggest.getBigramPredictionWordBuilder(prevWord);
    }
 else {
      builder=null;
    }
  }
 else {
    builder=null;
  }
  if (null == builder || builder.size() > 0) {
    showSuggestions(builder.build(),"String_Node_Str");
  }
 else {
    if (!isShowingPunctuationList())     setPunctuationSuggestions();
  }
}

Fixed version (ground truth):
public void updateBigramPredictions(){
  if (mSuggest == null || !isSuggestionsRequested())   return;
  if (!mSettingsValues.mBigramPredictionEnabled) {
    setPunctuationSuggestions();
    return;
  }
  final SuggestedWords.Builder builder;
  if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
    final CharSequence prevWord=EditingUtils.getThisWord(getCurrentInputConnection(),mSettingsValues.mWordSeparators);
    if (!TextUtils.isEmpty(prevWord)) {
      builder=mSuggest.getBigramPredictionWordBuilder(prevWord);
    }
 else {
      builder=null;
    }
  }
 else {
    builder=null;
  }
  if (null != builder && builder.size() > 0) {
    showSuggestions(builder.build(),"String_Node_Str");
  }
 else {
    if (!isShowingPunctuationList())     setPunctuationSuggestions();
  }
}
Program: 88005
Project: 88005
Buggy source:
public void updateBigramPredictions(){
  if (mSuggest == null || !isSuggestionsRequested())   return;
  if (!mSettingsValues.mBigramPredictionEnabled) {
    setPunctuationSuggestions();
    return;
  }
  final SuggestedWords.Builder builder;
  if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
    final CharSequence prevWord=EditingUtils.getThisWord(getCurrentInputConnection(),mSettingsValues.mWordSeparators);
    if (!TextUtils.isEmpty(prevWord)) {
      builder=mSuggest.getBigramPredictionWordBuilder(prevWord);
    }
 else {
      builder=null;
    }
  }
 else {
    builder=null;
  }
  if (null == builder || builder.size() > 0) {
    showSuggestions(builder.build(),"String_Node_Str");
  }
 else {
    if (!isShowingPunctuationList())     setPunctuationSuggestions();
  }
}

Fixed version (ground truth):
public void updateBigramPredictions(){
  if (mSuggest == null || !isSuggestionsRequested())   return;
  if (!mSettingsValues.mBigramPredictionEnabled) {
    setPunctuationSuggestions();
    return;
  }
  final SuggestedWords.Builder builder;
  if (mCorrectionMode == Suggest.CORRECTION_FULL_BIGRAM) {
    final CharSequence prevWord=EditingUtils.getThisWord(getCurrentInputConnection(),mSettingsValues.mWordSeparators);
    if (!TextUtils.isEmpty(prevWord)) {
      builder=mSuggest.getBigramPredictionWordBuilder(prevWord);
    }
 else {
      builder=null;
    }
  }
 else {
    builder=null;
  }
  if (null != builder && builder.size() > 0) {
    showSuggestions(builder.build(),"String_Node_Str");
  }
 else {
    if (!isShowingPunctuationList())     setPunctuationSuggestions();
  }
}
Program: 88007
Project: 88007
Buggy source:
public void testManualPickThenSpaceThenType(){
  final String WORD1_TO_TYPE="String_Node_Str";
  final String WORD2_TO_TYPE="String_Node_Str";
  final String EXPECTED_RESULT="String_Node_Str";
  type(WORD1_TO_TYPE);
  mLatinIME.pickSuggestionManually(0,WORD1_TO_TYPE);
  type(WORD2_TO_TYPE);
  assertEquals("String_Node_Str",WORD1_TO_TYPE + WORD2_TO_TYPE,mTextView.getText().toString());
}

Fixed version (ground truth):
public void testManualPickThenSpaceThenType(){
  final String WORD1_TO_TYPE="String_Node_Str";
  final String WORD2_TO_TYPE="String_Node_Str";
  final String EXPECTED_RESULT="String_Node_Str";
  type(WORD1_TO_TYPE);
  mLatinIME.pickSuggestionManually(0,WORD1_TO_TYPE);
  type(WORD2_TO_TYPE);
  assertEquals("String_Node_Str",EXPECTED_RESULT,mTextView.getText().toString());
}
Program: 88009
Project: 88009
Buggy source:
public void testManualPickThenSpaceThenType(){
  final String WORD1_TO_TYPE="String_Node_Str";
  final String WORD2_TO_TYPE="String_Node_Str";
  final String EXPECTED_RESULT="String_Node_Str";
  type(WORD1_TO_TYPE);
  mLatinIME.pickSuggestionManually(0,WORD1_TO_TYPE);
  type(WORD2_TO_TYPE);
  assertEquals("String_Node_Str",WORD1_TO_TYPE + WORD2_TO_TYPE,mTextView.getText().toString());
}

Fixed version (ground truth):
public void testManualPickThenSpaceThenType(){
  final String WORD1_TO_TYPE="String_Node_Str";
  final String WORD2_TO_TYPE="String_Node_Str";
  final String EXPECTED_RESULT="String_Node_Str";
  type(WORD1_TO_TYPE);
  mLatinIME.pickSuggestionManually(0,WORD1_TO_TYPE);
  type(WORD2_TO_TYPE);
  assertEquals("String_Node_Str",EXPECTED_RESULT,mTextView.getText().toString());
}
Program: 88010
Project: 88010
Buggy source:
public boolean isAlphabetManualShiftedKeyboard(){
  return mElementId != ELEMENT_ALPHABET_MANUAL_SHIFTED;
}

Fixed version (ground truth):
public boolean isAlphabetManualShiftedKeyboard(){
  return mElementId == ELEMENT_ALPHABET_MANUAL_SHIFTED;
}
Program: 88011
Project: 88011
Buggy source:
public boolean isAlphabetManualShiftedKeyboard(){
  return mElementId != ELEMENT_ALPHABET_MANUAL_SHIFTED;
}

Fixed version (ground truth):
public boolean isAlphabetManualShiftedKeyboard(){
  return mElementId == ELEMENT_ALPHABET_MANUAL_SHIFTED;
}
Program: 88012
Project: 88012
Buggy source:
public boolean isAlphabetManualShiftedKeyboard(){
  return mElementId != ELEMENT_ALPHABET_MANUAL_SHIFTED;
}

Fixed version (ground truth):
public boolean isAlphabetManualShiftedKeyboard(){
  return mElementId == ELEMENT_ALPHABET_MANUAL_SHIFTED;
}
Program: 88013
Project: 88013
Buggy source:
private CharSequence specificTldProcessingOnTextInput(final InputConnection ic,final CharSequence text){
  if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD || !Character.isLetter(text.charAt(1))) {
    return text;
  }
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
    mSpaceState=SPACE_STATE_NONE;
    return text.subSequence(1,text.length());
  }
 else {
    return text;
  }
}

Fixed version (ground truth):
private CharSequence specificTldProcessingOnTextInput(final InputConnection ic,final CharSequence text){
  if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD || !Character.isLetter(text.charAt(1))) {
    return text;
  }
  mSpaceState=SPACE_STATE_NONE;
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
    return text.subSequence(1,text.length());
  }
 else {
    return text;
  }
}
Program: 88014
Project: 88014
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength,0).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength,0).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength,0);
  mComposingStateManager.onStartComposingText();
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88015
Project: 88015
Buggy source:
private CharSequence specificTldProcessingOnTextInput(final InputConnection ic,final CharSequence text){
  if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD || !Character.isLetter(text.charAt(1))) {
    return text;
  }
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
    mSpaceState=SPACE_STATE_NONE;
    return text.subSequence(1,text.length());
  }
 else {
    return text;
  }
}

Fixed version (ground truth):
private CharSequence specificTldProcessingOnTextInput(final InputConnection ic,final CharSequence text){
  if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD || !Character.isLetter(text.charAt(1))) {
    return text;
  }
  mSpaceState=SPACE_STATE_NONE;
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
    return text.subSequence(1,text.length());
  }
 else {
    return text;
  }
}
Program: 88016
Project: 88016
Buggy source:
private CharSequence specificTldProcessingOnTextInput(final InputConnection ic,final CharSequence text){
  if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD || !Character.isLetter(text.charAt(1))) {
    return text;
  }
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
    mSpaceState=SPACE_STATE_NONE;
    return text.subSequence(1,text.length());
  }
 else {
    return text;
  }
}

Fixed version (ground truth):
private CharSequence specificTldProcessingOnTextInput(final InputConnection ic,final CharSequence text){
  if (text.length() <= 1 || text.charAt(0) != Keyboard.CODE_PERIOD || !Character.isLetter(text.charAt(1))) {
    return text;
  }
  mSpaceState=SPACE_STATE_NONE;
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD) {
    return text.subSequence(1,text.length());
  }
 else {
    return text;
  }
}
Program: 88017
Project: 88017
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength,0).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88018
Project: 88018
Buggy source:
public LastComposedWord commitWord(final int type){
  final LastComposedWord lastComposedWord=new LastComposedWord(mCodes,mXCoordinates,mYCoordinates,mTypedWord.toString(),null == mAutoCorrection ? null : mAutoCorrection.toString());
  if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) {
    lastComposedWord.deactivate();
  }
  mCodes.clear();
  mTypedWord.setLength(0);
  mAutoCorrection=null;
  return lastComposedWord;
}

Fixed version (ground truth):
public LastComposedWord commitWord(final int type){
  final ArrayList<int[]> codes=mCodes;
  final int[] xCoordinates=mXCoordinates;
  final int[] yCoordinates=mYCoordinates;
  mCodes=new ArrayList<int[]>(N);
  mXCoordinates=new int[N];
  mYCoordinates=new int[N];
  final LastComposedWord lastComposedWord=new LastComposedWord(codes,xCoordinates,yCoordinates,mTypedWord.toString(),null == mAutoCorrection ? null : mAutoCorrection.toString());
  if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) {
    lastComposedWord.deactivate();
  }
  mTypedWord.setLength(0);
  mAutoCorrection=null;
  return lastComposedWord;
}
Program: 88019
Project: 88019
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength,0).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength,0).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength,0);
  mComposingStateManager.onStartComposingText();
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88020
Project: 88020
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength,0).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88021
Project: 88021
Buggy source:
public LastComposedWord commitWord(final int type){
  final LastComposedWord lastComposedWord=new LastComposedWord(mCodes,mXCoordinates,mYCoordinates,mTypedWord.toString(),null == mAutoCorrection ? null : mAutoCorrection.toString());
  if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) {
    lastComposedWord.deactivate();
  }
  mCodes.clear();
  mTypedWord.setLength(0);
  mAutoCorrection=null;
  return lastComposedWord;
}

Fixed version (ground truth):
public LastComposedWord commitWord(final int type){
  final ArrayList<int[]> codes=mCodes;
  final int[] xCoordinates=mXCoordinates;
  final int[] yCoordinates=mYCoordinates;
  mCodes=new ArrayList<int[]>(N);
  mXCoordinates=new int[N];
  mYCoordinates=new int[N];
  final LastComposedWord lastComposedWord=new LastComposedWord(codes,xCoordinates,yCoordinates,mTypedWord.toString(),null == mAutoCorrection ? null : mAutoCorrection.toString());
  if (type != LastComposedWord.COMMIT_TYPE_DECIDED_WORD) {
    lastComposedWord.deactivate();
  }
  mTypedWord.setLength(0);
  mAutoCorrection=null;
  return lastComposedWord;
}
Program: 88022
Project: 88022
Buggy source:
/** 
 * Delete the last keystroke as a result of hitting backspace.
 */
public void deleteLast(){
  final int size=size();
  if (size > 0) {
    final int lastPos=size - 1;
    char lastChar=mTypedWord.charAt(lastPos);
    mCodes.remove(lastPos);
    mTypedWord.deleteCharAt(lastPos);
    if (Character.isUpperCase(lastChar))     mCapsCount--;
  }
  if (size() == 0) {
    mIsFirstCharCapitalized=false;
  }
  if (mTrailingSingleQuotesCount > 0) {
    --mTrailingSingleQuotesCount;
  }
 else {
    for (int i=mTypedWord.offsetByCodePoints(mTypedWord.length(),-1); i >= 0; i=mTypedWord.offsetByCodePoints(i,-1)) {
      if (Keyboard.CODE_SINGLE_QUOTE != mTypedWord.codePointAt(i))       break;
      ++mTrailingSingleQuotesCount;
    }
  }
  mAutoCorrection=null;
}

Fixed version (ground truth):
/** 
 * Delete the last keystroke as a result of hitting backspace.
 */
public void deleteLast(){
  final int size=size();
  if (size > 0) {
    final int lastPos=size - 1;
    char lastChar=mTypedWord.charAt(lastPos);
    mCodes.remove(lastPos);
    mTypedWord.deleteCharAt(lastPos);
    if (Character.isUpperCase(lastChar))     mCapsCount--;
  }
  if (size() == 0) {
    mIsFirstCharCapitalized=false;
  }
  if (mTrailingSingleQuotesCount > 0) {
    --mTrailingSingleQuotesCount;
  }
 else {
    int i=mTypedWord.length();
    while (i > 0) {
      i=mTypedWord.offsetByCodePoints(i,-1);
      if (Keyboard.CODE_SINGLE_QUOTE != mTypedWord.codePointAt(i))       break;
      ++mTrailingSingleQuotesCount;
    }
  }
  mAutoCorrection=null;
}
Program: 88023
Project: 88023
Buggy source:
/** 
 * Delete the last keystroke as a result of hitting backspace.
 */
public void deleteLast(){
  final int size=size();
  if (size > 0) {
    final int lastPos=size - 1;
    char lastChar=mTypedWord.charAt(lastPos);
    mCodes.remove(lastPos);
    mTypedWord.deleteCharAt(lastPos);
    if (Character.isUpperCase(lastChar))     mCapsCount--;
  }
  if (size() == 0) {
    mIsFirstCharCapitalized=false;
  }
  if (mTrailingSingleQuotesCount > 0) {
    --mTrailingSingleQuotesCount;
  }
 else {
    for (int i=mTypedWord.offsetByCodePoints(mTypedWord.length(),-1); i >= 0; i=mTypedWord.offsetByCodePoints(i,-1)) {
      if (Keyboard.CODE_SINGLE_QUOTE != mTypedWord.codePointAt(i))       break;
      ++mTrailingSingleQuotesCount;
    }
  }
  mAutoCorrection=null;
}

Fixed version (ground truth):
/** 
 * Delete the last keystroke as a result of hitting backspace.
 */
public void deleteLast(){
  final int size=size();
  if (size > 0) {
    final int lastPos=size - 1;
    char lastChar=mTypedWord.charAt(lastPos);
    mCodes.remove(lastPos);
    mTypedWord.deleteCharAt(lastPos);
    if (Character.isUpperCase(lastChar))     mCapsCount--;
  }
  if (size() == 0) {
    mIsFirstCharCapitalized=false;
  }
  if (mTrailingSingleQuotesCount > 0) {
    --mTrailingSingleQuotesCount;
  }
 else {
    int i=mTypedWord.length();
    while (i > 0) {
      i=mTypedWord.offsetByCodePoints(i,-1);
      if (Keyboard.CODE_SINGLE_QUOTE != mTypedWord.codePointAt(i))       break;
      ++mTrailingSingleQuotesCount;
    }
  }
  mAutoCorrection=null;
}
Program: 88027
Project: 88027
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88028
Project: 88028
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(WordComposer.COMMIT_TYPE_CANCEL_AUTO_CORRECT);
  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 (!TextUtils.equals(autoCorrectedTo,wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (TextUtils.equals(originallyTypedWord,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: 88029
Project: 88029
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88030
Project: 88030
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(WordComposer.COMMIT_TYPE_CANCEL_AUTO_CORRECT);
  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 (!TextUtils.equals(autoCorrectedTo,wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (TextUtils.equals(originallyTypedWord,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: 88032
Project: 88032
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!TextUtils.equals(mWordComposer.getTypedWord(),wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88033
Project: 88033
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(WordComposer.COMMIT_TYPE_CANCEL_AUTO_CORRECT);
  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 (!TextUtils.equals(autoCorrectedTo,wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + autoCorrectedTo + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
    if (TextUtils.equals(originallyTypedWord,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: 88035
Project: 88035
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  mWordComposer.resumeSuggestionOnKeptWord();
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88036
Project: 88036
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  mWordComposer.resumeSuggestionOnKeptWord();
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88037
Project: 88037
Buggy source:
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  mWordComposer.resumeSuggestionOnKeptWord();
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}

Fixed version (ground truth):
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic){
  mWordComposer.resumeSuggestionOnKeptWord();
  final int restartLength=mWordComposer.size();
  if (DEBUG) {
    final String wordBeforeCursor=ic.getTextBeforeCursor(restartLength + 1,0).subSequence(0,restartLength).toString();
    if (!mWordComposer.getTypedWord().equals(wordBeforeCursor)) {
      throw new RuntimeException("String_Node_Str" + "String_Node_Str" + mWordComposer.getTypedWord() + "String_Node_Str"+ wordBeforeCursor+ "String_Node_Str");
    }
  }
  ic.deleteSurroundingText(restartLength + 1,0);
  ic.setComposingText(mWordComposer.getTypedWord(),1);
  mHandler.cancelUpdateBigramPredictions();
  mHandler.postUpdateSuggestions();
}
Program: 88039
Project: 88039
Buggy source:
private void handleBackspaceWhileInBatchEdit(final int spaceState,final InputConnection ic){
  mVoiceProxy.handleBackspace();
  mHandler.postUpdateShiftKeyState();
  if (mEnteredText != null && sameAsTextBeforeCursor(ic,mEnteredText)) {
    ic.deleteSurroundingText(mEnteredText.length(),0);
    return;
  }
  if (mWordComposer.isComposingWord()) {
    final int length=mWordComposer.size();
    if (length > 0) {
      mWordComposer.deleteLast();
      ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()),1);
      if (!mWordComposer.isComposingWord()) {
        mHandler.postUpdateBigramPredictions();
      }
 else {
        mHandler.postUpdateSuggestions();
      }
    }
 else {
      ic.deleteSurroundingText(1,0);
    }
  }
 else {
    if (mWordComposer.didAutoCorrectToAnotherWord()) {
      Utils.Stats.onAutoCorrectionCancellation();
      cancelAutoCorrect(ic);
      return;
    }
    if (SPACE_STATE_DOUBLE == spaceState) {
      if (revertDoubleSpace(ic)) {
        return;
      }
    }
 else     if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
      if (revertSwapPunctuation(ic)) {
        return;
      }
    }
    if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
      restartSuggestionsOnManuallyPickedTypedWord(ic);
    }
 else {
      ic.deleteSurroundingText(1,0);
      if (mDeleteCount > DELETE_ACCELERATE_AT) {
        ic.deleteSurroundingText(1,0);
      }
      restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
    }
  }
}

Fixed version (ground truth):
private void handleBackspaceWhileInBatchEdit(final int spaceState,final InputConnection ic){
  mVoiceProxy.handleBackspace();
  mHandler.postUpdateShiftKeyState();
  if (mEnteredText != null && sameAsTextBeforeCursor(ic,mEnteredText)) {
    ic.deleteSurroundingText(mEnteredText.length(),0);
    return;
  }
  if (mWordComposer.isComposingWord()) {
    final int length=mWordComposer.size();
    if (length > 0) {
      mWordComposer.deleteLast();
      ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()),1);
      if (!mWordComposer.isComposingWord()) {
        mHandler.postUpdateBigramPredictions();
      }
 else {
        mHandler.postUpdateSuggestions();
      }
    }
 else {
      ic.deleteSurroundingText(1,0);
    }
  }
 else {
    if (mWordComposer.didAutoCorrectToAnotherWord()) {
      Utils.Stats.onAutoCorrectionCancellation();
      cancelAutoCorrect(ic);
      return;
    }
    if (SPACE_STATE_DOUBLE == spaceState) {
      if (revertDoubleSpace(ic)) {
        return;
      }
    }
 else     if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
      if (revertSwapPunctuation(ic)) {
        return;
      }
    }
    if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
      restartSuggestionsOnManuallyPickedTypedWord(ic);
    }
 else {
      ic.deleteSurroundingText(1,0);
      if (mDeleteCount > DELETE_ACCELERATE_AT) {
        ic.deleteSurroundingText(1,0);
      }
      if (isSuggestionsRequested()) {
        restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
      }
    }
  }
}
Program: 88041
Project: 88041
Buggy source:
private void handleBackspaceWhileInBatchEdit(final int spaceState,final InputConnection ic){
  mVoiceProxy.handleBackspace();
  mHandler.postUpdateShiftKeyState();
  if (mEnteredText != null && sameAsTextBeforeCursor(ic,mEnteredText)) {
    ic.deleteSurroundingText(mEnteredText.length(),0);
    return;
  }
  if (mWordComposer.isComposingWord()) {
    final int length=mWordComposer.size();
    if (length > 0) {
      mWordComposer.deleteLast();
      ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()),1);
      if (!mWordComposer.isComposingWord()) {
        mHandler.postUpdateBigramPredictions();
      }
 else {
        mHandler.postUpdateSuggestions();
      }
    }
 else {
      ic.deleteSurroundingText(1,0);
    }
  }
 else {
    if (mWordComposer.didAutoCorrectToAnotherWord()) {
      Utils.Stats.onAutoCorrectionCancellation();
      cancelAutoCorrect(ic);
      return;
    }
    if (SPACE_STATE_DOUBLE == spaceState) {
      if (revertDoubleSpace(ic)) {
        return;
      }
    }
 else     if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
      if (revertSwapPunctuation(ic)) {
        return;
      }
    }
    if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
      restartSuggestionsOnManuallyPickedTypedWord(ic);
    }
 else {
      ic.deleteSurroundingText(1,0);
      if (mDeleteCount > DELETE_ACCELERATE_AT) {
        ic.deleteSurroundingText(1,0);
      }
      restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
    }
  }
}

Fixed version (ground truth):
private void handleBackspaceWhileInBatchEdit(final int spaceState,final InputConnection ic){
  mVoiceProxy.handleBackspace();
  mHandler.postUpdateShiftKeyState();
  if (mEnteredText != null && sameAsTextBeforeCursor(ic,mEnteredText)) {
    ic.deleteSurroundingText(mEnteredText.length(),0);
    return;
  }
  if (mWordComposer.isComposingWord()) {
    final int length=mWordComposer.size();
    if (length > 0) {
      mWordComposer.deleteLast();
      ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()),1);
      if (!mWordComposer.isComposingWord()) {
        mHandler.postUpdateBigramPredictions();
      }
 else {
        mHandler.postUpdateSuggestions();
      }
    }
 else {
      ic.deleteSurroundingText(1,0);
    }
  }
 else {
    if (mWordComposer.didAutoCorrectToAnotherWord()) {
      Utils.Stats.onAutoCorrectionCancellation();
      cancelAutoCorrect(ic);
      return;
    }
    if (SPACE_STATE_DOUBLE == spaceState) {
      if (revertDoubleSpace(ic)) {
        return;
      }
    }
 else     if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
      if (revertSwapPunctuation(ic)) {
        return;
      }
    }
    if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
      restartSuggestionsOnManuallyPickedTypedWord(ic);
    }
 else {
      ic.deleteSurroundingText(1,0);
      if (mDeleteCount > DELETE_ACCELERATE_AT) {
        ic.deleteSurroundingText(1,0);
      }
      if (isSuggestionsRequested()) {
        restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
      }
    }
  }
}
Program: 88043
Project: 88043
Buggy source:
private void handleBackspaceWhileInBatchEdit(final int spaceState,final InputConnection ic){
  mVoiceProxy.handleBackspace();
  mHandler.postUpdateShiftKeyState();
  if (mEnteredText != null && sameAsTextBeforeCursor(ic,mEnteredText)) {
    ic.deleteSurroundingText(mEnteredText.length(),0);
    return;
  }
  if (mWordComposer.isComposingWord()) {
    final int length=mWordComposer.size();
    if (length > 0) {
      mWordComposer.deleteLast();
      ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()),1);
      if (!mWordComposer.isComposingWord()) {
        mHandler.postUpdateBigramPredictions();
      }
 else {
        mHandler.postUpdateSuggestions();
      }
    }
 else {
      ic.deleteSurroundingText(1,0);
    }
  }
 else {
    if (mWordComposer.didAutoCorrectToAnotherWord()) {
      Utils.Stats.onAutoCorrectionCancellation();
      cancelAutoCorrect(ic);
      return;
    }
    if (SPACE_STATE_DOUBLE == spaceState) {
      if (revertDoubleSpace(ic)) {
        return;
      }
    }
 else     if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
      if (revertSwapPunctuation(ic)) {
        return;
      }
    }
    if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
      restartSuggestionsOnManuallyPickedTypedWord(ic);
    }
 else {
      ic.deleteSurroundingText(1,0);
      if (mDeleteCount > DELETE_ACCELERATE_AT) {
        ic.deleteSurroundingText(1,0);
      }
      restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
    }
  }
}

Fixed version (ground truth):
private void handleBackspaceWhileInBatchEdit(final int spaceState,final InputConnection ic){
  mVoiceProxy.handleBackspace();
  mHandler.postUpdateShiftKeyState();
  if (mEnteredText != null && sameAsTextBeforeCursor(ic,mEnteredText)) {
    ic.deleteSurroundingText(mEnteredText.length(),0);
    return;
  }
  if (mWordComposer.isComposingWord()) {
    final int length=mWordComposer.size();
    if (length > 0) {
      mWordComposer.deleteLast();
      ic.setComposingText(getTextWithUnderline(mWordComposer.getTypedWord()),1);
      if (!mWordComposer.isComposingWord()) {
        mHandler.postUpdateBigramPredictions();
      }
 else {
        mHandler.postUpdateSuggestions();
      }
    }
 else {
      ic.deleteSurroundingText(1,0);
    }
  }
 else {
    if (mWordComposer.didAutoCorrectToAnotherWord()) {
      Utils.Stats.onAutoCorrectionCancellation();
      cancelAutoCorrect(ic);
      return;
    }
    if (SPACE_STATE_DOUBLE == spaceState) {
      if (revertDoubleSpace(ic)) {
        return;
      }
    }
 else     if (SPACE_STATE_SWAP_PUNCTUATION == spaceState) {
      if (revertSwapPunctuation(ic)) {
        return;
      }
    }
    if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
      restartSuggestionsOnManuallyPickedTypedWord(ic);
    }
 else {
      ic.deleteSurroundingText(1,0);
      if (mDeleteCount > DELETE_ACCELERATE_AT) {
        ic.deleteSurroundingText(1,0);
      }
      if (isSuggestionsRequested()) {
        restartSuggestionsOnWordBeforeCursorIfAtEndOfWord(ic);
      }
    }
  }
}