nus-yam/ex-repair huggingface dataset:
Program: 2603
Project: 2603
Buggy source:
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  this.layoutDirection=layoutDirection;
}

Fixed version (ground truth):
/** 
 * Set the layout direction
 * @param layoutDirection the layout direction.Should be either  {@link View#LAYOUT_DIRECTION_LTR}or   {@link View#LAYOUT_DIRECTION_RTL}.
 */
public void setLayoutDirection(int layoutDirection){
  if (layoutDirection != View.LAYOUT_DIRECTION_LTR && layoutDirection != View.LAYOUT_DIRECTION_RTL)   return;
  if (layoutDirection != this.mLayoutDirection) {
    this.mLayoutDirection=layoutDirection;
    this.mNeedResolution=isMarginRelative();
  }
}
Program: 2604
Project: 2604
Buggy source:
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_RELATIVE)   return startMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the start margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @return the start margin in pixels.
 */
public int getMarginStart(){
  if (startMargin != DEFAULT_MARGIN_RELATIVE)   return startMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return rightMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return leftMargin;
}
}
Program: 2605
Project: 2605
Buggy source:
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  initialLeftMargin=left;
  initialRightMargin=right;
}

Fixed version (ground truth):
/** 
 * Sets the margins, in pixels. A call to   {@link android.view.View#requestLayout()} needsto be done so that the new margins are taken into account. Left and right margins may be overriden by  {@link android.view.View#requestLayout()} depending on layout direction.
 * @param left the left margin size
 * @param top the top margin size
 * @param right the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginLeft
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginRight
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 */
public void setMargins(int left,int top,int right,int bottom){
  leftMargin=left;
  topMargin=top;
  rightMargin=right;
  bottomMargin=bottom;
  mNeedResolution=isMarginRelative();
}
Program: 2606
Project: 2606
Buggy source:
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (layoutDirection == View.LAYOUT_DIRECTION_RTL);
}

Fixed version (ground truth):
/** 
 * @hide
 */
public boolean isLayoutRtl(){
  return (mLayoutDirection == View.LAYOUT_DIRECTION_RTL);
}
Program: 2607
Project: 2607
Buggy source:
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_RELATIVE)   return endMargin;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}

Fixed version (ground truth):
/** 
 * Returns the end margin in pixels.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return the end margin in pixels.
 */
public int getMarginEnd(){
  if (endMargin != DEFAULT_MARGIN_RELATIVE)   return endMargin;
  if (mNeedResolution) {
    doResolveMargins();
  }
switch (mLayoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    return leftMargin;
case View.LAYOUT_DIRECTION_LTR:
default :
  return rightMargin;
}
}
Program: 2608
Project: 2608
Buggy source:
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
public MarginLayoutParams(LayoutParams source){
  super(source);
  mNeedResolution=false;
  mIsRtlCompatibilityMode=false;
}
Program: 2609
Project: 2609
Buggy source:
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return layoutDirection;
}

Fixed version (ground truth):
/** 
 * Retuns the layout direction. Can be either   {@link View#LAYOUT_DIRECTION_LTR} or{@link View#LAYOUT_DIRECTION_RTL}.
 * @return the layout direction.
 */
public int getLayoutDirection(){
  return mLayoutDirection;
}
Program: 2610
Project: 2610
Buggy source:
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative())   return;
switch (layoutDirection) {
case View.LAYOUT_DIRECTION_RTL:
    leftMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialLeftMargin;
  rightMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialRightMargin;
break;
case View.LAYOUT_DIRECTION_LTR:
default :
leftMargin=(startMargin > DEFAULT_RELATIVE) ? startMargin : initialLeftMargin;
rightMargin=(endMargin > DEFAULT_RELATIVE) ? endMargin : initialRightMargin;
break;
}
}

Fixed version (ground truth):
/** 
 * This will be called by   {@link android.view.View#requestLayout()}. Left and Right margins may be overridden depending on layout direction.
 */
@Override public void resolveLayoutDirection(int layoutDirection){
  setLayoutDirection(layoutDirection);
  if (!isMarginRelative() || !mNeedResolution || mIsRtlCompatibilityMode)   return;
  doResolveMargins();
}
Program: 2611
Project: 2611
Buggy source:
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_RELATIVE) || (endMargin != DEFAULT_RELATIVE);
}

Fixed version (ground truth):
/** 
 * Check if margins are relative.
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @return true if either marginStart or marginEnd has been set.
 */
public boolean isMarginRelative(){
  return (startMargin != DEFAULT_MARGIN_RELATIVE || endMargin != DEFAULT_MARGIN_RELATIVE);
}
Program: 2612
Project: 2612
Buggy source:
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
}

Fixed version (ground truth):
/** 
 * Sets the relative end margin.
 * @param end the end margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 */
public void setMarginEnd(int end){
  endMargin=end;
  mNeedResolution=true;
}
Program: 2613
Project: 2613
Buggy source:
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  initialLeftMargin=0;
  initialRightMargin=0;
}

Fixed version (ground truth):
/** 
 * Sets the relative margins, in pixels. A call to   {@link android.view.View#requestLayout()}needs to be done so that the new relative margins are taken into account. Left and right margins may be overriden by   {@link android.view.View#requestLayout()} depending on layoutdirection.
 * @param start the start margin size
 * @param top the top margin size
 * @param end the right margin size
 * @param bottom the bottom margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginTop
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginEnd
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginBottom
 * @hide
 */
public void setMarginsRelative(int start,int top,int end,int bottom){
  startMargin=start;
  topMargin=top;
  endMargin=end;
  bottomMargin=bottom;
  mNeedResolution=true;
}
Program: 2614
Project: 2614
Buggy source:
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
}

Fixed version (ground truth):
/** 
 * Sets the relative start margin.
 * @param start the start margin size
 * @attr ref android.R.styleable#ViewGroup_MarginLayout_layout_marginStart
 */
public void setMarginStart(int start){
  startMargin=start;
  mNeedResolution=true;
}
Program: 2615
Project: 2615
Buggy source:
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
@Override public void resolveLayoutDirection(int layoutDirection){
  final boolean isLayoutRtl=isLayoutRtl();
  if (isLayoutRtl) {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mRight=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mLeft=mEnd;
  }
 else {
    if (mStart != DEFAULT_MARGIN_RELATIVE)     mLeft=mStart;
    if (mEnd != DEFAULT_MARGIN_RELATIVE)     mRight=mEnd;
  }
  if (hasRelativeRules() && layoutDirection != getLayoutDirection()) {
    resolveRules(layoutDirection);
  }
  super.resolveLayoutDirection(layoutDirection);
}
Program: 2616
Project: 2616
Buggy source:
private void initTitle(){
  if (mTitleLayout == null) {
    LayoutInflater inflater=LayoutInflater.from(getContext());
    mTitleLayout=(LinearLayout)inflater.inflate(R.layout.action_bar_title_item,this,false);
    mTitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_title);
    mSubtitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_subtitle);
    mTitleUpView=(View)mTitleLayout.findViewById(R.id.up);
    if (mTitleStyleRes != 0) {
      mTitleView.setTextAppearance(mContext,mTitleStyleRes);
    }
    if (mTitle != null) {
      mTitleView.setText(mTitle);
    }
    if (mSubtitleStyleRes != 0) {
      mSubtitleView.setTextAppearance(mContext,mSubtitleStyleRes);
    }
    if (mSubtitle != null) {
      mSubtitleView.setText(mSubtitle);
      mSubtitleView.setVisibility(VISIBLE);
    }
    final boolean homeAsUp=(mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
    final boolean showHome=(mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
    final boolean showTitleUp=!showHome;
    mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
  }
  mUpGoerFive.addView(mTitleLayout);
  if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
    mTitleLayout.setVisibility(GONE);
  }
}

Fixed version (ground truth):
private void initTitle(){
  if (mTitleLayout == null) {
    LayoutInflater inflater=LayoutInflater.from(getContext());
    mTitleLayout=(LinearLayout)inflater.inflate(R.layout.action_bar_title_item,this,false);
    mTitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_title);
    mSubtitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_subtitle);
    mTitleUpView=(View)mTitleLayout.findViewById(R.id.up);
    if (mTitleStyleRes != 0) {
      mTitleView.setTextAppearance(mContext,mTitleStyleRes);
    }
    if (mTitle != null) {
      mTitleView.setText(mTitle);
    }
    if (mSubtitleStyleRes != 0) {
      mSubtitleView.setTextAppearance(mContext,mSubtitleStyleRes);
    }
    if (mSubtitle != null) {
      mSubtitleView.setText(mSubtitle);
      mSubtitleView.setVisibility(VISIBLE);
    }
    final boolean homeAsUp=(mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
    final boolean showHome=(mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
    final boolean showTitleUp=!showHome;
    mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
  }
  mUpGoerFive.addView(mTitleLayout);
  if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
    mTitleLayout.setVisibility(GONE);
  }
 else {
    mTitleLayout.setVisibility(VISIBLE);
  }
}
Program: 2617
Project: 2617
Buggy source:
@Override public boolean collapseItemActionView(MenuBuilder menu,MenuItemImpl item){
  if (mExpandedActionView instanceof CollapsibleActionView) {
    ((CollapsibleActionView)mExpandedActionView).onActionViewCollapsed();
  }
  removeView(mExpandedActionView);
  mUpGoerFive.removeView(mExpandedHomeLayout);
  mExpandedActionView=null;
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
    mHomeLayout.setVisibility(VISIBLE);
  }
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
    if (mTitleLayout == null) {
      initTitle();
    }
 else {
      mTitleLayout.setVisibility(VISIBLE);
    }
  }
  if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
    mTabScrollView.setVisibility(VISIBLE);
  }
  if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
    mSpinner.setVisibility(VISIBLE);
  }
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    mCustomNavView.setVisibility(VISIBLE);
  }
  mExpandedHomeLayout.setIcon(null);
  mCurrentExpandedItem=null;
  setHomeButtonEnabled(mWasHomeEnabled);
  requestLayout();
  item.setActionViewExpanded(false);
  return true;
}

Fixed version (ground truth):
@Override public boolean collapseItemActionView(MenuBuilder menu,MenuItemImpl item){
  if (mExpandedActionView instanceof CollapsibleActionView) {
    ((CollapsibleActionView)mExpandedActionView).onActionViewCollapsed();
  }
  removeView(mExpandedActionView);
  mUpGoerFive.removeView(mExpandedHomeLayout);
  mExpandedActionView=null;
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
    mHomeLayout.setVisibility(VISIBLE);
  }
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
    if (mTitleLayout == null) {
      initTitle();
    }
 else {
      mTitleLayout.setVisibility(VISIBLE);
    }
  }
  if (mTabScrollView != null)   mTabScrollView.setVisibility(VISIBLE);
  if (mSpinner != null)   mSpinner.setVisibility(VISIBLE);
  if (mCustomNavView != null)   mCustomNavView.setVisibility(VISIBLE);
  mExpandedHomeLayout.setIcon(null);
  mCurrentExpandedItem=null;
  setHomeButtonEnabled(mWasHomeEnabled);
  requestLayout();
  item.setActionViewExpanded(false);
  return true;
}
Program: 2618
Project: 2618
Buggy source:
private void initTitle(){
  if (mTitleLayout == null) {
    LayoutInflater inflater=LayoutInflater.from(getContext());
    mTitleLayout=(LinearLayout)inflater.inflate(R.layout.action_bar_title_item,this,false);
    mTitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_title);
    mSubtitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_subtitle);
    mTitleUpView=(View)mTitleLayout.findViewById(R.id.up);
    if (mTitleStyleRes != 0) {
      mTitleView.setTextAppearance(mContext,mTitleStyleRes);
    }
    if (mTitle != null) {
      mTitleView.setText(mTitle);
    }
    if (mSubtitleStyleRes != 0) {
      mSubtitleView.setTextAppearance(mContext,mSubtitleStyleRes);
    }
    if (mSubtitle != null) {
      mSubtitleView.setText(mSubtitle);
      mSubtitleView.setVisibility(VISIBLE);
    }
    final boolean homeAsUp=(mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
    final boolean showHome=(mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
    final boolean showTitleUp=!showHome;
    mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
  }
  mUpGoerFive.addView(mTitleLayout);
  if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
    mTitleLayout.setVisibility(GONE);
  }
}

Fixed version (ground truth):
private void initTitle(){
  if (mTitleLayout == null) {
    LayoutInflater inflater=LayoutInflater.from(getContext());
    mTitleLayout=(LinearLayout)inflater.inflate(R.layout.action_bar_title_item,this,false);
    mTitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_title);
    mSubtitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_subtitle);
    mTitleUpView=(View)mTitleLayout.findViewById(R.id.up);
    if (mTitleStyleRes != 0) {
      mTitleView.setTextAppearance(mContext,mTitleStyleRes);
    }
    if (mTitle != null) {
      mTitleView.setText(mTitle);
    }
    if (mSubtitleStyleRes != 0) {
      mSubtitleView.setTextAppearance(mContext,mSubtitleStyleRes);
    }
    if (mSubtitle != null) {
      mSubtitleView.setText(mSubtitle);
      mSubtitleView.setVisibility(VISIBLE);
    }
    final boolean homeAsUp=(mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
    final boolean showHome=(mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
    final boolean showTitleUp=!showHome;
    mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
  }
  mUpGoerFive.addView(mTitleLayout);
  if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
    mTitleLayout.setVisibility(GONE);
  }
 else {
    mTitleLayout.setVisibility(VISIBLE);
  }
}
Program: 2619
Project: 2619
Buggy source:
@Override public boolean collapseItemActionView(MenuBuilder menu,MenuItemImpl item){
  if (mExpandedActionView instanceof CollapsibleActionView) {
    ((CollapsibleActionView)mExpandedActionView).onActionViewCollapsed();
  }
  removeView(mExpandedActionView);
  mUpGoerFive.removeView(mExpandedHomeLayout);
  mExpandedActionView=null;
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
    mHomeLayout.setVisibility(VISIBLE);
  }
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
    if (mTitleLayout == null) {
      initTitle();
    }
 else {
      mTitleLayout.setVisibility(VISIBLE);
    }
  }
  if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
    mTabScrollView.setVisibility(VISIBLE);
  }
  if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
    mSpinner.setVisibility(VISIBLE);
  }
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    mCustomNavView.setVisibility(VISIBLE);
  }
  mExpandedHomeLayout.setIcon(null);
  mCurrentExpandedItem=null;
  setHomeButtonEnabled(mWasHomeEnabled);
  requestLayout();
  item.setActionViewExpanded(false);
  return true;
}

Fixed version (ground truth):
@Override public boolean collapseItemActionView(MenuBuilder menu,MenuItemImpl item){
  if (mExpandedActionView instanceof CollapsibleActionView) {
    ((CollapsibleActionView)mExpandedActionView).onActionViewCollapsed();
  }
  removeView(mExpandedActionView);
  mUpGoerFive.removeView(mExpandedHomeLayout);
  mExpandedActionView=null;
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
    mHomeLayout.setVisibility(VISIBLE);
  }
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
    if (mTitleLayout == null) {
      initTitle();
    }
 else {
      mTitleLayout.setVisibility(VISIBLE);
    }
  }
  if (mTabScrollView != null)   mTabScrollView.setVisibility(VISIBLE);
  if (mSpinner != null)   mSpinner.setVisibility(VISIBLE);
  if (mCustomNavView != null)   mCustomNavView.setVisibility(VISIBLE);
  mExpandedHomeLayout.setIcon(null);
  mCurrentExpandedItem=null;
  setHomeButtonEnabled(mWasHomeEnabled);
  requestLayout();
  item.setActionViewExpanded(false);
  return true;
}
Program: 2620
Project: 2620
Buggy source:
private void initTitle(){
  if (mTitleLayout == null) {
    LayoutInflater inflater=LayoutInflater.from(getContext());
    mTitleLayout=(LinearLayout)inflater.inflate(R.layout.action_bar_title_item,this,false);
    mTitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_title);
    mSubtitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_subtitle);
    mTitleUpView=(View)mTitleLayout.findViewById(R.id.up);
    if (mTitleStyleRes != 0) {
      mTitleView.setTextAppearance(mContext,mTitleStyleRes);
    }
    if (mTitle != null) {
      mTitleView.setText(mTitle);
    }
    if (mSubtitleStyleRes != 0) {
      mSubtitleView.setTextAppearance(mContext,mSubtitleStyleRes);
    }
    if (mSubtitle != null) {
      mSubtitleView.setText(mSubtitle);
      mSubtitleView.setVisibility(VISIBLE);
    }
    final boolean homeAsUp=(mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
    final boolean showHome=(mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
    final boolean showTitleUp=!showHome;
    mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
  }
  mUpGoerFive.addView(mTitleLayout);
  if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
    mTitleLayout.setVisibility(GONE);
  }
}

Fixed version (ground truth):
private void initTitle(){
  if (mTitleLayout == null) {
    LayoutInflater inflater=LayoutInflater.from(getContext());
    mTitleLayout=(LinearLayout)inflater.inflate(R.layout.action_bar_title_item,this,false);
    mTitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_title);
    mSubtitleView=(TextView)mTitleLayout.findViewById(R.id.action_bar_subtitle);
    mTitleUpView=(View)mTitleLayout.findViewById(R.id.up);
    if (mTitleStyleRes != 0) {
      mTitleView.setTextAppearance(mContext,mTitleStyleRes);
    }
    if (mTitle != null) {
      mTitleView.setText(mTitle);
    }
    if (mSubtitleStyleRes != 0) {
      mSubtitleView.setTextAppearance(mContext,mSubtitleStyleRes);
    }
    if (mSubtitle != null) {
      mSubtitleView.setText(mSubtitle);
      mSubtitleView.setVisibility(VISIBLE);
    }
    final boolean homeAsUp=(mDisplayOptions & ActionBar.DISPLAY_HOME_AS_UP) != 0;
    final boolean showHome=(mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0;
    final boolean showTitleUp=!showHome;
    mTitleUpView.setVisibility(showTitleUp ? (homeAsUp ? VISIBLE : INVISIBLE) : GONE);
  }
  mUpGoerFive.addView(mTitleLayout);
  if (mExpandedActionView != null || (TextUtils.isEmpty(mTitle) && TextUtils.isEmpty(mSubtitle))) {
    mTitleLayout.setVisibility(GONE);
  }
 else {
    mTitleLayout.setVisibility(VISIBLE);
  }
}
Program: 2621
Project: 2621
Buggy source:
@Override public boolean collapseItemActionView(MenuBuilder menu,MenuItemImpl item){
  if (mExpandedActionView instanceof CollapsibleActionView) {
    ((CollapsibleActionView)mExpandedActionView).onActionViewCollapsed();
  }
  removeView(mExpandedActionView);
  mUpGoerFive.removeView(mExpandedHomeLayout);
  mExpandedActionView=null;
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
    mHomeLayout.setVisibility(VISIBLE);
  }
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
    if (mTitleLayout == null) {
      initTitle();
    }
 else {
      mTitleLayout.setVisibility(VISIBLE);
    }
  }
  if (mTabScrollView != null && mNavigationMode == ActionBar.NAVIGATION_MODE_TABS) {
    mTabScrollView.setVisibility(VISIBLE);
  }
  if (mSpinner != null && mNavigationMode == ActionBar.NAVIGATION_MODE_LIST) {
    mSpinner.setVisibility(VISIBLE);
  }
  if (mCustomNavView != null && (mDisplayOptions & ActionBar.DISPLAY_SHOW_CUSTOM) != 0) {
    mCustomNavView.setVisibility(VISIBLE);
  }
  mExpandedHomeLayout.setIcon(null);
  mCurrentExpandedItem=null;
  setHomeButtonEnabled(mWasHomeEnabled);
  requestLayout();
  item.setActionViewExpanded(false);
  return true;
}

Fixed version (ground truth):
@Override public boolean collapseItemActionView(MenuBuilder menu,MenuItemImpl item){
  if (mExpandedActionView instanceof CollapsibleActionView) {
    ((CollapsibleActionView)mExpandedActionView).onActionViewCollapsed();
  }
  removeView(mExpandedActionView);
  mUpGoerFive.removeView(mExpandedHomeLayout);
  mExpandedActionView=null;
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_HOME) != 0) {
    mHomeLayout.setVisibility(VISIBLE);
  }
  if ((mDisplayOptions & ActionBar.DISPLAY_SHOW_TITLE) != 0) {
    if (mTitleLayout == null) {
      initTitle();
    }
 else {
      mTitleLayout.setVisibility(VISIBLE);
    }
  }
  if (mTabScrollView != null)   mTabScrollView.setVisibility(VISIBLE);
  if (mSpinner != null)   mSpinner.setVisibility(VISIBLE);
  if (mCustomNavView != null)   mCustomNavView.setVisibility(VISIBLE);
  mExpandedHomeLayout.setIcon(null);
  mCurrentExpandedItem=null;
  setHomeButtonEnabled(mWasHomeEnabled);
  requestLayout();
  item.setActionViewExpanded(false);
  return true;
}
Program: 2629
Project: 2629
Buggy source:
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint,int reserved);

Fixed version (ground truth):
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint);
Program: 2630
Project: 2630
Buggy source:
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p,int reserved){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos,reserved);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos,reserved);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos,reserved);
    TextUtils.recycle(buf);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos);
    TextUtils.recycle(buf);
  }
  return ret;
}
Program: 2631
Project: 2631
Buggy source:
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p,int reserved){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex,reserved);
}

Fixed version (ground truth):
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex);
}
Program: 2632
Project: 2632
Buggy source:
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint,int reserved);

Fixed version (ground truth):
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint);
Program: 2633
Project: 2633
Buggy source:
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p,int reserved){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos,reserved);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos,reserved);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos,reserved);
    TextUtils.recycle(buf);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos);
    TextUtils.recycle(buf);
  }
  return ret;
}
Program: 2634
Project: 2634
Buggy source:
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p,int reserved){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex,reserved);
}

Fixed version (ground truth):
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex);
}
Program: 2635
Project: 2635
Buggy source:
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint,int reserved);

Fixed version (ground truth):
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint);
Program: 2636
Project: 2636
Buggy source:
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p,int reserved){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos,reserved);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos,reserved);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos,reserved);
    TextUtils.recycle(buf);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos);
    TextUtils.recycle(buf);
  }
  return ret;
}
Program: 2637
Project: 2637
Buggy source:
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p,int reserved){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex,reserved);
}

Fixed version (ground truth):
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex);
}
Program: 2638
Project: 2638
Buggy source:
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint,int reserved);

Fixed version (ground truth):
/** 
 * Just like   {@link Paint#getTextRunAdvances}.
 * @hide
 */
float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint paint);
Program: 2639
Project: 2639
Buggy source:
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p,int reserved){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos,reserved);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos,reserved);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos,reserved);
    TextUtils.recycle(buf);
  }
  return ret;
}

Fixed version (ground truth):
/** 
 * Don't call this yourself -- exists for Paint to use internally.  {@hide}
 */
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesPos,Paint p){
  float ret;
  int contextLen=contextEnd - contextStart;
  int len=end - start;
  if (end <= mGapStart) {
    ret=p.getTextRunAdvances(mText,start,len,contextStart,contextLen,flags,advances,advancesPos);
  }
 else   if (start >= mGapStart) {
    ret=p.getTextRunAdvances(mText,start + mGapLength,len,contextStart + mGapLength,contextLen,flags,advances,advancesPos);
  }
 else {
    char[] buf=TextUtils.obtain(contextLen);
    getChars(contextStart,contextEnd,buf,0);
    ret=p.getTextRunAdvances(buf,start - contextStart,len,0,contextLen,flags,advances,advancesPos);
    TextUtils.recycle(buf);
  }
  return ret;
}
Program: 2640
Project: 2640
Buggy source:
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p,int reserved){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex,reserved);
}

Fixed version (ground truth):
public float getTextRunAdvances(int start,int end,int contextStart,int contextEnd,int flags,float[] advances,int advancesIndex,Paint p){
  int count=end - start;
  int contextCount=contextEnd - contextStart;
  return p.getTextRunAdvances(mChars,start + mStart,count,contextStart + mStart,contextCount,flags,advances,advancesIndex);
}
Program: 2641
Project: 2641
Buggy source:
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables();
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}

Fixed version (ground truth):
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables(mTextView.getContext());
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}
Program: 2642
Project: 2642
Buggy source:
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}

Fixed version (ground truth):
/** 
 * Sets the size of the padding between the compound drawables and the text.
 * @attr ref android.R.styleable#TextView_drawablePadding
 */
@android.view.RemotableViewMethod public void setCompoundDrawablePadding(int pad){
  Drawables dr=mDrawables;
  if (pad == 0) {
    if (dr != null) {
      dr.mDrawablePadding=pad;
    }
  }
 else {
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    dr.mDrawablePadding=pad;
  }
  invalidate();
  requestLayout();
}
Program: 2644
Project: 2644
Buggy source:
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  resetResolvedDrawables();
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}

Fixed version (ground truth):
/** 
 * Sets the Drawables (if any) to appear to the start of, above, to the end of, and below the text.  Use null if you do not want a Drawable there. The Drawables' bounds will be set to their intrinsic bounds.
 * @attr ref android.R.styleable#TextView_drawableStart
 * @attr ref android.R.styleable#TextView_drawableTop
 * @attr ref android.R.styleable#TextView_drawableEnd
 * @attr ref android.R.styleable#TextView_drawableBottom
 */
public void setCompoundDrawablesRelativeWithIntrinsicBounds(Drawable start,Drawable top,Drawable end,Drawable bottom){
  if (start != null) {
    start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
  }
  if (end != null) {
    end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
  }
  if (top != null) {
    top.setBounds(0,0,top.getIntrinsicWidth(),top.getIntrinsicHeight());
  }
  if (bottom != null) {
    bottom.setBounds(0,0,bottom.getIntrinsicWidth(),bottom.getIntrinsicHeight());
  }
  setCompoundDrawablesRelative(start,top,end,bottom);
}
Program: 2645
Project: 2645
Buggy source:
public void resolveWithLayoutDirection(int layoutDirection){
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
    if (mDrawableStart != null) {
      mDrawableRight=mDrawableStart;
      mDrawableSizeRight=mDrawableSizeStart;
      mDrawableHeightRight=mDrawableHeightStart;
    }
  if (mDrawableEnd != null) {
    mDrawableLeft=mDrawableEnd;
    mDrawableSizeLeft=mDrawableSizeEnd;
    mDrawableHeightLeft=mDrawableHeightEnd;
  }
break;
case LAYOUT_DIRECTION_LTR:
default :
if (mDrawableStart != null) {
mDrawableLeft=mDrawableStart;
mDrawableSizeLeft=mDrawableSizeStart;
mDrawableHeightLeft=mDrawableHeightStart;
}
if (mDrawableEnd != null) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}

Fixed version (ground truth):
public void resolveWithLayoutDirection(int layoutDirection){
  mDrawableLeft=mDrawableLeftInitial;
  mDrawableRight=mDrawableRightInitial;
  if (mIsRtlCompatibilityMode) {
    if (mDrawableStart != null && mDrawableLeft == null) {
      mDrawableLeft=mDrawableStart;
      mDrawableSizeLeft=mDrawableSizeStart;
      mDrawableHeightLeft=mDrawableHeightStart;
    }
    if (mDrawableEnd != null && mDrawableRight == null) {
      mDrawableRight=mDrawableEnd;
      mDrawableSizeRight=mDrawableSizeEnd;
      mDrawableHeightRight=mDrawableHeightEnd;
    }
  }
 else {
switch (layoutDirection) {
case LAYOUT_DIRECTION_RTL:
      if (mOverride) {
        mDrawableRight=mDrawableStart;
        mDrawableSizeRight=mDrawableSizeStart;
        mDrawableHeightRight=mDrawableHeightStart;
      }
    if (mOverride) {
      mDrawableLeft=mDrawableEnd;
      mDrawableSizeLeft=mDrawableSizeEnd;
      mDrawableHeightLeft=mDrawableHeightEnd;
    }
  break;
case LAYOUT_DIRECTION_LTR:
default :
if (mOverride) {
  mDrawableLeft=mDrawableStart;
  mDrawableSizeLeft=mDrawableSizeStart;
  mDrawableHeightLeft=mDrawableHeightStart;
}
if (mOverride) {
mDrawableRight=mDrawableEnd;
mDrawableSizeRight=mDrawableSizeEnd;
mDrawableHeightRight=mDrawableHeightEnd;
}
break;
}
}
applyErrorDrawableIfNeeded(layoutDirection);
updateDrawablesLayoutDirection(layoutDirection);
}
Program: 2647
Project: 2647
Buggy source:
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables();
    }
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}

Fixed version (ground truth):
private void setRelativeDrawablesIfNeeded(Drawable start,Drawable end){
  boolean hasRelativeDrawables=(start != null) || (end != null);
  if (hasRelativeDrawables) {
    Drawables dr=mDrawables;
    if (dr == null) {
      mDrawables=dr=new Drawables(getContext());
    }
    mDrawables.mOverride=true;
    final Rect compoundRect=dr.mCompoundRect;
    int[] state=getDrawableState();
    if (start != null) {
      start.setBounds(0,0,start.getIntrinsicWidth(),start.getIntrinsicHeight());
      start.setState(state);
      start.copyBounds(compoundRect);
      start.setCallback(this);
      dr.mDrawableStart=start;
      dr.mDrawableSizeStart=compoundRect.width();
      dr.mDrawableHeightStart=compoundRect.height();
    }
 else {
      dr.mDrawableSizeStart=dr.mDrawableHeightStart=0;
    }
    if (end != null) {
      end.setBounds(0,0,end.getIntrinsicWidth(),end.getIntrinsicHeight());
      end.setState(state);
      end.copyBounds(compoundRect);
      end.setCallback(this);
      dr.mDrawableEnd=end;
      dr.mDrawableSizeEnd=compoundRect.width();
      dr.mDrawableHeightEnd=compoundRect.height();
    }
 else {
      dr.mDrawableSizeEnd=dr.mDrawableHeightEnd=0;
    }
  }
}
Program: 2648
Project: 2648
Buggy source:
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables();
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}

Fixed version (ground truth):
private void setErrorIcon(Drawable icon){
  Drawables dr=mTextView.mDrawables;
  if (dr == null) {
    mTextView.mDrawables=dr=new Drawables(mTextView.getContext());
  }
  dr.setErrorDrawable(icon,mTextView);
  mTextView.resetResolvedDrawables();
  mTextView.invalidate();
  mTextView.requestLayout();
}