nus-yam/ex-repair huggingface dataset:
Program: 88087
Project: 88087
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: 88088
Project: 88088
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: 88089
Project: 88089
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: 88090
Project: 88090
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: 88091
Project: 88091
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: 88092
Project: 88092
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: 88093
Project: 88093
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: 88094
Project: 88094
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: 88098
Project: 88098
Buggy source:
@Override public void run(){
  try {
    final Cursor cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Cursor cursor=null;
  try {
    cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
 finally {
    if (null != cursor)     cursor.close();
    client.release();
  }
}
Program: 88100
Project: 88100
Buggy source:
@Override public void run(){
  try {
    final Cursor cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Cursor cursor=null;
  try {
    cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
 finally {
    if (null != cursor)     cursor.close();
    client.release();
  }
}
Program: 88102
Project: 88102
Buggy source:
@Override public void run(){
  try {
    final Cursor cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Cursor cursor=null;
  try {
    cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
 finally {
    if (null != cursor)     cursor.close();
    client.release();
  }
}
Program: 88104
Project: 88104
Buggy source:
@Override public void run(){
  try {
    final Cursor cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Cursor cursor=null;
  try {
    cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
 finally {
    if (null != cursor)     cursor.close();
    client.release();
  }
}
Program: 88106
Project: 88106
Buggy source:
@Override public void run(){
  try {
    final Cursor cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
}

Fixed version (ground truth):
@Override public void run(){
  Cursor cursor=null;
  try {
    cursor=client.query(Words.CONTENT_URI,PROJECTION_ADD,"String_Node_Str",new String[]{word,mLocale},null);
    if (cursor != null && cursor.moveToFirst()) {
      final String locale=cursor.getString(cursor.getColumnIndex(Words.LOCALE));
      if (locale != null && locale.equals(mLocale.toString())) {
        final long id=cursor.getLong(cursor.getColumnIndex(Words._ID));
        final Uri uri=Uri.withAppendedPath(Words.CONTENT_URI,Long.toString(id));
        client.update(uri,values,null,null);
      }
    }
 else {
      client.insert(Words.CONTENT_URI,values);
    }
  }
 catch (  RemoteException e) {
  }
 finally {
    if (null != cursor)     cursor.close();
    client.release();
  }
}
Program: 88110
Project: 88110
Buggy source:
private void maybeRemovePreviousPeriod(final InputConnection ic,CharSequence text){
  CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD && text.charAt(0) == Keyboard.CODE_PERIOD) {
    ic.deleteSurroundingText(1,0);
  }
}

Fixed version (ground truth):
private void maybeRemovePreviousPeriod(final InputConnection ic,CharSequence text){
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD && text.charAt(0) == Keyboard.CODE_PERIOD) {
    ic.deleteSurroundingText(1,0);
  }
}
Program: 88113
Project: 88113
Buggy source:
private void maybeRemovePreviousPeriod(final InputConnection ic,CharSequence text){
  CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD && text.charAt(0) == Keyboard.CODE_PERIOD) {
    ic.deleteSurroundingText(1,0);
  }
}

Fixed version (ground truth):
private void maybeRemovePreviousPeriod(final InputConnection ic,CharSequence text){
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD && text.charAt(0) == Keyboard.CODE_PERIOD) {
    ic.deleteSurroundingText(1,0);
  }
}
Program: 88117
Project: 88117
Buggy source:
private void maybeRemovePreviousPeriod(final InputConnection ic,CharSequence text){
  CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD && text.charAt(0) == Keyboard.CODE_PERIOD) {
    ic.deleteSurroundingText(1,0);
  }
}

Fixed version (ground truth):
private void maybeRemovePreviousPeriod(final InputConnection ic,CharSequence text){
  final CharSequence lastOne=ic.getTextBeforeCursor(1,0);
  if (lastOne != null && lastOne.length() == 1 && lastOne.charAt(0) == Keyboard.CODE_PERIOD && text.charAt(0) == Keyboard.CODE_PERIOD) {
    ic.deleteSurroundingText(1,0);
  }
}
Program: 88120
Project: 88120
Buggy source:
public void setSuggestions(SuggestedWords words){
  if (mSuggestionsView != null) {
    mSuggestionsView.setSuggestions(words);
    mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasWordAboveAutoCorrectionScoreThreshold());
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    final boolean oldAutoCorrectionIndicator=mComposingStateManager.isAutoCorrectionIndicatorOn();
    final boolean newAutoCorrectionIndicator=Utils.willAutoCorrect(words);
    if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
      final CharSequence textWithUnderline=newAutoCorrectionIndicator ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(this,mComposingStringBuilder) : mComposingStringBuilder;
      if (!TextUtils.isEmpty(textWithUnderline)) {
        ic.setComposingText(textWithUnderline,1);
      }
      mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator);
    }
  }
}

Fixed version (ground truth):
public void setSuggestions(SuggestedWords words){
  if (mSuggestionsView != null) {
    mSuggestionsView.setSuggestions(words);
    mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasWordAboveAutoCorrectionScoreThreshold());
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    final boolean oldAutoCorrectionIndicator=mComposingStateManager.isAutoCorrectionIndicatorOn();
    final boolean newAutoCorrectionIndicator=Utils.willAutoCorrect(words);
    if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
      if (LatinImeLogger.sDBG) {
        Log.d(TAG,"String_Node_Str" + oldAutoCorrectionIndicator + "String_Node_Str"+ newAutoCorrectionIndicator);
      }
      final CharSequence textWithUnderline=newAutoCorrectionIndicator ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(this,mComposingStringBuilder) : mComposingStringBuilder;
      if (!TextUtils.isEmpty(textWithUnderline)) {
        ic.setComposingText(textWithUnderline,1);
      }
      mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator);
    }
  }
}
Program: 88121
Project: 88121
Buggy source:
public void setSuggestions(SuggestedWords words){
  if (mSuggestionsView != null) {
    mSuggestionsView.setSuggestions(words);
    mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasWordAboveAutoCorrectionScoreThreshold());
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    final boolean oldAutoCorrectionIndicator=mComposingStateManager.isAutoCorrectionIndicatorOn();
    final boolean newAutoCorrectionIndicator=Utils.willAutoCorrect(words);
    if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
      final CharSequence textWithUnderline=newAutoCorrectionIndicator ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(this,mComposingStringBuilder) : mComposingStringBuilder;
      if (!TextUtils.isEmpty(textWithUnderline)) {
        ic.setComposingText(textWithUnderline,1);
      }
      mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator);
    }
  }
}

Fixed version (ground truth):
public void setSuggestions(SuggestedWords words){
  if (mSuggestionsView != null) {
    mSuggestionsView.setSuggestions(words);
    mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasWordAboveAutoCorrectionScoreThreshold());
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    final boolean oldAutoCorrectionIndicator=mComposingStateManager.isAutoCorrectionIndicatorOn();
    final boolean newAutoCorrectionIndicator=Utils.willAutoCorrect(words);
    if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
      if (LatinImeLogger.sDBG) {
        Log.d(TAG,"String_Node_Str" + oldAutoCorrectionIndicator + "String_Node_Str"+ newAutoCorrectionIndicator);
      }
      final CharSequence textWithUnderline=newAutoCorrectionIndicator ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(this,mComposingStringBuilder) : mComposingStringBuilder;
      if (!TextUtils.isEmpty(textWithUnderline)) {
        ic.setComposingText(textWithUnderline,1);
      }
      mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator);
    }
  }
}
Program: 88122
Project: 88122
Buggy source:
public void setSuggestions(SuggestedWords words){
  if (mSuggestionsView != null) {
    mSuggestionsView.setSuggestions(words);
    mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasWordAboveAutoCorrectionScoreThreshold());
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    final boolean oldAutoCorrectionIndicator=mComposingStateManager.isAutoCorrectionIndicatorOn();
    final boolean newAutoCorrectionIndicator=Utils.willAutoCorrect(words);
    if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
      final CharSequence textWithUnderline=newAutoCorrectionIndicator ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(this,mComposingStringBuilder) : mComposingStringBuilder;
      if (!TextUtils.isEmpty(textWithUnderline)) {
        ic.setComposingText(textWithUnderline,1);
      }
      mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator);
    }
  }
}

Fixed version (ground truth):
public void setSuggestions(SuggestedWords words){
  if (mSuggestionsView != null) {
    mSuggestionsView.setSuggestions(words);
    mKeyboardSwitcher.onAutoCorrectionStateChanged(words.hasWordAboveAutoCorrectionScoreThreshold());
  }
  final InputConnection ic=getCurrentInputConnection();
  if (ic != null) {
    final boolean oldAutoCorrectionIndicator=mComposingStateManager.isAutoCorrectionIndicatorOn();
    final boolean newAutoCorrectionIndicator=Utils.willAutoCorrect(words);
    if (oldAutoCorrectionIndicator != newAutoCorrectionIndicator) {
      if (LatinImeLogger.sDBG) {
        Log.d(TAG,"String_Node_Str" + oldAutoCorrectionIndicator + "String_Node_Str"+ newAutoCorrectionIndicator);
      }
      final CharSequence textWithUnderline=newAutoCorrectionIndicator ? SuggestionSpanUtils.getTextWithAutoCorrectionIndicatorUnderline(this,mComposingStringBuilder) : mComposingStringBuilder;
      if (!TextUtils.isEmpty(textWithUnderline)) {
        ic.setComposingText(textWithUnderline,1);
      }
      mComposingStateManager.setAutoCorrectionIndicatorOn(newAutoCorrectionIndicator);
    }
  }
}
Program: 88123
Project: 88123
Buggy source:
public void showSuggestions(SuggestedWords suggestedWords,CharSequence typedWord){
  setSuggestions(suggestedWords);
  if (suggestedWords.size() > 0) {
    if (Utils.shouldBlockedBySafetyNetForAutoCorrection(suggestedWords,mSuggest)) {
      mBestWord=typedWord;
    }
 else     if (suggestedWords.hasAutoCorrectionWord()) {
      mBestWord=suggestedWords.getWord(1);
    }
 else {
      mBestWord=typedWord;
    }
  }
 else {
    mBestWord=null;
  }
  setSuggestionStripShown(isSuggestionsStripVisible());
}

Fixed version (ground truth):
public void showSuggestions(SuggestedWords suggestedWords,CharSequence typedWord){
  final boolean shouldBlockAutoCorrectionBySafetyNet=Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords,mSuggest);
  if (shouldBlockAutoCorrectionBySafetyNet) {
    suggestedWords.setShouldBlockAutoCorrection();
  }
  setSuggestions(suggestedWords);
  if (suggestedWords.size() > 0) {
    if (shouldBlockAutoCorrectionBySafetyNet) {
      mBestWord=typedWord;
    }
 else     if (suggestedWords.hasAutoCorrectionWord()) {
      mBestWord=suggestedWords.getWord(1);
    }
 else {
      mBestWord=typedWord;
    }
  }
 else {
    mBestWord=null;
  }
  setSuggestionStripShown(isSuggestionsStripVisible());
}
Program: 88124
Project: 88124
Buggy source:
public boolean hasWordAboveAutoCorrectionScoreThreshold(){
  return mHasMinimalSuggestion && ((size() > 1 && !mTypedWordValid) || mTypedWordValid);
}

Fixed version (ground truth):
public boolean hasWordAboveAutoCorrectionScoreThreshold(){
  return mHasAutoCorrectionCandidate && ((size() > 1 && !mTypedWordValid) || mTypedWordValid);
}
Program: 88125
Project: 88125
Buggy source:
public boolean hasAutoCorrectionWord(){
  return mHasMinimalSuggestion && size() > 1 && !mTypedWordValid;
}

Fixed version (ground truth):
public boolean hasAutoCorrectionWord(){
  return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid;
}
Program: 88126
Project: 88126
Buggy source:
private SuggestedWords(List<CharSequence> words,boolean typedWordValid,boolean hasMinimalSuggestion,boolean isPunctuationSuggestions,List<SuggestedWordInfo> suggestedWordInfoList){
  if (words != null) {
    mWords=words;
  }
 else {
    mWords=Collections.emptyList();
  }
  mTypedWordValid=typedWordValid;
  mHasMinimalSuggestion=hasMinimalSuggestion;
  mIsPunctuationSuggestions=isPunctuationSuggestions;
  mSuggestedWordInfoList=suggestedWordInfoList;
}

Fixed version (ground truth):
private SuggestedWords(List<CharSequence> words,boolean typedWordValid,boolean hasAutoCorrectionCandidate,boolean isPunctuationSuggestions,List<SuggestedWordInfo> suggestedWordInfoList){
  if (words != null) {
    mWords=words;
  }
 else {
    mWords=Collections.emptyList();
  }
  mTypedWordValid=typedWordValid;
  mHasAutoCorrectionCandidate=hasAutoCorrectionCandidate;
  mIsPunctuationSuggestions=isPunctuationSuggestions;
  mSuggestedWordInfoList=suggestedWordInfoList;
  mShouldBlockAutoCorrection=false;
}
Program: 88127
Project: 88127
Buggy source:
public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str" + mTypedWordValid + "String_Node_Str"+ mHasMinimalSuggestion+ "String_Node_Str"+ mIsPunctuationSuggestions+ "String_Node_Str");
  for (  CharSequence s : mWords) {
    sb.append(s);
    sb.append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str" + mTypedWordValid + "String_Node_Str"+ mHasMinimalSuggestion+ "String_Node_Str"+ mIsPunctuationSuggestions+ "String_Node_Str");
  for (  CharSequence s : mWords) {
    sb.append(s);
    sb.append("String_Node_Str");
  }
  return sb.toString();
}
Program: 88128
Project: 88128
Buggy source:
private int getSuggestionTextColor(int index,SuggestedWords suggestions,int pos){
  final boolean isSuggested=(pos != 0);
  final int color;
  if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
    color=mColorAutoCorrect;
  }
 else   if (isSuggested) {
    color=mColorSuggested;
  }
 else {
    color=mColorTypedWord;
  }
  final SuggestedWordInfo info=(pos < suggestions.size()) ? suggestions.getInfo(pos) : null;
  if (info != null && info.isObsoleteSuggestedWord()) {
    return applyAlpha(color,mAlphaObsoleted);
  }
 else {
    return color;
  }
}

Fixed version (ground truth):
private int getSuggestionTextColor(int index,SuggestedWords suggestions,int pos){
  final boolean isSuggested=(pos != 0);
  final int color;
  if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
    color=mColorAutoCorrect;
  }
 else   if (isSuggested) {
    color=mColorSuggested;
  }
 else {
    color=mColorTypedWord;
  }
  if (LatinImeLogger.sDBG) {
    if (index == mCenterSuggestionIndex && suggestions.mHasAutoCorrectionCandidate && suggestions.shouldBlockAutoCorrection()) {
      return 0xFFFF0000;
    }
  }
  final SuggestedWordInfo info=(pos < suggestions.size()) ? suggestions.getInfo(pos) : null;
  if (info != null && info.isObsoleteSuggestedWord()) {
    return applyAlpha(color,mAlphaObsoleted);
  }
 else {
    return color;
  }
}
Program: 88129
Project: 88129
Buggy source:
public static boolean willAutoCorrect(SuggestedWords suggestions){
  return !suggestions.mTypedWordValid && suggestions.mHasMinimalSuggestion;
}

Fixed version (ground truth):
public static boolean willAutoCorrect(SuggestedWords suggestions){
  return !suggestions.mTypedWordValid && suggestions.mHasAutoCorrectionCandidate && !suggestions.shouldBlockAutoCorrection();
}
Program: 88130
Project: 88130
Buggy source:
public void showSuggestions(SuggestedWords suggestedWords,CharSequence typedWord){
  setSuggestions(suggestedWords);
  if (suggestedWords.size() > 0) {
    if (Utils.shouldBlockedBySafetyNetForAutoCorrection(suggestedWords,mSuggest)) {
      mBestWord=typedWord;
    }
 else     if (suggestedWords.hasAutoCorrectionWord()) {
      mBestWord=suggestedWords.getWord(1);
    }
 else {
      mBestWord=typedWord;
    }
  }
 else {
    mBestWord=null;
  }
  setSuggestionStripShown(isSuggestionsStripVisible());
}

Fixed version (ground truth):
public void showSuggestions(SuggestedWords suggestedWords,CharSequence typedWord){
  final boolean shouldBlockAutoCorrectionBySafetyNet=Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords,mSuggest);
  if (shouldBlockAutoCorrectionBySafetyNet) {
    suggestedWords.setShouldBlockAutoCorrection();
  }
  setSuggestions(suggestedWords);
  if (suggestedWords.size() > 0) {
    if (shouldBlockAutoCorrectionBySafetyNet) {
      mBestWord=typedWord;
    }
 else     if (suggestedWords.hasAutoCorrectionWord()) {
      mBestWord=suggestedWords.getWord(1);
    }
 else {
      mBestWord=typedWord;
    }
  }
 else {
    mBestWord=null;
  }
  setSuggestionStripShown(isSuggestionsStripVisible());
}
Program: 88131
Project: 88131
Buggy source:
public boolean hasWordAboveAutoCorrectionScoreThreshold(){
  return mHasMinimalSuggestion && ((size() > 1 && !mTypedWordValid) || mTypedWordValid);
}

Fixed version (ground truth):
public boolean hasWordAboveAutoCorrectionScoreThreshold(){
  return mHasAutoCorrectionCandidate && ((size() > 1 && !mTypedWordValid) || mTypedWordValid);
}
Program: 88132
Project: 88132
Buggy source:
public boolean hasAutoCorrectionWord(){
  return mHasMinimalSuggestion && size() > 1 && !mTypedWordValid;
}

Fixed version (ground truth):
public boolean hasAutoCorrectionWord(){
  return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid;
}
Program: 88133
Project: 88133
Buggy source:
private SuggestedWords(List<CharSequence> words,boolean typedWordValid,boolean hasMinimalSuggestion,boolean isPunctuationSuggestions,List<SuggestedWordInfo> suggestedWordInfoList){
  if (words != null) {
    mWords=words;
  }
 else {
    mWords=Collections.emptyList();
  }
  mTypedWordValid=typedWordValid;
  mHasMinimalSuggestion=hasMinimalSuggestion;
  mIsPunctuationSuggestions=isPunctuationSuggestions;
  mSuggestedWordInfoList=suggestedWordInfoList;
}

Fixed version (ground truth):
private SuggestedWords(List<CharSequence> words,boolean typedWordValid,boolean hasAutoCorrectionCandidate,boolean isPunctuationSuggestions,List<SuggestedWordInfo> suggestedWordInfoList){
  if (words != null) {
    mWords=words;
  }
 else {
    mWords=Collections.emptyList();
  }
  mTypedWordValid=typedWordValid;
  mHasAutoCorrectionCandidate=hasAutoCorrectionCandidate;
  mIsPunctuationSuggestions=isPunctuationSuggestions;
  mSuggestedWordInfoList=suggestedWordInfoList;
  mShouldBlockAutoCorrection=false;
}
Program: 88134
Project: 88134
Buggy source:
public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str" + mTypedWordValid + "String_Node_Str"+ mHasMinimalSuggestion+ "String_Node_Str"+ mIsPunctuationSuggestions+ "String_Node_Str");
  for (  CharSequence s : mWords) {
    sb.append(s);
    sb.append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str" + mTypedWordValid + "String_Node_Str"+ mHasMinimalSuggestion+ "String_Node_Str"+ mIsPunctuationSuggestions+ "String_Node_Str");
  for (  CharSequence s : mWords) {
    sb.append(s);
    sb.append("String_Node_Str");
  }
  return sb.toString();
}
Program: 88135
Project: 88135
Buggy source:
private int getSuggestionTextColor(int index,SuggestedWords suggestions,int pos){
  final boolean isSuggested=(pos != 0);
  final int color;
  if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
    color=mColorAutoCorrect;
  }
 else   if (isSuggested) {
    color=mColorSuggested;
  }
 else {
    color=mColorTypedWord;
  }
  final SuggestedWordInfo info=(pos < suggestions.size()) ? suggestions.getInfo(pos) : null;
  if (info != null && info.isObsoleteSuggestedWord()) {
    return applyAlpha(color,mAlphaObsoleted);
  }
 else {
    return color;
  }
}

Fixed version (ground truth):
private int getSuggestionTextColor(int index,SuggestedWords suggestions,int pos){
  final boolean isSuggested=(pos != 0);
  final int color;
  if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
    color=mColorAutoCorrect;
  }
 else   if (isSuggested) {
    color=mColorSuggested;
  }
 else {
    color=mColorTypedWord;
  }
  if (LatinImeLogger.sDBG) {
    if (index == mCenterSuggestionIndex && suggestions.mHasAutoCorrectionCandidate && suggestions.shouldBlockAutoCorrection()) {
      return 0xFFFF0000;
    }
  }
  final SuggestedWordInfo info=(pos < suggestions.size()) ? suggestions.getInfo(pos) : null;
  if (info != null && info.isObsoleteSuggestedWord()) {
    return applyAlpha(color,mAlphaObsoleted);
  }
 else {
    return color;
  }
}
Program: 88136
Project: 88136
Buggy source:
public static boolean willAutoCorrect(SuggestedWords suggestions){
  return !suggestions.mTypedWordValid && suggestions.mHasMinimalSuggestion;
}

Fixed version (ground truth):
public static boolean willAutoCorrect(SuggestedWords suggestions){
  return !suggestions.mTypedWordValid && suggestions.mHasAutoCorrectionCandidate && !suggestions.shouldBlockAutoCorrection();
}
Program: 88137
Project: 88137
Buggy source:
public void showSuggestions(SuggestedWords suggestedWords,CharSequence typedWord){
  setSuggestions(suggestedWords);
  if (suggestedWords.size() > 0) {
    if (Utils.shouldBlockedBySafetyNetForAutoCorrection(suggestedWords,mSuggest)) {
      mBestWord=typedWord;
    }
 else     if (suggestedWords.hasAutoCorrectionWord()) {
      mBestWord=suggestedWords.getWord(1);
    }
 else {
      mBestWord=typedWord;
    }
  }
 else {
    mBestWord=null;
  }
  setSuggestionStripShown(isSuggestionsStripVisible());
}

Fixed version (ground truth):
public void showSuggestions(SuggestedWords suggestedWords,CharSequence typedWord){
  final boolean shouldBlockAutoCorrectionBySafetyNet=Utils.shouldBlockAutoCorrectionBySafetyNet(suggestedWords,mSuggest);
  if (shouldBlockAutoCorrectionBySafetyNet) {
    suggestedWords.setShouldBlockAutoCorrection();
  }
  setSuggestions(suggestedWords);
  if (suggestedWords.size() > 0) {
    if (shouldBlockAutoCorrectionBySafetyNet) {
      mBestWord=typedWord;
    }
 else     if (suggestedWords.hasAutoCorrectionWord()) {
      mBestWord=suggestedWords.getWord(1);
    }
 else {
      mBestWord=typedWord;
    }
  }
 else {
    mBestWord=null;
  }
  setSuggestionStripShown(isSuggestionsStripVisible());
}
Program: 88138
Project: 88138
Buggy source:
public boolean hasWordAboveAutoCorrectionScoreThreshold(){
  return mHasMinimalSuggestion && ((size() > 1 && !mTypedWordValid) || mTypedWordValid);
}

Fixed version (ground truth):
public boolean hasWordAboveAutoCorrectionScoreThreshold(){
  return mHasAutoCorrectionCandidate && ((size() > 1 && !mTypedWordValid) || mTypedWordValid);
}
Program: 88139
Project: 88139
Buggy source:
public boolean hasAutoCorrectionWord(){
  return mHasMinimalSuggestion && size() > 1 && !mTypedWordValid;
}

Fixed version (ground truth):
public boolean hasAutoCorrectionWord(){
  return mHasAutoCorrectionCandidate && size() > 1 && !mTypedWordValid;
}
Program: 88140
Project: 88140
Buggy source:
private SuggestedWords(List<CharSequence> words,boolean typedWordValid,boolean hasMinimalSuggestion,boolean isPunctuationSuggestions,List<SuggestedWordInfo> suggestedWordInfoList){
  if (words != null) {
    mWords=words;
  }
 else {
    mWords=Collections.emptyList();
  }
  mTypedWordValid=typedWordValid;
  mHasMinimalSuggestion=hasMinimalSuggestion;
  mIsPunctuationSuggestions=isPunctuationSuggestions;
  mSuggestedWordInfoList=suggestedWordInfoList;
}

Fixed version (ground truth):
private SuggestedWords(List<CharSequence> words,boolean typedWordValid,boolean hasAutoCorrectionCandidate,boolean isPunctuationSuggestions,List<SuggestedWordInfo> suggestedWordInfoList){
  if (words != null) {
    mWords=words;
  }
 else {
    mWords=Collections.emptyList();
  }
  mTypedWordValid=typedWordValid;
  mHasAutoCorrectionCandidate=hasAutoCorrectionCandidate;
  mIsPunctuationSuggestions=isPunctuationSuggestions;
  mSuggestedWordInfoList=suggestedWordInfoList;
  mShouldBlockAutoCorrection=false;
}
Program: 88141
Project: 88141
Buggy source:
public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str" + mTypedWordValid + "String_Node_Str"+ mHasMinimalSuggestion+ "String_Node_Str"+ mIsPunctuationSuggestions+ "String_Node_Str");
  for (  CharSequence s : mWords) {
    sb.append(s);
    sb.append("String_Node_Str");
  }
  return sb.toString();
}

Fixed version (ground truth):
@Override public String toString(){
  final StringBuilder sb=new StringBuilder("String_Node_Str" + mTypedWordValid + "String_Node_Str"+ mHasMinimalSuggestion+ "String_Node_Str"+ mIsPunctuationSuggestions+ "String_Node_Str");
  for (  CharSequence s : mWords) {
    sb.append(s);
    sb.append("String_Node_Str");
  }
  return sb.toString();
}
Program: 88142
Project: 88142
Buggy source:
private int getSuggestionTextColor(int index,SuggestedWords suggestions,int pos){
  final boolean isSuggested=(pos != 0);
  final int color;
  if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
    color=mColorAutoCorrect;
  }
 else   if (isSuggested) {
    color=mColorSuggested;
  }
 else {
    color=mColorTypedWord;
  }
  final SuggestedWordInfo info=(pos < suggestions.size()) ? suggestions.getInfo(pos) : null;
  if (info != null && info.isObsoleteSuggestedWord()) {
    return applyAlpha(color,mAlphaObsoleted);
  }
 else {
    return color;
  }
}

Fixed version (ground truth):
private int getSuggestionTextColor(int index,SuggestedWords suggestions,int pos){
  final boolean isSuggested=(pos != 0);
  final int color;
  if (index == mCenterSuggestionIndex && Utils.willAutoCorrect(suggestions)) {
    color=mColorAutoCorrect;
  }
 else   if (isSuggested) {
    color=mColorSuggested;
  }
 else {
    color=mColorTypedWord;
  }
  if (LatinImeLogger.sDBG) {
    if (index == mCenterSuggestionIndex && suggestions.mHasAutoCorrectionCandidate && suggestions.shouldBlockAutoCorrection()) {
      return 0xFFFF0000;
    }
  }
  final SuggestedWordInfo info=(pos < suggestions.size()) ? suggestions.getInfo(pos) : null;
  if (info != null && info.isObsoleteSuggestedWord()) {
    return applyAlpha(color,mAlphaObsoleted);
  }
 else {
    return color;
  }
}
Program: 88143
Project: 88143
Buggy source:
public static boolean willAutoCorrect(SuggestedWords suggestions){
  return !suggestions.mTypedWordValid && suggestions.mHasMinimalSuggestion;
}

Fixed version (ground truth):
public static boolean willAutoCorrect(SuggestedWords suggestions){
  return !suggestions.mTypedWordValid && suggestions.mHasAutoCorrectionCandidate && !suggestions.shouldBlockAutoCorrection();
}
Program: 88144
Project: 88144
Buggy source:
private boolean hasAutoCorrectionForTypedWord(Map<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<CharSequence> suggestions,CharSequence typedWord,int correctionMode){
  if (TextUtils.isEmpty(typedWord))   return false;
  boolean isValidWord=isValidWordForAutoCorrection(dictionaries,typedWord,false);
  return wordComposer.size() > 1 && suggestions.size() > 0 && isValidWord && (correctionMode == Suggest.CORRECTION_FULL || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}

Fixed version (ground truth):
private boolean hasAutoCorrectionForTypedWord(Map<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<CharSequence> suggestions,CharSequence typedWord,int correctionMode){
  if (TextUtils.isEmpty(typedWord))   return false;
  boolean allowsAutoCorrect=allowsToBeAutoCorrected(dictionaries,typedWord,false);
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsAutoCorrect && (correctionMode == Suggest.CORRECTION_FULL || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}
Program: 88146
Project: 88146
Buggy source:
public boolean isValidWord(CharSequence typed){
  return AutoCorrection.isValidWordForAutoCorrection(mSuggest.getUnigramDictionaries(),typed,false);
}

Fixed version (ground truth):
public boolean isValidWord(CharSequence typed){
  return AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(),typed,false);
}
Program: 88147
Project: 88147
Buggy source:
private boolean hasAutoCorrectionForTypedWord(Map<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<CharSequence> suggestions,CharSequence typedWord,int correctionMode){
  if (TextUtils.isEmpty(typedWord))   return false;
  boolean isValidWord=isValidWordForAutoCorrection(dictionaries,typedWord,false);
  return wordComposer.size() > 1 && suggestions.size() > 0 && isValidWord && (correctionMode == Suggest.CORRECTION_FULL || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}

Fixed version (ground truth):
private boolean hasAutoCorrectionForTypedWord(Map<String,Dictionary> dictionaries,WordComposer wordComposer,ArrayList<CharSequence> suggestions,CharSequence typedWord,int correctionMode){
  if (TextUtils.isEmpty(typedWord))   return false;
  boolean allowsAutoCorrect=allowsToBeAutoCorrected(dictionaries,typedWord,false);
  return wordComposer.size() > 1 && suggestions.size() > 0 && !allowsAutoCorrect && (correctionMode == Suggest.CORRECTION_FULL || correctionMode == Suggest.CORRECTION_FULL_BIGRAM);
}
Program: 88149
Project: 88149
Buggy source:
public boolean isValidWord(CharSequence typed){
  return AutoCorrection.isValidWordForAutoCorrection(mSuggest.getUnigramDictionaries(),typed,false);
}

Fixed version (ground truth):
public boolean isValidWord(CharSequence typed){
  return AutoCorrection.isValidWord(mSuggest.getUnigramDictionaries(),typed,false);
}